1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:17:46 +00:00

LibWeb: Properly append attributes to element when creating an Element

The main behavioural difference here is that the full qualified name is
appended to the element, rather than just the local name and value.
This commit is contained in:
Shannon Booth 2023-10-04 17:45:48 +13:00 committed by Sam Atkins
parent 8fbf72b5bf
commit e5d45eeeb1
3 changed files with 49 additions and 3 deletions

View file

@ -0,0 +1,18 @@
---------------
explicit-xlink-href
---------------
localName -> href
name -> xlink:href
namespaceURI -> http://www.w3.org/1999/xlink
ownerElement -> explicit-xlink-href
prefix -> xlink
value -> test
---------------
implicit-xlink-href
---------------
localName -> href
name -> href
namespaceURI -> null
ownerElement -> implicit-xlink-href
prefix -> null
value -> test

View file

@ -0,0 +1,24 @@
<script src="../include.js"></script>
<svg xmlns="http://www.w3.org/2000/svg">
<script id="explicit-xlink-href" xlink:href="test"></script>
<script id="implicit-xlink-href" href="test"></script>
</svg>
<script id="svg-script-element">
function dumpAttribute(elementName) {
println("---------------");
println(elementName);
println("---------------");
const attr = document.getElementById(elementName).attributes[1];
println(`localName -> ${attr.localName}`);
println(`name -> ${attr.name}`);
println(`namespaceURI -> ${attr.namespaceURI}`);
println(`ownerElement -> ${attr.ownerElement.id}`);
println(`prefix -> ${attr.prefix}`);
println(`value -> ${attr.value}`);
}
test(() => {
dumpAttribute('explicit-xlink-href');
dumpAttribute('implicit-xlink-href');
});
</script>