Bug Tracker

Opened 14 years ago

Closed 14 years ago

Last modified 11 years ago

#3816 closed bug (fixed)

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:


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.


Change History (2)

comment:1 Changed 14 years ago by XASD

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".

comment:2 Changed 14 years ago by john

Component: coreselector
Resolution: fixed
Status: newclosed

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).

Note: See TracTickets for help on using tickets.