Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -87520,6 +87520,93 @@ body { display:none }
checkers. A user agent could offer on-demand checking, could perform continuous checking while the
checking is enabled, or could use other interfaces.</p>

<h4>Custom spelling dictionary</h4>

<p>Each <code>Document</code> has a <dfn data-x="concept-custom-spelling-exemptions">custom
spelling exemption list</dfn>, which is an <span data-x="set">ordered set</span> of strings, initially empty.</p>

<p>If the checking is enabled for a word and that word is a match for any entry in the element's <span>node document</span>'s <span
data-x="concept-custom-spelling-exemptions">custom spelling exemption list</span>, the user agent
should not indicate a spelling error for that word.</p>


<p class="note">The custom spelling exemption list is not persisted, is not shared across
documents, frames, or browsing contexts, and is discarded when the <code>Document</code> is
destroyed.</p>

<p class="note">Entries are matched against individual words as identified by the user agent's
spell checking algorithm. Entries containing whitespace or other word separators will generally
not match any word and will have no effect.</p>

<p class="note">Entries are matched exactly. Authors might need to add multiple forms of a word —
for example, both "anaerobe" and "anaerobes" — to exempt all variants from spell checking.</p>

<dl class="domintro">
<dt><code data-x=""><var>window</var>.<span subdfn data-x="dom-window-spellCheckDictionary">spellCheckDictionary</span>.addWords(<var>words</var>)</code></dt>
<dd>
<p>Adds each string in <var>words</var> to the <span
data-x="concept-custom-spelling-exemptions">custom spelling exemption list</span> of this
window's associated document. Words already present are ignored.</p>
</dd>

<dt><code data-x=""><var>window</var>.<span data-x="dom-window-spellCheckDictionary">spellCheckDictionary</span>.removeWords(<var>words</var>)</code></dt>
<dd>
<p>Removes each string in <var>words</var> from the <span
data-x="concept-custom-spelling-exemptions">custom spelling exemption list</span> of this
window's associated document. Words not present are ignored.</p>
</dd>
</dl>

<div w-nodev>

<p>User agents that do not support spell checking must not expose the <code
data-x="dom-window-spellCheckDictionary">spellCheckDictionary</code> attribute on the
<code>Window</code> object.</p>

<p>The <dfn attribute for="Window"><code
data-x="dom-window-spellCheckDictionary">spellCheckDictionary</code></dfn> attribute must return
the <code>SpellCheckCustomDictionary</code> object associated with <span>this</span>'s <span>relevant
global object</span>'s <span data-x="concept-document-window">associated
<code>Document</code></span>, creating one if it does not yet exist.</p>

<p>The following interface is defined for the custom spelling dictionary:</p>

<pre class="idl">[Exposed=<span>Window</span>, SecureContext]
interface <dfn>SpellCheckCustomDictionary</dfn> {
undefined <span data-x="dom-SpellCheckCustomDictionary-addWords">addWords</span>(sequence&lt;DOMString> words);
undefined <span data-x="dom-SpellCheckCustomDictionary-removeWords">removeWords</span>(sequence&lt;DOMString> words);
};</pre>

<div algorithm>
<p>The <dfn method for="SpellCheckCustomDictionary"><code
data-x="dom-SpellCheckCustomDictionary-addWords">addWords(<var>words</var>)</code></dfn> method
steps are:</p>
<ol>
<li><p>Let <var>document</var> be <span>this</span>'s <span>relevant global object</span>'s
<span data-x="concept-document-window">associated <code>Document</code></span>.</p></li>
<li><p>For each <var>word</var> in <var>words</var>: <span data-x="set append">append</span>
<var>word</var> to <var>document</var>'s <span
data-x="concept-custom-spelling-exemptions">custom spelling exemption list</span>, if
<var>word</var> is not already in the list.</p></li>
</ol>
</div>

<div algorithm>
<p>The <dfn method for="SpellCheckCustomDictionary"><code
data-x="dom-SpellCheckCustomDictionary-removeWords">removeWords(<var>words</var>)</code></dfn>
method steps are:</p>
<ol>
<li><p>Let <var>document</var> be <span>this</span>'s <span>relevant global object</span>'s
<span data-x="concept-document-window">associated <code>Document</code></span>.</p></li>
<li><p>For each <var>word</var> in <var>words</var>: <span data-x="list remove">remove</span>
<var>word</var> from <var>document</var>'s <span
data-x="concept-custom-spelling-exemptions">custom spelling exemption list</span>, if
present.</p></li>
</ol>
</div>

</div>

<h4>Writing suggestions</h4>

<p>User agents offer writing suggestions as users type into editable regions, either in form
Expand Down Expand Up @@ -95996,6 +96083,7 @@ interface <dfn interface>Window</dfn> : <span>EventTarget</span> {
[PutForwards=<span data-x="dom-location-href">href</span>, <span>LegacyUnforgeable</span>] readonly attribute <span>Location</span> <span data-x="dom-location">location</span>;
readonly attribute <span>History</span> <span data-x="dom-history">history</span>;
[Replaceable] readonly attribute <span>Navigation</span> <span data-x="dom-navigation">navigation</span>;
[SecureContext, SameObject] readonly attribute <span>SpellCheckCustomDictionary</span> <span data-x="dom-window-spellCheckDictionary">spellCheckDictionary</span>;
readonly attribute <span>CustomElementRegistry</span> <span data-x="dom-window-customElements">customElements</span>;
[Replaceable] readonly attribute <span>BarProp</span> <span data-x="dom-window-locationbar">locationbar</span>;
[Replaceable] readonly attribute <span>BarProp</span> <span data-x="dom-window-menubar">menubar</span>;
Expand Down
Loading