mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:47:36 +00:00
LibWeb: Implement Element.removeAttributeNS
This commit is contained in:
parent
7a26a889cb
commit
3910efb80b
5 changed files with 59 additions and 1 deletions
12
Tests/LibWeb/Text/expected/DOM/Element-removeAttributeNS.txt
Normal file
12
Tests/LibWeb/Text/expected/DOM/Element-removeAttributeNS.txt
Normal file
|
@ -0,0 +1,12 @@
|
|||
Original values
|
||||
xlink:href getAttributeNS = 'test'
|
||||
href getAttribute = 'test'
|
||||
Non-matching namespace
|
||||
xlink:href getAttributeNS = 'test'
|
||||
href getAttribute = 'test'
|
||||
Non-matching name
|
||||
xlink:href getAttributeNS = 'test'
|
||||
href getAttribute = 'test'
|
||||
Matching
|
||||
xlink:href getAttributeNS = 'null'
|
||||
href getAttribute = 'null'
|
37
Tests/LibWeb/Text/input/DOM/Element-removeAttributeNS.html
Normal file
37
Tests/LibWeb/Text/input/DOM/Element-removeAttributeNS.html
Normal file
|
@ -0,0 +1,37 @@
|
|||
<script src="../include.js"></script>
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<script id="with-xlink-href" xlink:href="test"></script>
|
||||
<script id="no-xlink-href" href="test"></script>
|
||||
</svg>
|
||||
<script id="svg-script-element">
|
||||
test(() => {
|
||||
const namespace = "http://www.w3.org/1999/xlink"
|
||||
const xlinkNS = document.getElementById("with-xlink-href");
|
||||
const noNS = document.getElementById("no-xlink-href");
|
||||
|
||||
println("Original values");
|
||||
println(`xlink:href getAttributeNS = '${xlinkNS.getAttributeNS(namespace, "href")}'`);
|
||||
println(`href getAttribute = '${noNS.getAttribute("href")}'`);
|
||||
|
||||
println("Non-matching namespace");
|
||||
xlinkNS.removeAttributeNS(null, "href");
|
||||
noNS.removeAttributeNS(namespace, "href");
|
||||
|
||||
println(`xlink:href getAttributeNS = '${xlinkNS.getAttributeNS(namespace, "href")}'`);
|
||||
println(`href getAttribute = '${noNS.getAttribute("href")}'`);
|
||||
|
||||
println("Non-matching name");
|
||||
xlinkNS.removeAttributeNS(namespace, "thing");
|
||||
noNS.removeAttributeNS(null, "thing");
|
||||
|
||||
println(`xlink:href getAttributeNS = '${xlinkNS.getAttributeNS(namespace, "href")}'`);
|
||||
println(`href getAttribute = '${noNS.getAttribute("href")}'`);
|
||||
|
||||
println("Matching");
|
||||
xlinkNS.removeAttributeNS(namespace, "href");
|
||||
noNS.removeAttributeNS(null, "href");
|
||||
|
||||
println(`xlink:href getAttributeNS = '${xlinkNS.getAttributeNS(namespace, "href")}'`);
|
||||
println(`href getAttribute = '${noNS.getAttribute("href")}'`);
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue