From 123ce3a6776a03104122a1435d3d1ad325cadb83 Mon Sep 17 00:00:00 2001 From: Luke Warlow Date: Mon, 15 Apr 2024 13:00:16 +0100 Subject: [PATCH] Use event handler content attribute concept --- spec/index.bs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/spec/index.bs b/spec/index.bs index d636021..7b72e74 100644 --- a/spec/index.bs +++ b/spec/index.bs @@ -682,8 +682,6 @@ Its value is initially « ». 1. Return |expectedType|. - Note: Step 3 is a special case for event handler names, as they always start with "on". -
trustedTypes.getPropertyType('div', 'innerHTML'); // "TrustedHTML" @@ -701,7 +699,6 @@ Its value is initially « ». 1. Set |localName| to |tagName| in [=ASCII lowercase=]. 1. Set |attribute| to |attribute| in [=ASCII lowercase=]. - 1. If |attribute| starts with "on", then return {{TrustedScript}}. 1. If |elementNs| is an empty string, set |elementNs| to [=HTML namespace=]. 1. If |attrNs| is an empty string, set |attrNs| to null. 1. Let |interface| be the [=element interface=] for |localName| and |elementNs|. @@ -713,8 +710,6 @@ Its value is initially « ». 1. If |attributeData| is not null, then set |expectedType| to the value of the third member of |attributeData|. 1. Return |expectedType|. - Note: Step 3 is a special case for <a href=https://html.spec.whatwg.org/#event-handler-name>event handler names</a>, as they always start with "on". - <div class="example" id="get-attribute-type-example"> <xmp highlight="js"> trustedTypes.getAttributeType('script', 'src'); // "TrustedScriptURL" @@ -1110,6 +1105,8 @@ To <dfn abstract-op export>get Trusted Types-compliant attribute value</dfn> on To <dfn abstract-op>Get Trusted Type data for attribute</dfn> given |element|, |attribute|, |attributeNs|, perform the following steps: 1. Let |data| be null. +1. If |attributeNs| is null, and |attribute| is the name of an [=event handler content attribute=], then: + 1. Return ({{Element}}, null, {{TrustedScript}}, "Element " + |attribute|). 1. Find the row in the following table, where |element| is in the first column, |attributeNs| is in the second column, and |attribute| is in the third column. If a matching row is found, set |data| to that row. @@ -1127,8 +1124,6 @@ To <dfn abstract-op>Get Trusted Type data for attribute</dfn> given |element|, | 1. Return |data|. -Issue: This algorithm should account for event handler attributes. See https://github.com/w3c/trusted-types/issues/474 - # Integrations # {#integrations} <pre class="idl">