Bug 1300374: Reftest for child-indexed selectors matching the root element. r?heycam draft
authorEmilio Cobos Álvarez <ecoal95@gmail.com>
Wed, 14 Sep 2016 17:18:06 -0700
changeset 413924 b7fdf9e271e19c5814c4248171618b19a0c577e6
parent 413898 4792bb1e19b2d531a4a3649619224dc4b6490b75
child 413925 b6e185b05c615f2866267134e0e6e302b50efe00
push id29553
push userbmo:ecoal95@gmail.com
push dateThu, 15 Sep 2016 07:20:10 +0000
reviewersheycam
bugs1300374
milestone51.0a1
Bug 1300374: Reftest for child-indexed selectors matching the root element. r?heycam MozReview-Commit-ID: EPb2udKbEKJ
layout/reftests/w3c-css/submitted/selectors4/child-index-no-parent-01-ref.html
layout/reftests/w3c-css/submitted/selectors4/child-index-no-parent-01.html
layout/reftests/w3c-css/submitted/selectors4/reftest.list
new file mode 100644
--- /dev/null
+++ b/layout/reftests/w3c-css/submitted/selectors4/child-index-no-parent-01-ref.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Test reference</title>
+<link rel="author" title="Emilio Cobos Álvarez" href="mailto:ecoal95@gmail.com">
+<style>
+  :root {
+    color: green;
+  }
+</style>
+<p>Should be green
+<p>Should be green
+<p>Should be green
+<p>Should be green
+<p>Should be green
+<p>Should be green
+<p>Should be green
+<p>Should be green
+<p>Should be green
new file mode 100644
--- /dev/null
+++ b/layout/reftests/w3c-css/submitted/selectors4/child-index-no-parent-01.html
@@ -0,0 +1,50 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Test: child-indexed selectors should match without a parent element.</title>
+<link rel="author" title="Emilio Cobos Álvarez" href="mailto:ecoal95@gmail.com">
+<link rel="help" href="https://drafts.csswg.org/selectors-4/#child-index">
+<link rel="match" href="child-index-no-parent-01-ref.html">
+<style>
+  :root:first-child #a {
+    color: green;
+  }
+  :root:nth-child(n) #b {
+    color: green;
+  }
+  :root:first-of-type #c {
+    color: green;
+  }
+  :root:nth-of-type(1) #d {
+    color: green;
+  }
+  :root:last-of-type #e {
+    color: green;
+  }
+  :root:last-child #f {
+    color: green;
+  }
+  :root:nth-last-child(1) #g {
+    color: green;
+  }
+  :root:nth-last-of-type(n) #h {
+    color: green;
+  }
+
+  #i {
+    color: green;
+  }
+
+  /* NB: not matching intentionally */
+  :root:nth-last-child(2) #i {
+    color: red;
+  }
+</style>
+<p id="a">Should be green
+<p id="b">Should be green
+<p id="c">Should be green
+<p id="d">Should be green
+<p id="e">Should be green
+<p id="f">Should be green
+<p id="g">Should be green
+<p id="h">Should be green
+<p id="i">Should be green
--- a/layout/reftests/w3c-css/submitted/selectors4/reftest.list
+++ b/layout/reftests/w3c-css/submitted/selectors4/reftest.list
@@ -1,7 +1,8 @@
 == dir-style-01a.html dir-style-01-ref.html
 == dir-style-01b.html dir-style-01-ref.html
 == dir-style-02a.html dir-style-02-ref.html
 == dir-style-02b.html dir-style-02-ref.html
 == dir-style-03a.html dir-style-03-ref.html
 == dir-style-03b.html dir-style-03-ref.html
 == dir-style-04.html dir-style-04-ref.html
+== child-index-no-parent-01.html child-index-no-parent-01-ref.html