Bug Tracker

Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#221 closed bug (fixed)

filter seemingly not operating correctly

Reported by: yardley@… 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 + "}");

Change History (2)

comment:1 Changed 13 years ago by anonymous

To explain more simply,

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

works but

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

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

comment:2 Changed 13 years ago by joern

Resolution: fixed
Status: newclosed

Fixed in SVN.

Note: See TracTickets for help on using tickets.