Bug Tracker

Opened 13 years ago

Closed 13 years ago

#6328 closed bug (worksforme)

Attribute selector with escaped character doesn't work when used with a context

Reported by: slaren Owned by:
Priority: undecided Milestone:
Component: selector Version: 1.4.2
Keywords: Cc:
Blocked by: Blocking:


When filtering by attribute no results are returned if a "[" escaped character is used in conjunction with a context. No errors are reported by jQuery either.

This can be reproduced with the following code (tested with Firefox 3.6):

<script src="jquery-1.4.2.min.js" type="text/javascript"></script>
    var ctx = $("#mydiv");
    // outputs "1: test[0]"
    $("select[name^=test]", ctx).each(function() { console.log("1: " + $(this).attr("name")) });
    // no output
    $("select[name^=test\\[]", ctx).each(function() { console.log("2: " + $(this).attr("name")) });
    // outputs "3: test[0]"
    $("select[name^=test\\[]").each(function() { console.log("3: " + $(this).attr("name")) });
    <div id="mydiv">
        <select name="test[0]"></select>

Change History (2)

comment:1 Changed 13 years ago by shoty

When using a selector and specify the context, or directly using .find, the selector indeed doesn't work with escaped
Doesn't work:


The following works:


This one works also (but the context is not used and matches from whole document)


My question is if this is a bug in the current version and will be updated or this is how it should work?

comment:2 Changed 13 years ago by dmethvin

Priority: undecided
Resolution: worksforme
Status: newclosed
Note: See TracTickets for help on using tickets.