Skip to main content

Bug Tracker

Side navigation

#3816 closed bug (fixed)

Opened January 09, 2009 01:57PM UTC

Closed January 18, 2009 12:56AM UTC

Last modified March 14, 2012 11:14PM UTC

Sizzle.filter and xml

Reported by: XASD Owned by:
Priority: major Milestone: 1.3.1
Component: selector Version: 1.3
Keywords: Sizzle,xml Cc:
Blocked by: Blocking:
Description

From:

http://blog.jquery.com/2008/12/22/help-test-jquery-13-beta-1/#comment-330555

On Sizzle.filter,line:

for ( var i = 0; (item = curLoop[i]) !== undefined; i++ ) {

}

you use strict “!==”,so you’ll get “true” if curLoop[i] is “null”.But for xml node lists access to not existent element in list result “null” not “undefined”,like in html dom.

Maybe you want to gain another millisecond,but in this case just do “!=”,it’s enough and correct IMHO.

Beta 2 of 1.3 still have that bug.

Thanks.

Attachments (0)
Change History (2)

Changed January 11, 2009 01:43PM UTC by XASD comment:1

That only true for IE:

function test()

var doc= window.ActiveXObject

? new ActiveXObject("msxml2.domdocument")

: document.implementation.createDocument("", "", null)

return doc.childNodes[0]!==undefined;

}

In IE it will be "true" but in Chrome(for example) it will be "false".

Changed January 18, 2009 12:56AM UTC by john comment:2

component: coreselector
milestone: 1.31.3.1
resolution: → fixed
status: newclosed
version: 1.2.61.3

Landed a fix for this:

http://github.com/jeresig/sizzle/commit/76fbebec12e998f2ce42c83084c3c9c406942986

Not sure why I was being so strict to begin with (was doing != null everywhere else).