Bug Tracker


Opened 5 years ago

Closed 5 years ago

Last modified 4 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 5 years ago by dmethvin

  • Component changed from unfiled to attributes
  • Keywords needsdocs added
  • Priority changed from undecided to low
  • Type changed from bug to enhancement

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 5 years ago by dmethvin

  • Resolution set to fixed
  • Status changed from new to closed

Docs updated.

comment:3 Changed 5 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 follow-up: Changed 5 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 5 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 4 years ago by mikesherov

  • Keywords needsdocs removed

Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Modify Ticket

Change Properties

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.