Re: [whatwg/dom] Trusted types attributes (PR #1268)

lukewarlow left a comment (whatwg/dom#1268)

I've pushed up the change to "set an attribute". I'm looking into the other methods atm.

> Attr.value/.nodeValue/.textContent should do validation (if there is element) too before modifying the value.
(chromium and webkit seem to do something else, assuming I'm reading the code correctly)

WebKit at least calls element->setAttribute which seems to follow roughly the same steps in the spec as what "set an existing attribute value" does. I'll take a look into what Firefox does here to try and work out what changes if any are needed.

> Element.setAttribute/Element.setAttributeNS in the PR needs some tweaking too. Implementations don't necessarily create Attr nodes when those APIs are used, but if they do, what happens if TT callback moves the Attr away. As fred-wang mentioned earlier, implementations already just create a new attribute on the element.

I'll investigate what Firefox is doing here and see what the best approach to take is. Generally it seems we want to move TT earlier in the process if possible so I'll try to achieve that.

![image](https://github.com/user-attachments/assets/f79b7bdb-33b5-4bbc-ba01-f23a64d40697)

Perhaps we can move step 6 higher up, but it would have to be after step 3 at the earliest.


-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/pull/1268#issuecomment-2671748970
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/dom/pull/1268/c2671748970@github.com>

Received on Thursday, 20 February 2025 14:58:11 UTC