Bug Tracker

Opened 11 years ago

Closed 11 years ago

Last modified 10 years ago

#11300 closed enhancement (fixed)

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:


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."

Change History (6)

comment:1 Changed 11 years ago by dmethvin

Component: unfiledattributes
Keywords: needsdocs added
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.

comment:2 Changed 11 years ago by dmethvin

Resolution: fixed
Status: newclosed

Docs updated.

comment:3 Changed 11 years ago by anonymous

Replying to 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.


comment:4 Changed 11 years ago by dmethvin

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.

comment:5 in reply to:  4 Changed 11 years ago by anonymous

Replying to 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


The current wording is...

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

comment:6 Changed 10 years ago by mikesherov

Keywords: needsdocs removed
Note: See TracTickets for help on using tickets.