mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:17:35 +00:00
LibWeb: Implement SVGUseElement#href
Required by Ruffle.
b196c8d1bc/web/packages/core/src/shadow-template.ts (L601-L602)
This commit is contained in:
parent
968bec9844
commit
54972e3ceb
5 changed files with 178 additions and 2 deletions
57
Tests/LibWeb/Text/input/SVG/svg-href.html
Normal file
57
Tests/LibWeb/Text/input/SVG/svg-href.html
Normal file
|
@ -0,0 +1,57 @@
|
|||
<script src="../include.js"></script>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" id="svg-element">
|
||||
<use class="no-xlink-href"></use>
|
||||
<use class="explicit-xlink-href" xlink:href="test1"></use>
|
||||
<use class="implicit-xlink-href" href="test2"></use>
|
||||
<text class="ignore">
|
||||
<textPath class="no-xlink-href"></textPath>
|
||||
<textPath class="explicit-xlink-href" xlink:href="test1"></textPath>
|
||||
<textPath class="implicit-xlink-href" href="test2"></textPath>
|
||||
</text>
|
||||
</svg>
|
||||
<script>
|
||||
function dumpAttribute(element) {
|
||||
"use strict";
|
||||
println("---------------");
|
||||
println(`${element.tagName} - ${element.getAttribute("class")}`);
|
||||
println("---------------");
|
||||
println(`element.href instanceof SVGAnimatedString -> ${element.href instanceof SVGAnimatedString}`);
|
||||
println(`element.href === element.href -> ${element.href === element.href}`);
|
||||
println(`element.href.baseVal -> ${element.href.baseVal}`);
|
||||
println(`element.href.animVal -> ${element.href.animVal}`);
|
||||
println(`element.href.baseVal === element.href.animVal -> ${element.href.baseVal === element.href.animVal}`);
|
||||
println(`element.getAttribute("xlink:href") -> ${element.getAttribute("xlink:href")}`);
|
||||
println(`element.getAttribute("href") -> ${element.getAttribute("href")}`);
|
||||
println("setting baseVal...");
|
||||
element.href.baseVal = "testSet";
|
||||
println("done, new values:");
|
||||
println(`element.href.baseVal -> ${element.href.baseVal}`);
|
||||
println(`element.href.animVal -> ${element.href.animVal}`);
|
||||
println(`element.href.baseVal === element.href.animVal -> ${element.href.baseVal === element.href.animVal}`);
|
||||
println(`element.getAttribute("xlink:href") -> ${element.getAttribute("xlink:href")}`);
|
||||
println(`element.getAttribute("href") -> ${element.getAttribute("href")}`);
|
||||
println("animVal should be readonly:")
|
||||
try {
|
||||
element.href.animVal = "invalid";
|
||||
} catch (e) {
|
||||
println(`${e.name}: ${e.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
function dumpTree(element) {
|
||||
for (const child of Array.from(element.children))
|
||||
{
|
||||
if (child.getAttribute("class") !== "ignore")
|
||||
{
|
||||
dumpAttribute(child);
|
||||
}
|
||||
|
||||
dumpTree(child);
|
||||
}
|
||||
}
|
||||
|
||||
test(() => {
|
||||
const svgElement = document.getElementById("svg-element");
|
||||
dumpTree(svgElement);
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue