Skip to main content

Bug Tracker

Side navigation

#11444 closed bug (invalid)

Opened March 06, 2012 09:58AM UTC

Closed March 06, 2012 01:34PM UTC

Issue with .live() and .filter()

Reported by: winterwind Owned by: winterwind
Priority: low Milestone: None
Component: event Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:
Description

Using the following code snippet I was triggering the error "

Syntax error, unrecognized expression: false;

});

" - this error was happening as I changed a select that was returning true to the .filter().

(function($) {

$(document).ready(function() {

$('select').filter(function() {

if($(this).attr('name').match(/^option\\[\\d+\\]\\[TYPE\\]$/)) {

return true;

}

return false;

}).live('change', function() {

alert('here');

});

});

})(jQuery);

The same bit of code works find with .bind() however.

jQuery versions tested: 1.7.1, 1.7.0, 1.6.1, 1.5.1 - all cause the issue, all work fine with .bind() instead.

Attachments (0)
Change History (3)

Changed March 06, 2012 10:00AM UTC by winterwind comment:1

Using the following code snippet I was triggering the error "

Syntax error, unrecognized expression: false;

});

" - this error was happening as I changed a select that was returning true to the .filter().

(function($) {
    $(document).ready(function() {
        $('select').filter(function() {
            if($(this).attr('name').match(/^option\\[\\d+\\]\\[TYPE\\]$/)) {
                return true;
            }
            return false;
        }).live('change', function() {
            alert('here');
        });
    });
})(jQuery);

The same bit of code works find with .bind() however.

jQuery versions tested: 1.7.1, 1.7.0, 1.6.1, 1.5.1 - all cause the issue, all work fine with .bind() instead.

Changed March 06, 2012 12:48PM UTC by addyosmani comment:2

_comment0: Thanks for submitting a ticket to the jQuery bug tracker. Could you please comment back with a complete test case on jsFiddle.net reproducing the issue experienced?.1331038217600028
component: unfiledevent
owner: → winterwind
priority: undecidedlow
status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket!

Additionally, be sure to test against the "jQuery (edge)" version to ensure the issue still exists. To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to begin.

Changed March 06, 2012 01:34PM UTC by dmethvin comment:3

_comment0: As documented, `.live` cannot be changed. And it is deprecated.1331043525066679
resolution: → invalid
status: pendingclosed

As documented, .live cannot be chained. And it is deprecated.