@@ -343,7 +343,7 @@ public void run() {
343
343
}
344
344
};
345
345
for (int i = 0 ; i < anchors .length ; i ++) {
346
- anchors [i ].href = "javascript:void(0);" ;
346
+ anchors [i ].href = OS . isIE ? "#" : "javascript:void(0);" ;
347
347
anchors [i ].target = "_self" ;
348
348
Clazz .addEvent (anchors [i ], "click" , hLinkSelectionHandler );
349
349
Clazz .addEvent (anchors [i ], "dblclick" , hLinkSelectionHandler );
@@ -539,7 +539,7 @@ String parse (String string, Object handle) {
539
539
}
540
540
if (anchor != null ) {
541
541
if ("#" .equals (ids [linkIndex ])) {
542
- anchor .href = "javascript:void(0);" ;
542
+ anchor .href = OS . isIE ? "#" : "javascript:void(0);" ;
543
543
anchor .target = "_self" ;
544
544
} else {
545
545
anchor .href = ids [linkIndex ];
@@ -843,8 +843,34 @@ public void setText (String string) {
843
843
text = string ;
844
844
textSizeCached = false ;
845
845
anchors = new Element [0 ];
846
+
847
+ if (hLinkSelectionHandler != null ) { // already hook
848
+ // try to unhook it before clear all childNodes
849
+ for (int i = 0 ; i < anchors .length ; i ++) {
850
+ Element anchor = anchors [i ];
851
+ Clazz .removeEvent (anchor , "click" , hLinkSelectionHandler );
852
+ Clazz .removeEvent (anchor , "dblclick" , hLinkSelectionHandler );
853
+ if (ids != null ) {
854
+ if ("#" .equals (ids [i ])) {
855
+ anchor .href = OS .isIE ? "#" : "javascript:void(0);" ;
856
+ anchor .target = "_self" ;
857
+ } else {
858
+ anchor .href = ids [i ];
859
+ anchor .target = "_blank" ;
860
+ }
861
+ }
862
+ }
863
+ }
846
864
OS .clearChildren (handle );
847
865
parse (string , handle );
866
+ if (hLinkSelectionHandler != null ) {
867
+ for (int i = 0 ; i < anchors .length ; i ++) {
868
+ anchors [i ].href = OS .isIE ? "#" : "javascript:void(0);" ;
869
+ anchors [i ].target = "_self" ;
870
+ Clazz .addEvent (anchors [i ], "click" , hLinkSelectionHandler );
871
+ Clazz .addEvent (anchors [i ], "dblclick" , hLinkSelectionHandler );
872
+ }
873
+ }
848
874
/*
849
875
if (OS.COMCTL32_MAJOR >= 6) {
850
876
TCHAR buffer = new TCHAR (getCodePage (), string, true);
@@ -891,7 +917,7 @@ void unhookSelection() {
891
917
Clazz .removeEvent (anchor , "dblclick" , hLinkSelectionHandler );
892
918
if (ids != null ) {
893
919
if ("#" .equals (ids [i ])) {
894
- anchor .href = "javascript:void(0);" ;
920
+ anchor .href = OS . isIE ? "#" : "javascript:void(0);" ;
895
921
anchor .target = "_self" ;
896
922
} else {
897
923
anchor .href = ids [i ];
0 commit comments