Skip to content

Commit 81e8243

Browse files
authored
Add HTMLOrSVGElement interface mixin
This exposes dataset, tabIndex, focus(), and blur() on SVG elements. It also does away with NoncedElement. Tests: web-platform-tests/wpt#10110 and web-platform-tests/wpt#10149 (dataset tests for SVG already exist). Fixes #3471 and fixes w3c/svgwg#60.
1 parent 233d984 commit 81e8243

File tree

1 file changed

+29
-23
lines changed

1 file changed

+29
-23
lines changed

source

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4056,6 +4056,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
40564056
<p>The following features are defined in the SVG specifications:</p>
40574057

40584058
<ul class="brief">
4059+
<li><dfn data-x-href="https://www.w3.org/TR/SVG11/types.html#InterfaceSVGElement"><code>SVGElement</code></dfn> interface</li>
40594060
<li><dfn data-x-href="https://www.w3.org/TR/SVG11/struct.html#InterfaceSVGImageElement"><code>SVGImageElement</code></dfn> interface</li>
40604061
<li><dfn data-x-href="https://www.w3.org/TR/SVG11/script.html#InterfaceSVGScriptElement"><code>SVGScriptElement</code></dfn> interface</li>
40614062
<li><dfn data-x-href="https://www.w3.org/TR/SVG11/struct.html#InterfaceSVGSVGElement"><code>SVGSVGElement</code></dfn> interface</li>
@@ -7065,18 +7066,11 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
70657066
<p>Elements that have a <code data-x="attr-nonce">nonce</code> content attribute ensure that the
70667067
crytographic nonce is only exposed to script (and not to side-channels like CSS attribute
70677068
selectors) by extracting the value from the content attribute, moving it into an internal slot
7068-
named <dfn data-export="" data-dfn-for="NoncedElement"
7069+
named <dfn data-export="" data-dfn-for="HTMLOrSVGElement"
70697070
data-dfn-type="attribute">[[CryptographicNonce]]</dfn>, and exposing it to script via the
7070-
<code>NoncedElement</code> interface defined below. Unless otherwise specified, the slot's value
7071+
<code>HTMLOrSVGElement</code> interface mixin. Unless otherwise specified, the slot's value
70717072
is the empty string.</p>
70727073

7073-
<pre class="idl">interface mixin <dfn>NoncedElement</dfn> {
7074-
attribute DOMString nonce;
7075-
};</pre>
7076-
7077-
<!-- The `NoncedElement` mixin exists separate from `HTMLElement` in order to easily share the
7078-
functionality described here between both `HTMLElement` and `SVGElement`. -->
7079-
70807074
<dl class="domintro">
70817075
<dt><var>element</var> . <code data-x="">nonce</code></dt>
70827076
<dd>
@@ -7085,15 +7079,17 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
70857079
</dd>
70867080
</dl>
70877081

7088-
<p>The <dfn><code data-x="dom-NoncedElement-nonce">nonce</code></dfn> IDL attribute must, on
7089-
getting, return the value of this element's <span>[[CryptographicNonce]]</span>; and on setting,
7090-
set this element's <span>[[CryptographicNonce]]</span> to the given value.</p>
7082+
<p>The <dfn id="dom-noncedelement-nonce"><code
7083+
data-x="dom-HTMLOrSVGElement-nonce">nonce</code></dfn> IDL attribute must, on getting, return the
7084+
value of this element's <span>[[CryptographicNonce]]</span>; and on setting, set this element's
7085+
<span>[[CryptographicNonce]]</span> to the given value.</p>
70917086

7092-
<p>Whenever a <code>NoncedElement</code>'s <code data-x="attr-nonce">nonce</code> attribute is
7093-
set or changed, set this element's <span>[[CryptographicNonce]]</span> to the given value.</p>
7087+
<p>Whenever an element including <code>HTMLOrSVGElement</code> has its <code
7088+
data-x="attr-nonce">nonce</code> attribute is set or changed, set this element's
7089+
<span>[[CryptographicNonce]]</span> to the given value.</p>
70947090

7095-
<p>Whenever a <code>NoncedElement</code> <span>becomes browsing-context connected</span>, the
7096-
user agent must executing the following steps on the <var>element</var>:</p>
7091+
<p>Whenever an element including <code>HTMLOrSVGElement</code> <span>becomes browsing-context
7092+
connected</span>, the user agent must execute the following steps on the <var>element</var>:</p>
70977093

