-
Notifications
You must be signed in to change notification settings - Fork 301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trusted types attributes #1268
base: main
Are you sure you want to change the base?
Trusted types attributes #1268
Changes from all commits
67c0b7c
8b8555f
952f576
588bd9f
72cf8f9
cb2fdbb
2a00536
316965c
8569042
7027be5
ac21ffe
03dc3fe
ae5ba7a
3b607af
6726a50
93251d0
0fbb13c
e9280a4
daa8d86
f8e9015
7b4a995
0b3bc48
d96fb19
73fa482
fdb686b
b047352
5f234a4
6b2fff6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,9 +53,11 @@ spec:html; type:element | |
<p>This specification depends on the Infra Standard. [[!INFRA]] | ||
|
||
<p>Some of the terms used in this specification are defined in <cite>Encoding</cite>, | ||
<cite>Selectors</cite>, <cite>Web IDL</cite>, <cite>XML</cite>, and <cite>Namespaces in XML</cite>. | ||
<cite>Selectors</cite>, <cite>Trusted Types</cite>, <cite>Web IDL</cite>, <cite>XML</cite>, and | ||
<cite>Namespaces in XML</cite>. | ||
[[!ENCODING]] | ||
[[!SELECTORS4]] | ||
[[!TRUSTED-TYPES]] | ||
[[!WEBIDL]] | ||
[[!XML]] | ||
[[!XML-NAMES]] | ||
|
@@ -6213,8 +6215,8 @@ interface Element : Node { | |
sequence<DOMString> getAttributeNames(); | ||
DOMString? getAttribute(DOMString qualifiedName); | ||
DOMString? getAttributeNS(DOMString? namespace, DOMString localName); | ||
[CEReactions] undefined setAttribute(DOMString qualifiedName, DOMString value); | ||
[CEReactions] undefined setAttributeNS(DOMString? namespace, DOMString qualifiedName, DOMString value); | ||
[CEReactions] undefined setAttribute(DOMString qualifiedName, (TrustedType or DOMString) value); | ||
[CEReactions] undefined setAttributeNS(DOMString? namespace, DOMString qualifiedName, (TrustedType or DOMString) value); | ||
[CEReactions] undefined removeAttribute(DOMString qualifiedName); | ||
[CEReactions] undefined removeAttributeNS(DOMString? namespace, DOMString localName); | ||
[CEReactions] boolean toggleAttribute(DOMString qualifiedName, optional boolean force); | ||
|
@@ -6589,6 +6591,14 @@ steps: | |
<a for=Attr>value</a>. | ||
</ol> | ||
|
||
<p>To <dfn>verify attribute value</dfn> given a {{TrustedType}} or string <var>value</var>, an | ||
<a>attribute</a> <var>attribute</var>, and an <a for=/>Element</a> <var>element</var>: | ||
|
||
<ol> | ||
<li><p>Return the result of calling <a abstract-op>get Trusted Types-compliant attribute value</a> | ||
given <var>attribute</var>, with <var>element</var>, and <var>value</var>. [[!TRUSTED-TYPES]] | ||
</ol> | ||
|
||
<hr> | ||
|
||
<div algorithm> | ||
|
@@ -6641,6 +6651,9 @@ string <var>namespace</var> (default null):</p> | |
<a for=/>attribute</a> <var>attr</var> and an <a for=/>element</a> <var>element</var>: | ||
|
||
<ol> | ||
<li><p>Let <var>verifiedValue</var> be the result of calling <a>verify attribute value</a> | ||
given <var>attr</var>'s <a for=Attr>value</a>, <var>attr</var>, and <var>element</var>. | ||
|
||
<li><p>If <var>attr</var>'s <a for=Attr>element</a> is neither null nor <var>element</var>, | ||
<a>throw</a> an "{{InUseAttributeError!!exception}}" {{DOMException}}. | ||
|
||
|
@@ -6656,29 +6669,57 @@ string <var>namespace</var> (default null):</p> | |
|
||
<li><p>Otherwise, <a lt="append an attribute">append</a> <var>attr</var> to <var>element</var>. | ||
|
||
<li><p>Set <var>attr</var>'s <a for=Attr>value</a> to <var>verifiedValue</var>. | ||
|
||
<li><p>Return <var>oldAttr</var>. | ||
</ol> | ||
</div> | ||
|
||
<div algorithm> | ||
<p>To <dfn export id=concept-element-attributes-set-value>set an attribute value</dfn> given an | ||
<a for=/>element</a> <var>element</var>, a string <var>localName</var>, a string <var>value</var>, | ||
an optional null or string <var>prefix</var> (default null), and an optional null or string | ||
<var>namespace</var> (default null): | ||
<p>To <dfn export id=concept-element-attributes-set-value>set an attribute value</dfn> given an <a | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No wrapping in phrasing-level elements. |
||
for=/>element</a> <var>element</var>, a string <var>localName</var>, a string or {{TrustedType}} | ||
<var>value</var>, an optional null or string <var>prefix</var> (default null), an optional null or | ||
string <var>namespace</var> (default null), and an optional boolean <var>verify</var> (default | ||
false): | ||
|
||
<ol> | ||
<li>Let <var>attribute</var> be the result of | ||
<a lt="get an attribute by namespace and local name">getting an attribute</a> given | ||
<var>namespace</var>, <var>localName</var>, and <var>element</var>. | ||
|
||
<li>If <var>attribute</var> is null, create an <a>attribute</a> whose <a for=Attr>namespace</a> is | ||
<var>namespace</var>, <a for=Attr>namespace prefix</a> is <var>prefix</var>, | ||
<a for=Attr>local name</a> is <var>localName</var>, <a for=Attr>value</a> is <var>value</var>, and | ||
<a for=Node>node document</a> is <var>element</var>'s <a for=Node>node document</a>, then | ||
<a lt="append an attribute">append</a> this <a>attribute</a> to <var>element</var>, and then | ||
return. | ||
<li><p>Let <var>attributeExists</var> be false if <var>attribute</var> is null; otherwise true. | ||
|
||
<li><p>If <var>attributeExists</var> is false, set <var>attribute</var> to an <a>attribute</a> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. then set |
||
whose <a for=Attr>namespace</a> is <var>namespace</var>, <a for=Attr>namespace prefix</a> is | ||
<var>prefix</var>, <a for=Attr>local name</a> is <var>localName</var>, <a for=Attr>value</a> is | ||
<var>value</var>, and <a for=Node>node document</a> is <var>element</var>'s <a for=Node>node | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No wrapping in phrasing |
||
document</a>. | ||
|
||
<li><p>Let <var>verifiedValue</var> be <var>value</var>. | ||
|
||
<li> | ||
<p>If <var>verify</var> is true: | ||
|
||
<ol> | ||
<li><p>Set <var>verifiedValue</var> to the result of calling <a>verify attribute value</a> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "result of verifying an attribute" is nicer. And it should work with Bikeshed. |
||
given <var>value</var>, <var>attribute</var>, and <var>element</var>. | ||
|
||
<li><p>Set <var>attributeExists</var> to true if <var>element</var> | ||
<a lt="has an attribute">has an attribute</a> <var>attribute</var>; otherwise false. | ||
</ol> | ||
</li> | ||
|
||
<li><p>If <var>attributeExists</var> is true, <a lt="change an attribute">change</a> | ||
<var>attribute</var> to <var>verifiedValue</var>. | ||
|
||
<li> | ||
<p>Otherwise: | ||
|
||
<ol> | ||
<li><p>Set <var>attribute</var>'s <a for=Attr>value</a> to <var>verifiedValue</var>. | ||
|
||
<li><p><a lt="change an attribute">Change</a> <var>attribute</var> to <var>value</var>. | ||
<li><p><a lt="append an attribute">Append</a> this <a>attribute</a> to <var>element</var>. | ||
</ol> | ||
</ol> | ||
</div> | ||
|
||
|
@@ -6939,12 +6980,29 @@ method steps are: | |
and null otherwise. | ||
<!-- This is step 2 of "get an attribute by name", modified as appropriate --> | ||
|
||
<li><p>If <var>attribute</var> is null, create an <a>attribute</a> whose | ||
<a for=Attr>local name</a> is <var>qualifiedName</var>, <a for=Attr>value</a> is | ||
<var>value</var>, and <a for=Node>node document</a> is <a>this</a>'s <a for=Node>node document</a>, | ||
then <a lt="append an attribute">append</a> this <a>attribute</a> to <a>this</a>, and then return. | ||
<li><p>Let <var>attributeExists</var> be false if <var>attribute</var> is null; otherwise true. | ||
|
||
<li><p>If <var>attributeExists</var> is false, set <var>attribute</var> to an <a>attribute</a> | ||
whose <a for=Attr>local name</a> is <var>qualifiedName</var>, <a for=Attr>value</a> is | ||
<var>value</var>, and <a for=Node>node document</a> is <a>this</a>'s <a for=Node>node document</a>. | ||
|
||
<li><p>Let <var>verifiedValue</var> be the result of calling <a>verify attribute value</a> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "result of verifying" |
||
given <var>value</var>, <var>attribute</var>, and <a>this</a>. | ||
|
||
<li><p>Set <var>attributeExists</var> to true if <a>this</a> | ||
<a lt="has an attribute">has an attribute</a> <var>attribute</var>; otherwise false. | ||
|
||
<li><p>If <var>attributeExists</var> is true, <a lt="change an attribute">change</a> | ||
<var>attribute</var> to <var>verifiedValue</var>. | ||
|
||
<li> | ||
<p>Otherwise: | ||
|
||
<ol> | ||
<li><p>Set <var>attribute</var>'s <a for=Attr>value</a> to <var>verifiedValue</var>. | ||
|
||
<li><p><a lt="change an attribute">Change</a> <var>attribute</var> to <var>value</var>. | ||
<li><p><a lt="append an attribute">Append</a> this <a>attribute</a> to <var>element</var>. | ||
</ol> | ||
</ol> | ||
|
||
<p>The | ||
|
@@ -6956,7 +7014,7 @@ method steps are: | |
passing <var>namespace</var> and <var>qualifiedName</var> to <a>validate and extract</a>. | ||
|
||
<li><p><a>Set an attribute value</a> for <a>this</a> using <var>localName</var>, <var>value</var>, | ||
and also <var>prefix</var> and <var>namespace</var>. | ||
<var>prefix</var>, <var>namespace</var> and true. | ||
</ol> | ||
|
||
<p>The | ||
|
@@ -7514,7 +7572,23 @@ string <var>value</var>, run these steps: | |
<li><p>If <var>attribute</var>'s <a for=Attr>element</a> is null, then set <var>attribute</var>'s | ||
<a for=Attr>value</a> to <var>value</var>. | ||
|
||
<li><p>Otherwise, <a lt="change an attribute">change</a> <var>attribute</var> to <var>value</var>. | ||
<li> | ||
<p>Otherwise: | ||
|
||
<ol> | ||
<li><p>Let <var>originalElement</var> be <var>attribute</var>'s <a for=Attr>element</a>. | ||
|
||
<li><p>Let <var>verifiedValue</var> be the result of calling <a>verify attribute value</a> | ||
given <var>value</var>, <var>attribute</var>, and <a>this</a>. | ||
|
||
<li><p>If <var>attribute</var>'s <a for=Attr>element</a> is null, then set <var>attribute</var>'s | ||
<a for=Attr>value</a> to <var>value</var>, and return. | ||
|
||
<li><p>If <var>attribute</var>'s <a for=Attr>element</a> is not <var>originalElement</var>, then | ||
return. | ||
|
||
<li><p><a lt="change an attribute">Change</a> <var>attribute</var> to <var>verifiedValue</var>. | ||
lukewarlow marked this conversation as resolved.
Show resolved
Hide resolved
lukewarlow marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</ol> | ||
</ol> | ||
|
||
<p>The {{Attr/value}} setter steps are to <a>set an existing attribute value</a> with <a>this</a> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"result of verifying an attribute value"