diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/css/selectors/last-child.html | |
parent | Initial commit. (diff) | |
download | firefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/css/selectors/last-child.html')
-rw-r--r-- | testing/web-platform/tests/css/selectors/last-child.html | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/selectors/last-child.html b/testing/web-platform/tests/css/selectors/last-child.html new file mode 100644 index 0000000000..423ccf84f4 --- /dev/null +++ b/testing/web-platform/tests/css/selectors/last-child.html @@ -0,0 +1,52 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>CSS Selectors :last-child</title> +<link rel="help" href="https://drafts.csswg.org/selectors-4/#the-last-child-pseudo"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<!-- + See also: + * child-indexed-pseudo-class.html + * child-indexed-no-parent.html + * invalidation/first-child-last-child.html +--> +<body> + +<div> + <div id="target1">Whitespace nodes should be ignored.</div> +</div> + +<div> + <blockquote></blockquote> + <div id="target2">There is a prior child element.</div> +</div> + +<div> + <div id="target3">A comment node should be ignored.</div> + <!-- --> +</div> + +<div> + <div id="target4">Non-whitespace text node should be ignored.</div> + . +</div> + +<div> + <div id="target5" data-expected="false">The first child should not be matched.</div> + <blockquote></blockquote> +</div> + +<script> +for (let i = 1; i <= 5; ++i) { + let target = document.querySelector(`#target${i}`); + test(() => { + if (target.dataset.expected == 'false') + assert_false(target.matches(':last-child')); + else + assert_true(target.matches(':last-child')); + }, target.textContent); +} +</script> + |