70987094
<ol>
70997095
<li><p>Let <var>CSP list</var> be <var>element</var>'s <span data-x="shadow-including
@@ -7119,8 +7115,8 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
71197115
set during <span data-x="initialize the Document object"><code data-x="">Document</code>
71207116
initialization</span>.</p>
71217117

7122-
<p>The <span data-x="concept-node-clone-ext">cloning steps</span> for elements that implement
7123-
<code>NoncedElement</code> must set the <span>[[CryptographicNonce]]</span> slot on the copy
7118+
<p>The <span data-x="concept-node-clone-ext">cloning steps</span> for elements that include
7119+
<code>HTMLOrSVGElement</code> must set the <span>[[CryptographicNonce]]</span> slot on the copy
71247120
to the value of the slot on the element being cloned.</p>
71257121

71267122

@@ -10131,14 +10127,10 @@ interface <dfn>HTMLElement</dfn> : <span>Element</span> {
1013110127
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-lang">lang</span>;
1013210128
[<span>CEReactions</span>] attribute boolean <span data-x="dom-translate">translate</span>;
1013310129
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-dir">dir</span>;
10134-
[SameObject] readonly attribute <span>DOMStringMap</span> <span data-x="dom-dataset">dataset</span>;
1013510130

1013610131
// <span>user interaction</span>
1013710132
[<span>CEReactions</span>] attribute boolean <span data-x="dom-hidden">hidden</span>;
1013810133
void <span data-x="dom-click">click</span>();
10139-
[<span>CEReactions</span>] attribute long <span data-x="dom-tabindex">tabIndex</span>;
10140-
void <span data-x="dom-focus">focus</span>(optional <span>FocusOptions</span> options);
10141-
void <span data-x="dom-blur">blur</span>();
1014210134
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-accessKey">accessKey</span>;
1014310135
readonly attribute DOMString <span data-x="dom-accessKeyLabel">accessKeyLabel</span>;
1014410136
[<span>CEReactions</span>] attribute boolean <span data-x="dom-draggable">draggable</span>;
@@ -10151,7 +10143,6 @@ interface <dfn>HTMLElement</dfn> : <span>Element</span> {
1015110143
<span>HTMLElement</span> includes <span>GlobalEventHandlers</span>;
1015210144
<span>HTMLElement</span> includes <span>DocumentAndElementEventHandlers</span>;
1015310145
<span>HTMLElement</span> includes <span>ElementContentEditable</span>;
10154-
<span>HTMLElement</span> includes <span>NoncedElement</span>;
1015510146

1015610147
// Note: <a href="#customized-built-in-element-restrictions">intentionally</a> not [<span>HTMLConstructor</span>]
1015710148
[Exposed=Window]
@@ -10201,6 +10192,21 @@ interface <dfn>HTMLUnknownElement</dfn> : <span>HTMLElement</span> { };</pre>
1020110192

1020210193
</div>
1020310194

10195+
<p>Features shared between HTML and SVG elements use the <code>HTMLOrSVGElement</code> interface
10196+
mixin: <ref spec=SVG></p>
10197+
10198+
<pre class="idl">interface mixin <dfn>HTMLOrSVGElement</dfn> {
10199+
[SameObject] readonly attribute <span>DOMStringMap</span> <span data-x="dom-dataset">dataset</span>;
10200+
attribute DOMString <span data-x="dom-HTMLOrSVGElement-nonce">nonce</span>;
10201+
10202+
[<span>CEReactions</span>] attribute long <span data-x="dom-tabindex">tabIndex</span>;
10203+
void <span data-x="dom-focus">focus</span>(optional <span>FocusOptions</span> options);
10204+
void <span data-x="dom-blur">blur</span>();
10205+
};
10206+
<span>HTMLElement</span> includes <span>HTMLOrSVGElement</span>;
10207+
<span>SVGElement</span> includes <span>HTMLOrSVGElement</span>;
10208+
</pre>
10209+
1020410210
<div w-nodev>
1020510211

1020610212
<h4 id="html-element-constructors">HTML element constructors</h4>

0 commit comments

Comments
 (0)