1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 08:37:46 +00:00

LibWeb: Implement Document named properties with light caching

We now cache potentially named elements on the Document when elements
are inserted and removed. This allows us to do lookup of what names are
supported much faster than if we had to iterate the tree every time.

This first cut doesn't implement the rules for 'exposed' object and
embed elements.
This commit is contained in:
Andrew Kaster 2024-02-15 14:43:44 -07:00 committed by Tim Flynn
parent faaf5b9652
commit 94149db073
6 changed files with 285 additions and 8 deletions

View file

@ -0,0 +1,16 @@
Submit <FORM >
document.bob === document.forms[0]: true
<BUTTON id="fred" >
img element with name 'foo' and id 'bar':
<IMG id="bar" >
img element with id 'baz', but no name:
baz === undefined: true
Multiple elements with name 'foo':
foos.length = 2
<IMG id="bar" >
<FORM >
obj element with name 'greg' and id 'banana':
<OBJECT id="banana" >
<OBJECT id="banana" >
goodbye greg/banana
no more greg or banana: true, true