78
spellcheckp727
content attribute is in thedefaultstate and the element'sdefault behaviourp727
isinherit-by-defaultp727
and the element's parent
element'sspellcheckp727
IDL attribute would return true; otherwise, if none of those conditions applies, then the attribute must instead return
false.
On setting, if the new value is true, then the element'sspellcheckp727
content attribute must be set to the literal string "true", otherwise it must
be set to the literal string "false".
User agents must only consider the following pieces of text as checkable for the purposes of this feature:
• Thevaluep508
ofinputp434
elements whosetypep436
attributes are in theTextp440
,Searchp440
,URLp441
, orE-mailp443
states and that are
mutablep508
(i.e. that do not have thereadonlyp464
attribute specified and that are notdisabledp511
).
• Thevaluep508
oftextareap489
elements that do not have areadonlyp490
attribute and that are notdisabledp511
.
• Text inText
nodes that are children ofediting hostsp727
oreditablep727
elements.
• Text in attributes ofeditablep727
elements.
For text that is part of aText
node, the element with which the text is associated is the element that is the immediate parent of the first character of
the word, sentence, or other piece of text. For text in attributes, it is the attribute's element. For the values ofinputp434
andtextareap489
elements, it is the element itself.
To determine if a word, sentence, or other piece of text in an applicable element (as defined above) is to have spelling- and grammar-checking
enabled, the UA must use the following algorithm:
1. If the user has disabled the checking for this text, then the checking is disabled.
2. Otherwise, if the user has forced the checking for this text to always be enabled, then the checking is enabled.
3. Otherwise, if the element with which the text is associated has aspellcheckp727
content attribute, then: if that attribute is in thetrue
state, then checking is enabled; otherwise, if that attribute is in thefalsestate, then checking is disabled.
4. Otherwise, if there is an ancestor element with aspellcheckp727
content attribute that is not in thedefaultstate, then: if the nearest
such ancestor'sspellcheckp727
content attribute is in thetruestate, then checking is enabled; otherwise, checking is disabled.
5. Otherwise, if the element'sdefault behaviourp727
istrue-by-defaultp727
, then checking is enabled.
6. Otherwise, if the element'sdefault behaviourp727
isfalse-by-defaultp727
, then checking is disabled.
7. Otherwise, if the element's parent element hasitschecking enabled, then checking is enabled.
8. Otherwise, checking is disabled.
If the checking is enabled for a word/sentence/text, the user agent should indicate spelling and grammar errors in that text. User agents should take
into account the other semantics given in the document when suggesting spelling and grammar corrections. User agents may use the language of
the element to determine what spelling and grammar rules to use, or may use the user's preferred language settings. UAs should useinputp434
element attributes such aspatternp466
to ensure that the resulting value is valid, where possible.
If checking is disabled, the user agent should not indicate spelling or grammar errors for that text.
Even when checking is enabled, user agents may opt to not report spelling or grammar errors in text that the user agent deems the user has no
interest in having checked (e.g. text that was already present when the page was loaded, or that the user did not type, or text in controls that the
user has not focused, or in parts of e-mail addresses that the user agent is not confident were misspelt). TheforceSpellCheck()method, when
invoked on an element, must override this behaviour, forcing the user agent to consider all spelling and grammar errors in text in that element for
which checking is enabled to be of interest to the user.
Thespellcheckp727
IDL attribute is not affected by user preferences that override thespellcheckp727
content attribute, and therefore
might not reflect the actual spellchecking state.
Note
The element with ID "a" in the following example would be the one used to determine if the word "Hello" is checked for spelling errors. In
this example, it would not be.
Example
728