Skip to main content

Bug Tracker

Side navigation

#11300 closed enhancement (fixed)

Opened February 07, 2012 05:03PM UTC

Closed February 07, 2012 08:50PM UTC

Last modified October 15, 2012 10:09PM UTC

Docs Bug: The :contains() selector statement about quotes is confusing...

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

The docs for the :contains() selector states...

>''"As with attribute value selectors, text inside the parentheses of :contains() can be written as bare words or surrounded by quotation marks."''

...but docs for attribute selectors state...

>''"Quotes are mandatory."''

Attachments (0)
Change History (6)

Changed February 07, 2012 05:09PM UTC by dmethvin comment:1

component: unfiledattributes
keywords: → needsdocs
priority: undecidedlow
type: bugenhancement

Yeah, neither is quite accurate. Quotes are only mandatory for attribute values if they are not identifiers, so [type=text] is fine. I am not sure of the specifics of :contains() but it seems we should encourage the same rule regardless of how it's currently implemented.

Changed February 07, 2012 08:50PM UTC by dmethvin comment:2

resolution: → fixed
status: newclosed

Docs updated.

Changed February 08, 2012 05:56PM UTC by anonymous comment:3

Replying to [comment:2 dmethvin]:

Docs updated.

I see you updated the docs for the ''attribute-equals-selector'', but the other various attribute selectors still state...

''"Quotes are mandatory."''

Is this intentional? If so, could you please explain the reason for the different requirements.

If it helps, the following is a list of attribute selectors that have not been updated...

  • h ttp://api.jquery.com/attribute-contains-prefix-selector/
  • h ttp://api.jquery.com/attribute-contains-selector/
  • h ttp://api.jquery.com/attribute-contains-word-selector/
  • h ttp://api.jquery.com/attribute-ends-with-selector/
  • h ttp://api.jquery.com/attribute-not-equal-selector/
  • h ttp://api.jquery.com/attribute-starts-with-selector/

''(Sorry for the broken links, but it's getting spam-blocked.)''

FWIW, I tested each one using querySelectorAll in Chrome 17, and the only one that throws is the ''not equal selector'', but that seems to be because it's a non-standard selector. Quotes made no difference either way.

http://jsfiddle.net/MR39H/

Changed February 08, 2012 06:15PM UTC by dmethvin comment:4

Yep, should have fixed those too. I'll get to it this afternoon.

Trac is more friendly if you create an account, otherwise it's pretty aggressive about potential spam. We get a *lot* of spam.

Changed February 10, 2012 08:17PM UTC by anonymous comment:5

Replying to [comment:4 dmethvin]:

Yep, should have fixed those too. I'll get to it this afternoon.

My apologies for not catching this before, but there's one more page that would need updating.

It's the Category page for Selectors > Attribute

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

The current wording is...

''"Attribute values in selector expressions must be surrounded by quotation marks."''

Changed October 15, 2012 10:09PM UTC by mikesherov comment:6

keywords: needsdocs