Bug Tracker

Changeset 2474

Show
Ignore:
Timestamp:
07/25/07 00:56:50 (1 year ago)
Author:
jeresig
Message:

$("#foo", xml) would always return an empty set, fixed (bug #877). Additionally, a bug in jQuery.isXMLDoc(xmlDoc) was discovered, if the element was, in fact, an XML document.

Location:
trunk/jquery/src
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/jquery/src/jquery/jquery.js

    r2439 r2474  
    13191319    // check if an element is in a XML document 
    13201320    isXMLDoc: function(elem) { 
    1321         return elem.tagName && elem.ownerDocument && !elem.ownerDocument.body; 
     1321        return elem.documentElement && !elem.body || 
     1322            elem.tagName && elem.ownerDocument && !elem.ownerDocument.body; 
    13221323    }, 
    13231324 
  • trunk/jquery/src/selector/selector.js

    r2472 r2474  
    214214 
    215215                    // Try to do a global search by ID, where we can 
    216                     if ( m[1] == "#" && elem && elem.getElementById ) { 
     216                    if ( m[1] == "#" && elem && elem.getElementById && !jQuery.isXMLDoc(elem) ) { 
    217217                        // Optimization for HTML document case 
    218218                        var oid = elem.getElementById(m[2]);