Ticket #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: | |
| Blocking: | Blocked by: |
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.
Change History
comment:2 Changed 4 years ago by john
- Status changed from new to closed
- Resolution set to fixed
- Version changed from 1.2.6 to 1.3
- Component changed from core to selector
- Milestone changed from 1.3 to 1.3.1
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).
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

That only true for IE: function test() var doc= window.ActiveXObject
} In IE it will be "true" but in Chrome(for example) it will be "false".