Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Pseudo Test: CSSPseudoElement.selectorText</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="target"></div>
<script>
test(() => {
for (const type of ["::before", "::after", "::marker", "::backdrop",
"::scroll-marker"]) {
assert_equals(target.pseudo(type).selectorText, type, type);
}
}, "selectorText of pseudo-elements without arguments");
test(() => {
const before = target.pseudo("::before");
const marker = before.pseudo("::marker");
assert_equals(marker.selectorText, "::marker");
assert_equals(marker.parent.selectorText, "::before");
}, "selectorText of a sub-pseudo-element only includes its own pseudo-element");
test(() => {
const before = target.pseudo("::BEFORE");
assert_equals(before.selectorText, "::before");
}, "selectorText is serialized in lowercase");
test(() => {
const div = document.createElement("div");
assert_equals(div.pseudo("::after").selectorText, "::after");
}, "selectorText of a pseudo-element of a disconnected element");
</script>