The following code is designed to take an element and clone what is
below it(Deep) and then walk up the tree to preserve the path to the
root of the tree. This code works as expected in IE, Firefox, Safari
etc. In testing Chrome I get the non_object_property_call exception
listed below the source code. If you search on this message you find
it in the V8 engine. After doing lots of code trace statements it
appears the problem is related to parentElement.getParentNode() when
you are at the top node of the tree. The returning value is expected
to be NULL but it is not but when you try and test for it to be null
is when you get the exception. I fixed my code by checking for the
known name of the top node and breaking out of the loop. This is
either a bug in the V8 engine or something that GWT 1.5.+ needs to
defend against related to Chrome.

 public static Element cloneFromElementToTopElement(Element
childElement, boolean deepClone) {
        Node cloneElement = childElement.cloneNode(deepClone);
        Node originalCloneElement = cloneElement;
        Node parentElement = childElement.getParentNode();
        while (parentElement != null) {
            Node parentCloneElement = parentElement.cloneNode(false);
            parentCloneElement.appendChild(cloneElement);
            cloneElement = parentCloneElement;
            parentElement = parentElement.getParentNode();
        }

        return (Element) originalCloneElement;
    }


com.google.gwt.core.client.JavaScriptException: (TypeError): type:
non_object_property_call arguments: tS,

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
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