Menu

#1 Only nodes in body selected

open
nobody
None
5
2007-02-27
2007-02-27
Anonymous
No

It seems that one can only select nodes in the body node. Tested with the following call:
document.evaluate("//*", document.getElementsByTagName('html')[0], null, XPathResult.ANY_TYPE, null);

The script-tags in the head are excluded.

Discussion

  • RdeWilde

    RdeWilde - 2008-08-08

    Logged In: YES
    user_id=1555492
    Originator: NO

    Same problem here. Looks like somewhere the documentElement is being replace by a child or something? Didn't have time to search through the whole code.

    Result can be checked by editing line 422:
    if (result._isNodeSet)
    { alert(document._XPathMsxmlDocumentHelper.getDom().documentElement.nodeName);

    result._domResult = document._XPathMsxmlDocumentHelper.getDom().selectNodes(expression);
    }

    An update would be very welcome. Thanks for the script anyway, works great :)

     
  • RdeWilde

    RdeWilde - 2008-08-08

    Logged In: YES
    user_id=1555492
    Originator: NO

    I've checked the code and written a simple fix. I don't know why the old code was formed this way, but I tested it and I think the change has no other consequences:

    Replace on line 546 the old code:
    function loadDocument(dom, helper)
    {
    return loadNode(dom, dom, document.body, helper);
    }

    with the new code:
    function loadDocument(dom, helper)
    {
    return loadNode(dom, dom, document.documentElement, helper);
    }

    Enjoy :)

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.