Skip to main content

Bug Tracker

Side navigation

#6881 closed bug (invalid)

Opened August 06, 2010 02:42PM UTC

Closed August 07, 2010 03:16AM UTC

Last modified November 04, 2010 01:16AM UTC

Some valid selectors throw a syntax error when passed to jQuery.fn.is()

Reported by: elijahr Owned by:
Priority: Milestone: 1.4.3
Component: traversing Version: 1.4.2
Keywords: focus , is, Cc:
Blocked by: Blocking:
Description

var input;

input = $('input').eq(0);

try {

input.is(':focus');

} catch(e) {

/*

"Syntax error, unrecognized expression: Syntax error, unrecognized expression: focus"

*/

}

try {

input.is(':hover');

} catch(e) {

/*

"Syntax error, unrecognized expression: Syntax error, unrecognized expression: hover"

*/

}

Attachments (0)
Change History (2)

Changed August 07, 2010 03:16AM UTC by dmethvin comment:1

description: \ var input; \ input = $('input').eq(0); \ try { \ input.is(':focus'); \ } catch(e) { \ /* \ "Syntax error, unrecognized expression: Syntax error, unrecognized expression: focus" \ */ \ } \ \ try { \ input.is(':hover'); \ } catch(e) { \ /* \ "Syntax error, unrecognized expression: Syntax error, unrecognized expression: hover" \ */ \ }var input; \ input = $('input').eq(0); \ try { \ input.is(':focus'); \ } catch(e) { \ /* \ "Syntax error, unrecognized expression: Syntax error, unrecognized expression: focus" \ */ \ } \ \ try { \ input.is(':hover'); \ } catch(e) { \ /* \ "Syntax error, unrecognized expression: Syntax error, unrecognized expression: hover" \ */ \ }
resolution: → invalid
status: newclosed

Neither

:focus
nor
:hover
are supported selectors in jQuery. The complete list of supported selectors is here:

http://api.jquery.com/category/selectors/

Changed November 04, 2010 01:16AM UTC by anonymous comment:2

It's working using jQuery('foo:hover'), so I wonder whether it's supported or not.