Skip to main content

Bug Tracker

Side navigation

#110 closed bug (fixed)

Opened July 28, 2006 04:33PM UTC

Closed August 15, 2006 04:40AM UTC

Last modified June 20, 2007 01:19AM UTC

Multiple Attribute Selectors Broken

Reported by: john Owned by:
Priority: major Milestone: 1.0
Component: core Version: 1.0
Keywords: Cc:
Blocked by: Blocking:

I was having trouble with the form plugin and while debugging I

discovered that quotes are necessary when selecting by attribute

values * if * the selection contains more than one item.

The following test page shows this more clearly:



<html xmlns="" xml:lang="en" lang="en">


<script type="text/javascript" src="jquery-v164.js"></script>

<script type="text/javascript">

$(document).ready(function() {

alert("with quotes: "


alert("w/o quotes: "






<input type="text" name="t" />

<input type="hidden" name="h" />



The first alert shows 2, the second alert shows 0. However the

following lines will both correctly alert 1:

alert("with quotes: " +$("input[@type='hidden']").size());

alert("w/o quotes: " +$("input[@type=hidden]").size());

So there is either a bug in the selection logic (if quotes are not

meant to be required) or in the form plugin which does this:

$("input[@type=submit],input[@type=image]", this)

This W3C page says "Attribute values must be identifiers or strings" so it

seems the quotes should be optional for simple names.

It looks like the problem is here in .filter():

// Look for something (optionally) enclosed with quotes

.replace( 'Q', " *'?"?([^'"]*)'?"? *" ), "i" );

I think the [^'"]* part of the regexp is eating up too much of the selector


Attachments (0)
Change History (1)

Changed August 15, 2006 04:40AM UTC by john comment:1

resolution: → fixed
status: newclosed

Resolved in SVN rev 206.