@@ -139,17 +139,11 @@ var Autocomplete = function() {
139
139
} ;
140
140
141
141
this . blurListener = function ( e ) {
142
- // If the user clicked on an anchor in the tooltip, open that before
143
- // we close the tooltip
144
- if ( e . relatedTarget && e . relatedTarget . nodeName == "A" && e . relatedTarget . href ) {
145
- window . open ( e . relatedTarget . href , "_blank" ) ;
146
- }
147
-
148
142
// we have to check if activeElement is a child of popup because
149
143
// on IE preventDefault doesn't stop scrollbar from being focussed
150
144
var el = document . activeElement ;
151
145
var text = this . editor . textInput . getElement ( ) ;
152
- var fromTooltip = e . relatedTarget && e . relatedTarget == this . tooltipNode ;
146
+ var fromTooltip = e . relatedTarget && this . tooltipNode . contains ( e . relatedTarget ) ;
153
147
var container = this . popup && this . popup . container ;
154
148
if ( el != text && el . parentNode != container && ! fromTooltip
155
149
&& el != this . tooltipNode && e . relatedTarget != text
@@ -371,6 +365,7 @@ var Autocomplete = function() {
371
365
this . tooltipNode . style . pointerEvents = "auto" ;
372
366
this . tooltipNode . tabIndex = - 1 ;
373
367
this . tooltipNode . onblur = this . blurListener . bind ( this ) ;
368
+ this . tooltipNode . onclick = this . onTooltipClick . bind ( this ) ;
374
369
}
375
370
376
371
var tooltipNode = this . tooltipNode ;
@@ -407,6 +402,18 @@ var Autocomplete = function() {
407
402
if ( el . parentNode )
408
403
el . parentNode . removeChild ( el ) ;
409
404
} ;
405
+
406
+ this . onTooltipClick = function ( e ) {
407
+ var a = e . target ;
408
+ while ( a && a != this . tooltipNode ) {
409
+ if ( a . nodeName == "A" && a . href ) {
410
+ a . rel = "noreferrer" ;
411
+ a . target = "_blank" ;
412
+ break ;
413
+ }
414
+ a = a . parentNode ;
415
+ }
416
+ }
410
417
411
418
} ) . call ( Autocomplete . prototype ) ;
412
419
0 commit comments