mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-28 02:27:19 +02:00
LibWeb: Implement the HTMLAnchorElement.relList attribute
This returns a DOMTokenList that reflects the `rel` attribute.
This commit is contained in:
committed by
Andreas Kling
parent
63246577d2
commit
b7fd39c2e6
Notes:
sideshowbarker
2024-07-17 03:51:15 +09:00
Author: https://github.com/tcl3 Commit: https://github.com/SerenityOS/serenity/commit/b7fd39c2e6 Pull-request: https://github.com/SerenityOS/serenity/pull/24342
26
Tests/LibWeb/Text/input/HTML/relList-attribute.html
Normal file
26
Tests/LibWeb/Text/input/HTML/relList-attribute.html
Normal file
@@ -0,0 +1,26 @@
|
||||
<!DOCTYPE html>
|
||||
<script src="../include.js"></script>
|
||||
<script>
|
||||
function relListTest(tagName) {
|
||||
const element = document.createElement(tagName);
|
||||
const relList = element.relList;
|
||||
println(`${tagName}.relList initial length: ${relList.length}`);
|
||||
println(`${tagName}.relList always returns the same value: ${relList === element.relList}`);
|
||||
element.rel = "whatever";
|
||||
println(`${tagName}.relList for after setting rel to "whatever": ${relList}`);
|
||||
element.relList = "prefetch";
|
||||
println(`${tagName}.relList for after setting rel to "prefetch": ${relList}`);
|
||||
println(`${tagName}.relList contains "prefetch": ${relList.contains("prefetch")}`);
|
||||
println(`${tagName}.relList contains "whatever": ${relList.contains("whatever")}`);
|
||||
}
|
||||
|
||||
test(() => {
|
||||
const tagNamesToTest = [
|
||||
"a",
|
||||
];
|
||||
|
||||
for (const tagName of tagNamesToTest) {
|
||||
relListTest(tagName);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user