Skip to content

Commit

Permalink
Add htmlFor and className aliases
Browse files Browse the repository at this point in the history
This adds for as an alias for htmlFor to be
more consistent and intuitive. This is now possible
since 'for' is no longer a globally reserved word
in Javascript.
It also updates one example to match the new
'class' alias for 'className' from the DOM spec.

fixes whatwg#9379
  • Loading branch information
Psychpsyo committed Sep 17, 2024
1 parent 9a9eb43 commit 3ef8c74
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -46242,7 +46242,8 @@ interface <dfn interface>HTMLLabelElement</dfn> : <span>HTMLElement</span> {
[<span>HTMLConstructor</span>] constructor();

readonly attribute <span>HTMLFormElement</span>? <span data-x="dom-label-form">form</span>;
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-label-htmlFor">htmlFor</span>;
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-label-for">for</span>;
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-label-htmlFor">htmlFor</span>; // legacy alias of .for
readonly attribute <span>HTMLElement</span>? <span data-x="dom-label-control">control</span>;
};</code></pre>
</dd>
Expand Down Expand Up @@ -46348,8 +46349,9 @@ interface <dfn interface>HTMLLabelElement</dfn> : <span>HTMLElement</span> {

<div w-nodev>

<p>The <dfn attribute for="HTMLLabelElement"><code data-x="dom-label-htmlFor">htmlFor</code></dfn>
IDL attribute must <span>reflect</span> the <code data-x="attr-label-for">for</code> content
<p>The <dfn attribute for="HTMLLabelElement"><code data-x="dom-label-for">for</code></dfn> and
<dfn attribute for="HTMLLabelElement"><code data-x="dom-label-htmlFor">htmlFor</code></dfn>
IDL attributes must <span>reflect</span> the <code data-x="attr-label-for">for</code> content
attribute.</p>

<p>The <dfn attribute for="HTMLLabelElement"><code data-x="dom-label-control">control</code></dfn>
Expand Down Expand Up @@ -54870,7 +54872,8 @@ Daddy">&lt;/textarea></code></pre>
interface <dfn interface>HTMLOutputElement</dfn> : <span>HTMLElement</span> {
[<span>HTMLConstructor</span>] constructor();

[SameObject, PutForwards=<span data-x="dom-DOMTokenList-value">value</span>] readonly attribute <span>DOMTokenList</span> <span data-x="dom-output-htmlFor">htmlFor</span>;
[SameObject, PutForwards=<span data-x="dom-DOMTokenList-value">value</span>] readonly attribute <span>DOMTokenList</span> <span data-x="dom-output-for">for</span>;
[SameObject, PutForwards=<span data-x="dom-DOMTokenList-value">value</span>] readonly attribute <span>DOMTokenList</span> <span data-x="dom-output-htmlFor">htmlFor</span>; // legacy alias of .for
readonly attribute <span>HTMLFormElement</span>? <span data-x="dom-fae-form">form</span>;
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-fe-name">name</span>;

Expand Down Expand Up @@ -54993,7 +54996,8 @@ interface <dfn interface>HTMLOutputElement</dfn> : <span>HTMLElement</span> {
getter steps are to return "<code data-x="">output</code>".</p>

<p>The <dfn attribute for="HTMLOutputElement"><code
data-x="dom-output-htmlFor">htmlFor</code></dfn> IDL attribute must <span>reflect</span> the <code
data-x="dom-output-for">for</code></dfn> and <dfn attribute for="HTMLOutputElement"><code
data-x="dom-output-htmlFor">htmlFor</code></dfn> IDL attributes must <span>reflect</span> the <code
data-x="attr-output-for">for</code> content attribute.</p>

<p>The <code data-x="dom-cva-willValidate">willValidate</code>, <code
Expand Down Expand Up @@ -92001,11 +92005,11 @@ for (const entry of navigation.entries()) {
const li = document.createElement("li");

if (entry.index &lt; navigation.currentEntry.index) {
li.className = "backward";
li.class = "backward";
} else if (entry.index > navigation.currentEntry.index) {
li.className = "forward";
li.class = "forward";
} else {
li.className = "current";
li.class = "current";
}

li.textContent = entry.url;
Expand Down Expand Up @@ -137923,7 +137927,8 @@ interface <dfn interface>HTMLParamElement</dfn> : <span>HTMLElement</span> {
<pre><code class="idl">partial interface <span id="HTMLScriptElement-partial">HTMLScriptElement</span> {
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-script-charset">charset</span>;
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-script-event">event</span>;
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-script-htmlFor">htmlFor</span>;
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-script-for">for</span>;
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-script-htmlFor">htmlFor</span>; // legacy alias of .for
};</code></pre>

<p>The <dfn attribute for="HTMLScriptElement"><code
Expand All @@ -137932,7 +137937,8 @@ interface <dfn interface>HTMLParamElement</dfn> : <span>HTMLElement</span> {
must <span>reflect</span> the respective content attributes of the same name.</p>

<p>The <dfn attribute for="HTMLScriptElement"><code
data-x="dom-script-htmlFor">htmlFor</code></dfn> IDL attribute of the <code>script</code> element
data-x="dom-script-for">for</code></dfn> and <dfn attribute for="HTMLScriptElement"><code
data-x="dom-script-htmlFor">htmlFor</code></dfn> IDL attributes of the <code>script</code> element
must <span>reflect</span> the element's <code data-x="attr-script-for">for</code> content
attribute.</p>

Expand Down Expand Up @@ -144905,6 +144911,7 @@ INSERT INTERFACES HERE
Prateek Rungta,
Pravir Gupta,
Prayag Verma,
Psychpsyo,
&#x674e;&#x666e;&#x541b; (Pujun Li)<!-- masa jack -->,
Rachid Finge,
Rafael Weinstein,
Expand Down

0 comments on commit 3ef8c74

Please sign in to comment.