You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given {{Attr}} |attribute|, {{Element}} |element| and {{TrustedType}} or a string |newValue|, this algorithm performs the following steps:
1106
+
1107
+
1. If |element| has an <a spec="webidl" lt="attribute">IDL attribute</a> that [=reflects=] a content attribute with |attribute|'s [=Attr/local name=], let |idlAttribute| be that IDL attribute. Otherwise, return stringified |newValue|.
1108
+
1. If {{StringContext}} IDL extended attribute does not appears on |idlAttribute|, return stringified |newValue|.
1109
+
1. Set |value| to the result of executing [$Get Trusted Type compliant string$] with the following arguments:
1110
+
* {{StringContext}} identifier as |expectedType|
1111
+
* |newValue| as |input|
1112
+
* |element|'s <a>relevant global object</a> as |global|
1113
+
* the result of [=concatenating=] the list « |element|'s [=Element/local name=], |attribute|'s |localName| » with `"."` as a |separator| as |sink|
1114
+
* 'script' as |sinkGroup|
1115
+
1116
+
If the algorithm threw an error, rethrow the error.
:: A string, containing the body of the script to execute that was set
1259
1254
through a {{StringContext}} compliant sink. Equivalent to script's
@@ -1283,12 +1278,6 @@ On setting the {{HTMLElement/innerText}}, {{Node/textContent}} and {{HTMLScriptE
1283
1278
1. Set {{HTMLScriptElement/[[ScriptText]]}} internal slot value to the stringified attribute value.
1284
1279
1. Perform the usual attribute setter steps.
1285
1280
1286
-
1287
-
On setting the {{HTMLScriptElement/src}} IDL attribute, execute the following algorithm:
1288
-
1289
-
1. Set {{HTMLScriptElement/[[ScriptURL]]}} internal slot value to the stringified attribute value.
1290
-
1. Perform the usual attribute setter steps.
1291
-
1292
1281
#### Slot value verification #### {#slot-value-verification}
1293
1282
1294
1283
The first few steps of the [=prepare the script element=] algorithm are modified as follows:
@@ -1312,14 +1301,6 @@ The first few steps of the [=prepare the script element=] algorithm are modified
1312
1301
<li><p>Let <var>source text</var> be <var>el</var>'s <del><a id=script-processing-model:child-text-content href=https://dom.spec.whatwg.org/#concept-child-text-content data-x-internal=child-text-content>child text content</a>.</del><ins>`[[ScriptText]]` internal slot value.</ins>
1313
1302
<li>...
1314
1303
</ol>
1315
-
<p>In all subsequent steps, replace checks for <code>src</code> attribute existence with checks for non-null `[[ScriptURL]]` internal slot value, and replace references of <code>src</code> content attribute value with `[[ScriptURL]]` internal slot value. For example:
1316
-
<ul>
1317
-
<li>If <del><var>el</var> does not have a <code>src</a></code> content attribute</del><ins><var>el</var>'s `[[ScriptURL]]` internal slot value is null</ins>, and the <a id="script-processing-model:should-element's-inline-behavior-be-blocked-by-content-security-policy" href=https://w3c.github.io/webappsec-csp/#should-block-inline data-x-internal="should-element's-inline-behavior-be-blocked-by-content-security-policy">Should element's inline
1318
-
behavior be blocked by Content Security Policy?</a> algorithm returns "<code>Blocked</code>" when given <var>el</var>, "<code>script</code>", and
1319
-
<var>source text</var>, then return.
1320
-
<li>If <var>el</var><ins>'s</ins><del>has a <code>src</code> content attribute</del><ins>`[[ScriptURL]]` internal slot value is not null</ins>, then:
1321
-
<li><p>Let <var ignore="">src</var> be the value of <var>el</var>'s <del><code>src</a></code> attribute</del><ins>`[[ScriptURL]]` internal slot</ins>.
1322
-
</ul>
1323
1304
1324
1305
### Enforcement in element attributes ### {#enforcement-in-sinks}
1325
1306
@@ -1495,45 +1476,6 @@ On setting {{SVGAnimatedString/baseVal}}, the following steps are run:
1495
1476
1496
1477
Note: SVG does not have a complete script processing model <a href="https://github.com/w3c/svgwg/issues/196">yet</a>. Trusted Types assumes that the attribute and text body modification protections behave similarly to ones for HTML scripts outlined in [[#enforcement-in-scripts]].
1497
1478
1498
-
## Integration with DOM ## {#integration-with-dom}
1499
-
1500
-
This document modifies the {{Element}} interface, adding <a>attribute validation steps</a>:
1501
-
1502
-
<p><ins>This and <a lt="other applicable specifications">other specifications</a> may define
1503
-
<dfn export id=concept-element-attributes-validation-ext>attribute validation steps</dfn> for
1504
-
<a for=/ spec=dom>elements</a>. The algorithm is passed <var>element</var>, <var>localName</var>,
1505
-
<var>value</var>, and <var ignore>namespace</var>.</ins>
1506
-
1507
-
This document changes the <a spec="dom">handle attribute changes</a> algorithm, adding the following step at the beginning:
1508
-
<ol>
1509
-
<li><ins><p>Run the <a>attribute validation steps</a> with <var>element</var>,
1510
-
<var>attribute</var>'s <a for=Attr>local name</a>, <var ignore>newValue</var> and
1511
-
<var>attribute</var>'s <a for=Attr>namespace</a>. If this throws an exception, then
1512
-
rethrow the exception and abort further steps.</ins>
1513
-
</ol>
1514
-
1515
-
Additionally, this document changes the <a spec=dom>append</a> an attribute algorithm:
1516
-
1517
-
<p>To <dfn export id=concept-element-attributes-append lt="append an attribute">append</dfn> an
1518
-
<a spec=dom>attribute</a><var>attribute</var> to an <a spec=dom for="/">element</a><var>element</var>
1519
-
<ins>with a <var>value</var></ins>, run these steps:
1520
-
1521
-
<ol>
1522
-
<li><p><a spec="dom">Handle attribute changes</a> for <var>attribute</var> with <var>element</var>, null, and
0 commit comments