mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 18:17:22 +02:00
LibWeb/DOM: Check if name is valid in Element.toggleAttribute
This resolves a test in https://wpt.live/dom/nodes/attributes.html.
This commit is contained in:
committed by
Andreas Kling
parent
0127190dcf
commit
f774d75f89
Notes:
github-actions[bot]
2024-07-25 04:47:19 +00:00
Author: https://github.com/jamierocks Commit: https://github.com/LadybirdBrowser/ladybird/commit/f774d75f890 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/819
@@ -0,0 +1,24 @@
|
||||
<!DOCTYPE html>
|
||||
<script src="include.js"></script>
|
||||
<div id="test"></div>
|
||||
<script>
|
||||
test(() => {
|
||||
const element = document.getElementById("test");
|
||||
|
||||
// toggleAttribute should throw an exception if the name isn't a valid
|
||||
// XML Name (e.g. "", or "0").
|
||||
try {
|
||||
element.toggleAttribute("");
|
||||
println("FAIL ('')");
|
||||
} catch (err) {
|
||||
println("PASS (''): " + err.name);
|
||||
}
|
||||
|
||||
try {
|
||||
element.toggleAttribute("0");
|
||||
println("FAIL ('0')");
|
||||
} catch (err) {
|
||||
println("PASS ('0'): " + err.name);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user