Wow, nice code, it inspires me to do other fixes for IE, thnx.

On Sep 26, 3:07 pm, Jean-Lou Dupont <[EMAIL PROTECTED]> wrote:
> Found a work-around: fix-up the HTML anchors:
>
> <code>
> import com.google.gwt.dom.client.Document;
> import com.google.gwt.dom.client.Element;
> import com.google.gwt.dom.client.NodeList;
>
> /**
>  * Fixes HTML <a> element for IE's shortcoming
>  * when it comes to triggering History's 'onHistoryChanged' event.
>  *
>  * @author Jean-Lou Dupont
>  *
>  */
> public class AnchorsUtil {
>
>         public static void updateAnchors() {
>
>                 Document doc = Document.get();
>                 NodeList<Element> anchors = doc.getElementsByTagName("a");
>
>                 if (null==anchors) return;
>
>                 for(int i=0;i<anchors.getLength();i++) {
>                         Element e = anchors.getItem(i);
>                         //make sure we are dealing with a local link
>                         String  href = e.getAttribute( "href" );
>                         if (href.indexOf('#') != -1)
>                                 fixForHistory(e);
>                 }
>
>         }//
>         protected static native void fixForHistory(Element e) /*-{
>
>                 e.onclick = function() {
>                         var href = e.href.split('#')[1];
>                         
> @com.google.gwt.user.client.History::newItem(Ljava/lang/String;)
> (href);
>                 }
>
>         }-*/;
>
> }//END
>
> </code>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to