From a1fee71e295dc311f985abb807d587808ebc39f2 Mon Sep 17 00:00:00 2001 From: Karl Swedberg Date: Tue, 16 Oct 2012 11:37:20 -0400 Subject: [PATCH] Add clarifications to :disabled and :enabled selectors --- entries/disabled-selector.xml | 9 +++++++-- entries/enabled-selector.xml | 11 ++++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/entries/disabled-selector.xml b/entries/disabled-selector.xml index de70f26e..8e601b34 100644 --- a/entries/disabled-selector.xml +++ b/entries/disabled-selector.xml @@ -7,7 +7,12 @@ Selects all elements that are disabled. -

As with other pseudo-class selectors (those that begin with a ":") it is recommended to precede it with a tag name or some other selector; otherwise, the universal selector ("*") is implied. In other words, the bare $(':disabled') is equivalent to $('*:disabled'), so $('input:disabled') should be used instead.

+

As with other pseudo-class selectors (those that begin with a ":"), it is recommended to precede it with a tag name or some other selector; otherwise, the universal selector ("*") is implied. In other words, the bare $(':disabled') is equivalent to $('*:disabled'), so $('input:disabled') or similar should be used instead.

+ +

Although their resulting selections are usually the same, the :disabled selector is subtly different from the [disabled] attribute selector; :disabled checks the boolean (true/false) value of the element's disabled property while [disabled] checks for the existence of the disabled attribute.

+ +

The :disabled selector should only be used for selecting HTML elements that support the disabled attribute (<button>, <input>, <optgroup>, <option>, <select>, and <textarea>).

+
Finds all input elements that are disabled. @@ -20,4 +25,4 @@ - \ No newline at end of file + diff --git a/entries/enabled-selector.xml b/entries/enabled-selector.xml index 0cb80429..7b40f5d6 100644 --- a/entries/enabled-selector.xml +++ b/entries/enabled-selector.xml @@ -7,10 +7,15 @@ Selects all elements that are enabled. -

As with other pseudo-class selectors (those that begin with a ":") it is recommended to precede it with a tag name or some other selector; otherwise, the universal selector ("*") is implied. In other words, the bare $(':enabled') is equivalent to $('*:enabled'), so $('input:enabled') should be used instead.

+

As with other pseudo-class selectors (those that begin with a ":") it is recommended to precede it with a tag name or some other selector; otherwise, the universal selector ("*") is implied. In other words, the bare $(':enabled') is equivalent to $('*:enabled'), so $('input:enabled') or similar should be used instead.

+ +

Although their resulting selections are usually the same, :enabled selector is subtly different from :not([disabled]); :enabled selects elements that have their boolean disabled property strictly equal to false, while :not([disabled]) selects elements that do not have a disabled attribute set (regardless of its value).

+ +

The :enabled selector should only be used for selecting HTML elements that support the disabled attribute (<button>, <input>, <optgroup>, <option>, <select>, and <textarea>).

+
- Finds all input elements that are enabled. + Find all input elements that are enabled. @@ -20,4 +25,4 @@ - \ No newline at end of file +