Skip to content

Commit

Permalink
Upstream Trusted Types integration with SVGAnimatedString
Browse files Browse the repository at this point in the history
  • Loading branch information
lukewarlow authored and sideshowbarker committed Nov 15, 2024
1 parent 4944c7c commit 2d20967
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions master/types.html
Original file line number Diff line number Diff line change
Expand Up @@ -2116,8 +2116,9 @@ <h3 id="InterfaceSVGAnimatedString">Interface SVGAnimatedString</h3>
animatable attribute that takes a string value. It can optionally
be defined to additionally reflect a second, deprecated attribute.</p>

<pre class="idl">interface <b>SVGAnimatedString</b> {
attribute DOMString <a href="types.html#__svg__SVGAnimatedString__baseVal">baseVal</a>;
<pre class="idl">[Exposed=Window]
interface <b>SVGAnimatedString</b> {
attribute (DOMString or TrustedScriptURL) <a href="types.html#__svg__SVGAnimatedString__baseVal">baseVal</a>;
readonly attribute DOMString <a href="types.html#__svg__SVGAnimatedString__animVal">animVal</a>;
};</pre>

Expand Down Expand Up @@ -2153,13 +2154,22 @@ <h3 id="InterfaceSVGAnimatedString">Interface SVGAnimatedString</h3>
the following steps are run:</p>

<ol class='algorithm'>
<li>If the reflected attribute’s element is an <a>SVGScriptElement</a>, let <var>value</var> be the result of
executing the <a href="https://www.w3.org/TR/trusted-types/#get-trusted-type-compliant-string-algorithm">Get Trusted Type compliant string</a>
algorithm, with <a href="https://www.w3.org/TR/trusted-types/#trustedscripturl">TrustedScriptURL</a>,
reflected attribute’s Document's relevant global object, 'SVGScriptElement href', and 'script'.</li>
<li>Otherwise, let value be the specified value.</li>
<li>If the reflected attribute is not present,
the <a>SVGAnimatedString</a> object is defined to additionally reflect
a second, deprecated attribute, and that deprecated attribute is present,
then set that deprecated attribute to the specified value.</li>
<li>Otherwise, set the reflected attribute to the specified value.</li>
then set that deprecated attribute to value.</li>
<li>Otherwise, set the reflected attribute to value.</li>
</ol>

<p class='note'> SVG does not have a complete script processing model <a href="https://github.com/w3c/svgwg/issues/196">yet</a>.
<a href="https://www.w3.org/TR/trusted-types/">Trusted Types</a> assumes that the attribute and
text body modification protections behave similarly to ones for HTML scripts.</p>

<p class='note'>For the <a href='#__svg__SVGURIReference__href'>href</a>
member on the <a>SVGURIReference</a> interface, this will result in
the deprecated <a>'xlink:href'</a> attribute being set if it is
Expand Down

0 comments on commit 2d20967

Please sign in to comment.