summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/cssom/getComputedStyle-pseudo-with-argument.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/css/cssom/getComputedStyle-pseudo-with-argument.html')
-rw-r--r--testing/web-platform/tests/css/cssom/getComputedStyle-pseudo-with-argument.html64
1 files changed, 64 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/cssom/getComputedStyle-pseudo-with-argument.html b/testing/web-platform/tests/css/cssom/getComputedStyle-pseudo-with-argument.html
new file mode 100644
index 0000000000..bc23ad180b
--- /dev/null
+++ b/testing/web-platform/tests/css/cssom/getComputedStyle-pseudo-with-argument.html
@@ -0,0 +1,64 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSSOM: Handling pseudo-elements with arguments</title>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<link rel=help href=https://drafts.csswg.org/cssom/#dom-window-getcomputedstyle>
+<style>
+#pseudo-invalid::highlight(name) {
+ color: rgb(0, 128, 0);
+}
+#pseudo-invalid::view-transition-image-pair(name) {
+ color: rgb(0, 128, 0);
+}
+#pseudo-invalid::view-transition-group(name) {
+ color: rgb(0, 128, 0);
+}
+#pseudo-invalid::view-transition-old(name) {
+ color: rgb(0, 128, 0);
+}
+#pseudo-invalid::view-transition-new(name) {
+ color: rgb(0, 128, 0);
+}
+</style>
+<ul><li id="pseudo-invalid">Item</li></ul>
+<script>
+[
+ "::before(test)",
+ "::highlight",
+ "::highlight(",
+ "::highlight()",
+ "::highlight(1)",
+ "::highlight($)",
+ "::highlight (name)",
+ "::highlight(name)a",
+ ":highlight(name)",
+ "::view-transition-group(*)",
+ "::view-transition-image-pair(*)",
+ "::view-transition-old(*)",
+ "::view-transition-new(*)",
+ ":view-transition-group(name)",
+ ":view-transition-image-pair(name)",
+ ":view-transition-old(name)",
+ ":view-transition-new(name)",
+].forEach(nonParsablePseudoIdentifier => {
+ test(() => {
+ const li = document.querySelector('li');
+ assert_equals(getComputedStyle(li, nonParsablePseudoIdentifier).length, 0);
+ }, `This pseudo-element should not parse: ${nonParsablePseudoIdentifier}`)
+});
+
+[
+ "::highlight(name)",
+ "::highlight(\nname",
+ "::highlight(name\t",
+ "::highlight( name ",
+ "::highlight( n\\61me )"
+].forEach(parsablePseudoIdentifier => {
+ test(() => {
+ const li = document.querySelector('li');
+ assert_true(getComputedStyle(li, parsablePseudoIdentifier).length != 0);
+ assert_equals(getComputedStyle(li, parsablePseudoIdentifier).color, "rgb(0, 128, 0)");
+ }, `This pseudo-element should parse: ${parsablePseudoIdentifier}`);
+});
+</script>