Skip to main content

Bug Tracker

Side navigation

#221 closed bug (fixed)

Opened September 27, 2006 07:37PM UTC

Closed October 06, 2006 02:37PM UTC

Last modified June 20, 2007 01:56AM UTC

filter seemingly not operating correctly

Reported by: yardley@gmail.com Owned by:
Priority: major Milestone: 1.0
Component: core Version: 1.0
Keywords: filter Cc:
Blocked by: Blocking:
Description

based on http://jquery.com/docs/Base/Expression/CSS/

and for test purposes, operating on http://jquery.com/

the following happens with filter (works on class and not on other attributes like id):

>>> $('div')
[<div class="head">,<div class="wrap">,<div class="wrap2">,<div id="side">,<div id="body">,<div class="wiki" id="content">,<div class="wikipage">,<div id="searchable">,<div style="text-align: center;">,<div id="footer">,<div class="wrap2">,<div class="col">,<div class="col">,<div class="col">,<div class="col">]
>>> $('div').filter('[@id="side"]')
[<div id="side">]
>>> $('div').filter('[@id^="side"]')
z has no properties
jquery-latest.js (line 710)
>>> $('div').filter('[@class="wrap"]')
[<div class="wrap">]
>>> $('div').filter('[@class^="wrap"]')
[<div class="wrap">,<div class="wrap2">,<div class="wrap2">]

the offending code:

 // Build a custom macro to enclose it
 eval("f = function(a,i){" +
  ( m[1] == "@" ? "z=jQuery.attr(a,m[3]);" : "" ) +
    "return " + f + "}");
Attachments (0)
Change History (2)

Changed September 27, 2006 09:44PM UTC by anonymous comment:1

To explain more simply,

 $('[@id="foo"]).each(...)

works but

 $('[@id^="foo"]).each(...)

doesn't. The latter gives an "Error: z has no properties"

Changed October 06, 2006 02:37PM UTC by joern comment:2

resolution: → fixed
status: newclosed

Fixed in SVN.