This project is archived and is in readonly mode.

#763 ✓resolved
Tristan

CSS Selectors and boolean attributes

Reported by Tristan | October 8th, 2009 @ 07:34 AM | in 1.3.0 rc2 (closed)

When trying to select with boolean attributes, you can't do this:

$$('input[disabled=disabled]');
$$('select[multiple=multiple]');

This however does work:

$$('input[disabled]');
$$('select[multiple]');

If this is intended, it would be good to mention it in the docs.

Comments and changes to this ticket

  • Sebastian Markbåge

    Sebastian Markbåge October 8th, 2009 @ 09:17 AM

    • State changed from “new” to “open”
    • Assigned user set to “Thomas Aylott”

    Best practice would be to use input[disabled] because any given value is considered "true". input[disabled=disabled] should only be true if the value is exactly "disabled". We may consider supporting it for CSS compatibility.

    But we should also have support for the new :enabled and :disabled pseudo selectors. As well as the :checked pseudo selector.

  • Tristan

    Tristan October 8th, 2009 @ 10:13 AM

    • Assigned user cleared.

    I'm totally fine with going for input[disabled], but it took me some time to figure out input[disabled=disabled] did not work for me. So for other users it'd be good to either support [disabled=disabled] or mentioning this in the docs.

  • Scott Kyle

    Scott Kyle October 8th, 2009 @ 06:47 PM

    Sebastian, we already have support for :enabled, :disabled, and :checked.

  • Jan Kassens

    Jan Kassens November 21st, 2009 @ 03:44 PM

    • Tag changed from attributes, boolean, css, selectors to slick
    • Assigned user set to “Thomas Aylott”

    Are there exhaustive specs for that now?

  • Fábio M. Costa

    Fábio M. Costa April 4th, 2010 @ 11:37 PM

    • Milestone changed from 2.0 to 1.3.0 rc2
    • State changed from “open” to “resolved”

    there are specs for this, and its working fine. But yeah you should try to use the corresponding pseudo-selector (:enabled, :disabled, :checked).

  • IRCF

    IRCF October 19th, 2011 @ 03:17 PM

    • Milestone order changed from “0” to “0”

    Hello,

    I'm not sure whether it's the right place to report it, but I noticed a strange behaviour about Mootools selectors (tested on 1.2.5 and 1.4.1) :

    When having the following HTML code :

    <div>Hello</div>
    <div data-custom="custom value">Good bye</div>
    

    The selector below returns both DIVs :

    $$('div[data-custom]')
    

    ... while it should only return the one carrying the "data-custom" attribute, according to the CSS 3.0 attribute selectors specs

    For the same reason, I think $$('input[disabled]'); in your example above should only return input elements carrying the disabled attribute, whatever its value.

    Or am I missing something ?

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

Tags

Pages