From 7fa73e4da71cae9ae7a84ca720cbcb95d0e1b6b5 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 1972297..b61ccf0 100644 --- a/spec/index.bs +++ b/spec/index.bs @@ -691,8 +691,6 @@ initially empty. 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" @@ -710,7 +708,6 @@ initially empty. 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|. @@ -722,8 +719,6 @@ initially empty. 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" @@ -1122,6 +1117,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. @@ -1139,8 +1136,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">