capricorn86 / happy-dom

A JavaScript implementation of a web browser without its graphical user interface
MIT License
3.14k stars 189 forks source link

feat: [#825] Attribute iframe.sandbox should return a DOMTokenList #1375

Closed jeffwcx closed 3 months ago

jeffwcx commented 4 months ago

According to the specifications:

https://html.spec.whatwg.org/multipage/iframe-embed-object.html#attr-iframe-sandbox https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#sandbox

The sandbox attribute of the HTMLIFrameElement should return a DOMTokenList.

Additionally, although sandbox works like a regular DOMTokenList, it is checked after the attribute is set. If there are tokens that do not comply with the specification, an error message will be printed (but no error will be thrown).

There is a bug in DOMTokenList where, after setting the value, operations like sandbox[0] do not take effect. So we need an update of the indices.

jeffwcx commented 3 months ago

Hi, @capricorn86 can you take a look?