<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[174035] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/174035">174035</a></dd>
<dt>Author</dt> <dd>benjamin@webkit.org</dd>
<dt>Date</dt> <dd>2014-09-27 11:49:12 -0700 (Sat, 27 Sep 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Chaining multiple :nth-child() does not work properly
https://bugs.webkit.org/show_bug.cgi?id=137032
Patch by Benjamin Poulain <bpoulain@apple.com> on 2014-09-27
Reviewed by Gavin Barraclough.
Source/WebCore:
When multiple :nth-child() are chained, the evaluation of each "An+B" could depend on
the execution of the previous "An+B". The reason is that the register holding the position
of the current element could be modified by the evaluation of "An+B".
There are two cases in which the register was used as the destination of an operation:
1) When A and B are positive, the counter would be the destination of "counter - B".
2) When A is not 1 or 2, the modulo operation was not preserving the input register.
For (1), we a copy of the counter in that case of generateElementIsNthChild().
For (2), we also preserve a copy of the input if it is used by the operation. In this case,
if the input register is one of the argument we need for idiv, we preserve it on the stack
or in a register depending on what is available.
This increases the register requirements by 2 in the worst case on x86. The extra registers
can push generateElementIsNthChild() above the 4 available registers. To accomodate for that,
minimumRegisterRequirements() reserve more registers on x86.
The extra register pressure has strictly no effect on performance, x86_64 has 9 registers
available without pushing anything. The extra allocation is only necessary for debugging.
Tests: fast/selectors/nth-child-basics.html
fast/selectors/nth-child-chained.html
fast/selectors/nth-child-of-basics-2.html
fast/selectors/nth-child-of-chained.html
* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::minimumRegisterRequirements):
(WebCore::SelectorCompiler::SelectorCodeGenerator::modulo):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthChild):
LayoutTests:
* fast/selectors/nth-child-chained-expected.txt: Added.
* fast/selectors/nth-child-chained.html: Added.
* fast/selectors/nth-child-of-chained-expected.txt: Added.
* fast/selectors/nth-child-of-chained.html: Added.
Those new tests target specifically the register reuse bug fixed by the patch.
* fast/selectors/nth-child-basics-expected.txt: Added.
* fast/selectors/nth-child-basics.html: Added.
* fast/selectors/nth-child-of-basics-2-expected.txt: Added.
* fast/selectors/nth-child-of-basics-2.html: Added.
Those tests add coverage for the examples used by http://nthmaster.com. This is to increase
the general test coverage.
I added nth-child-of-basics-2.html instead of extending nth-child-of-basics.html because
of the speed issue in debug without CSS JIT (otherwise the test can timeout).</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssjitSelectorCompilercpp">trunk/Source/WebCore/cssjit/SelectorCompiler.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastselectorsnthchildbasicsexpectedtxt">trunk/LayoutTests/fast/selectors/nth-child-basics-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastselectorsnthchildbasicshtml">trunk/LayoutTests/fast/selectors/nth-child-basics.html</a></li>
<li><a href="#trunkLayoutTestsfastselectorsnthchildchainedexpectedtxt">trunk/LayoutTests/fast/selectors/nth-child-chained-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastselectorsnthchildchainedhtml">trunk/LayoutTests/fast/selectors/nth-child-chained.html</a></li>
<li><a href="#trunkLayoutTestsfastselectorsnthchildofbasics2expectedtxt">trunk/LayoutTests/fast/selectors/nth-child-of-basics-2-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastselectorsnthchildofbasics2html">trunk/LayoutTests/fast/selectors/nth-child-of-basics-2.html</a></li>
<li><a href="#trunkLayoutTestsfastselectorsnthchildofchainedexpectedtxt">trunk/LayoutTests/fast/selectors/nth-child-of-chained-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastselectorsnthchildofchainedhtml">trunk/LayoutTests/fast/selectors/nth-child-of-chained.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (174034 => 174035)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-09-27 07:13:44 UTC (rev 174034)
+++ trunk/LayoutTests/ChangeLog        2014-09-27 18:49:12 UTC (rev 174035)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+2014-09-27 Benjamin Poulain <bpoulain@apple.com>
+
+ Chaining multiple :nth-child() does not work properly
+ https://bugs.webkit.org/show_bug.cgi?id=137032
+
+ Reviewed by Gavin Barraclough.
+
+ * fast/selectors/nth-child-chained-expected.txt: Added.
+ * fast/selectors/nth-child-chained.html: Added.
+ * fast/selectors/nth-child-of-chained-expected.txt: Added.
+ * fast/selectors/nth-child-of-chained.html: Added.
+ Those new tests target specifically the register reuse bug fixed by the patch.
+
+ * fast/selectors/nth-child-basics-expected.txt: Added.
+ * fast/selectors/nth-child-basics.html: Added.
+ * fast/selectors/nth-child-of-basics-2-expected.txt: Added.
+ * fast/selectors/nth-child-of-basics-2.html: Added.
+ Those tests add coverage for the examples used by http://nthmaster.com. This is to increase
+ the general test coverage.
+
+ I added nth-child-of-basics-2.html instead of extending nth-child-of-basics.html because
+ of the speed issue in debug without CSS JIT (otherwise the test can timeout).
+
</ins><span class="cx"> 2014-09-26 Yusuke Suzuki <utatane.tea@gmail.com>
</span><span class="cx">
</span><span class="cx"> Mark fast/selectors/nth-child-of-basics as Slow
</span></span></pre></div>
<a id="trunkLayoutTestsfastselectorsnthchildbasicsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/selectors/nth-child-basics-expected.txt (0 => 174035)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/selectors/nth-child-basics-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/selectors/nth-child-basics-expected.txt        2014-09-27 18:49:12 UTC (rev 174035)
</span><span class="lines">@@ -0,0 +1,664 @@
</span><ins>+Test basic uses cases of :nth-child().
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Testing ":nth-child(8)"
+PASS document.querySelectorAll('#test-root :nth-child(8)').length is 1
+PASS document.querySelectorAll('#test-root :nth-child(8)')[0].id is "testcase8"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(n+6)"
+PASS document.querySelectorAll('#test-root :nth-child(n+6)').length is 6
+PASS document.querySelectorAll('#test-root :nth-child(n+6)')[0].id is "testcase6"
+PASS document.querySelectorAll('#test-root :nth-child(n+6)')[1].id is "testcase7"
+PASS document.querySelectorAll('#test-root :nth-child(n+6)')[2].id is "testcase8"
+PASS document.querySelectorAll('#test-root :nth-child(n+6)')[3].id is "testcase9"
+PASS document.querySelectorAll('#test-root :nth-child(n+6)')[4].id is "testcase10"
+PASS document.querySelectorAll('#test-root :nth-child(n+6)')[5].id is "testcase11"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(10, 100, 200)"
+
+Testing ":nth-child(-n+9)"
+PASS document.querySelectorAll('#test-root :nth-child(-n+9)').length is 9
+PASS document.querySelectorAll('#test-root :nth-child(-n+9)')[0].id is "testcase1"
+PASS document.querySelectorAll('#test-root :nth-child(-n+9)')[1].id is "testcase2"
+PASS document.querySelectorAll('#test-root :nth-child(-n+9)')[2].id is "testcase3"
+PASS document.querySelectorAll('#test-root :nth-child(-n+9)')[3].id is "testcase4"
+PASS document.querySelectorAll('#test-root :nth-child(-n+9)')[4].id is "testcase5"
+PASS document.querySelectorAll('#test-root :nth-child(-n+9)')[5].id is "testcase6"
+PASS document.querySelectorAll('#test-root :nth-child(-n+9)')[6].id is "testcase7"
+PASS document.querySelectorAll('#test-root :nth-child(-n+9)')[7].id is "testcase8"
+PASS document.querySelectorAll('#test-root :nth-child(-n+9)')[8].id is "testcase9"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(n+4):nth-child(-n+8)"
+PASS document.querySelectorAll('#test-root :nth-child(n+4):nth-child(-n+8)').length is 5
+PASS document.querySelectorAll('#test-root :nth-child(n+4):nth-child(-n+8)')[0].id is "testcase4"
+PASS document.querySelectorAll('#test-root :nth-child(n+4):nth-child(-n+8)')[1].id is "testcase5"
+PASS document.querySelectorAll('#test-root :nth-child(n+4):nth-child(-n+8)')[2].id is "testcase6"
+PASS document.querySelectorAll('#test-root :nth-child(n+4):nth-child(-n+8)')[3].id is "testcase7"
+PASS document.querySelectorAll('#test-root :nth-child(n+4):nth-child(-n+8)')[4].id is "testcase8"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(-n+8):nth-child(n+4)"
+PASS document.querySelectorAll('#test-root :nth-child(-n+8):nth-child(n+4)').length is 5
+PASS document.querySelectorAll('#test-root :nth-child(-n+8):nth-child(n+4)')[0].id is "testcase4"
+PASS document.querySelectorAll('#test-root :nth-child(-n+8):nth-child(n+4)')[1].id is "testcase5"
+PASS document.querySelectorAll('#test-root :nth-child(-n+8):nth-child(n+4)')[2].id is "testcase6"
+PASS document.querySelectorAll('#test-root :nth-child(-n+8):nth-child(n+4)')[3].id is "testcase7"
+PASS document.querySelectorAll('#test-root :nth-child(-n+8):nth-child(n+4)')[4].id is "testcase8"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(n+2):nth-child(odd):nth-child(-n+9)"
+PASS document.querySelectorAll('#test-root :nth-child(n+2):nth-child(odd):nth-child(-n+9)').length is 4
+PASS document.querySelectorAll('#test-root :nth-child(n+2):nth-child(odd):nth-child(-n+9)')[0].id is "testcase3"
+PASS document.querySelectorAll('#test-root :nth-child(n+2):nth-child(odd):nth-child(-n+9)')[1].id is "testcase5"
+PASS document.querySelectorAll('#test-root :nth-child(n+2):nth-child(odd):nth-child(-n+9)')[2].id is "testcase7"
+PASS document.querySelectorAll('#test-root :nth-child(n+2):nth-child(odd):nth-child(-n+9)')[3].id is "testcase9"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(3n+1):nth-child(even)"
+PASS document.querySelectorAll('#test-root :nth-child(3n+1):nth-child(even)').length is 2
+PASS document.querySelectorAll('#test-root :nth-child(3n+1):nth-child(even)')[0].id is "testcase4"
+PASS document.querySelectorAll('#test-root :nth-child(3n+1):nth-child(even)')[1].id is "testcase10"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(even):nth-child(3n+1)"
+PASS document.querySelectorAll('#test-root :nth-child(even):nth-child(3n+1)').length is 2
+PASS document.querySelectorAll('#test-root :nth-child(even):nth-child(3n+1)')[0].id is "testcase4"
+PASS document.querySelectorAll('#test-root :nth-child(even):nth-child(3n+1)')[1].id is "testcase10"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(3)"
+PASS document.querySelectorAll('#test-root :nth-child(3)').length is 1
+PASS document.querySelectorAll('#test-root :nth-child(3)')[0].id is "testcase3"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(4)"
+PASS document.querySelectorAll('#test-root :nth-child(4)').length is 1
+PASS document.querySelectorAll('#test-root :nth-child(4)')[0].id is "testcase4"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(3):nth-child(4)"
+PASS document.querySelectorAll('#test-root :nth-child(3):nth-child(4)').length is 0
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(4):nth-child(3)"
+PASS document.querySelectorAll('#test-root :nth-child(4):nth-child(3)').length is 0
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(n+3)"
+PASS document.querySelectorAll('#test-root :nth-child(n+3)').length is 9
+PASS document.querySelectorAll('#test-root :nth-child(n+3)')[0].id is "testcase3"
+PASS document.querySelectorAll('#test-root :nth-child(n+3)')[1].id is "testcase4"
+PASS document.querySelectorAll('#test-root :nth-child(n+3)')[2].id is "testcase5"
+PASS document.querySelectorAll('#test-root :nth-child(n+3)')[3].id is "testcase6"
+PASS document.querySelectorAll('#test-root :nth-child(n+3)')[4].id is "testcase7"
+PASS document.querySelectorAll('#test-root :nth-child(n+3)')[5].id is "testcase8"
+PASS document.querySelectorAll('#test-root :nth-child(n+3)')[6].id is "testcase9"
+PASS document.querySelectorAll('#test-root :nth-child(n+3)')[7].id is "testcase10"
+PASS document.querySelectorAll('#test-root :nth-child(n+3)')[8].id is "testcase11"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(10, 100, 200)"
+
+Testing ":nth-child(2n+2)"
+PASS document.querySelectorAll('#test-root :nth-child(2n+2)').length is 5
+PASS document.querySelectorAll('#test-root :nth-child(2n+2)')[0].id is "testcase2"
+PASS document.querySelectorAll('#test-root :nth-child(2n+2)')[1].id is "testcase4"
+PASS document.querySelectorAll('#test-root :nth-child(2n+2)')[2].id is "testcase6"
+PASS document.querySelectorAll('#test-root :nth-child(2n+2)')[3].id is "testcase8"
+PASS document.querySelectorAll('#test-root :nth-child(2n+2)')[4].id is "testcase10"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(n+3):nth-child(2n+2)"
+PASS document.querySelectorAll('#test-root :nth-child(n+3):nth-child(2n+2)').length is 4
+PASS document.querySelectorAll('#test-root :nth-child(n+3):nth-child(2n+2)')[0].id is "testcase4"
+PASS document.querySelectorAll('#test-root :nth-child(n+3):nth-child(2n+2)')[1].id is "testcase6"
+PASS document.querySelectorAll('#test-root :nth-child(n+3):nth-child(2n+2)')[2].id is "testcase8"
+PASS document.querySelectorAll('#test-root :nth-child(n+3):nth-child(2n+2)')[3].id is "testcase10"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(2n+2):nth-child(n+3)"
+PASS document.querySelectorAll('#test-root :nth-child(2n+2):nth-child(n+3)').length is 4
+PASS document.querySelectorAll('#test-root :nth-child(2n+2):nth-child(n+3)')[0].id is "testcase4"
+PASS document.querySelectorAll('#test-root :nth-child(2n+2):nth-child(n+3)')[1].id is "testcase6"
+PASS document.querySelectorAll('#test-root :nth-child(2n+2):nth-child(n+3)')[2].id is "testcase8"
+PASS document.querySelectorAll('#test-root :nth-child(2n+2):nth-child(n+3)')[3].id is "testcase10"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(-n+4)"
+PASS document.querySelectorAll('#test-root :nth-child(-n+4)').length is 4
+PASS document.querySelectorAll('#test-root :nth-child(-n+4)')[0].id is "testcase1"
+PASS document.querySelectorAll('#test-root :nth-child(-n+4)')[1].id is "testcase2"
+PASS document.querySelectorAll('#test-root :nth-child(-n+4)')[2].id is "testcase3"
+PASS document.querySelectorAll('#test-root :nth-child(-n+4)')[3].id is "testcase4"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(-n+5)"
+PASS document.querySelectorAll('#test-root :nth-child(-n+5)').length is 5
+PASS document.querySelectorAll('#test-root :nth-child(-n+5)')[0].id is "testcase1"
+PASS document.querySelectorAll('#test-root :nth-child(-n+5)')[1].id is "testcase2"
+PASS document.querySelectorAll('#test-root :nth-child(-n+5)')[2].id is "testcase3"
+PASS document.querySelectorAll('#test-root :nth-child(-n+5)')[3].id is "testcase4"
+PASS document.querySelectorAll('#test-root :nth-child(-n+5)')[4].id is "testcase5"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(-n+4):nth-child(-n+5)"
+PASS document.querySelectorAll('#test-root :nth-child(-n+4):nth-child(-n+5)').length is 4
+PASS document.querySelectorAll('#test-root :nth-child(-n+4):nth-child(-n+5)')[0].id is "testcase1"
+PASS document.querySelectorAll('#test-root :nth-child(-n+4):nth-child(-n+5)')[1].id is "testcase2"
+PASS document.querySelectorAll('#test-root :nth-child(-n+4):nth-child(-n+5)')[2].id is "testcase3"
+PASS document.querySelectorAll('#test-root :nth-child(-n+4):nth-child(-n+5)')[3].id is "testcase4"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(-n+5):nth-child(-n+4)"
+PASS document.querySelectorAll('#test-root :nth-child(-n+5):nth-child(-n+4)').length is 4
+PASS document.querySelectorAll('#test-root :nth-child(-n+5):nth-child(-n+4)')[0].id is "testcase1"
+PASS document.querySelectorAll('#test-root :nth-child(-n+5):nth-child(-n+4)')[1].id is "testcase2"
+PASS document.querySelectorAll('#test-root :nth-child(-n+5):nth-child(-n+4)')[2].id is "testcase3"
+PASS document.querySelectorAll('#test-root :nth-child(-n+5):nth-child(-n+4)')[3].id is "testcase4"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(n+3):nth-child(-n+6)"
+PASS document.querySelectorAll('#test-root :nth-child(n+3):nth-child(-n+6)').length is 4
+PASS document.querySelectorAll('#test-root :nth-child(n+3):nth-child(-n+6)')[0].id is "testcase3"
+PASS document.querySelectorAll('#test-root :nth-child(n+3):nth-child(-n+6)')[1].id is "testcase4"
+PASS document.querySelectorAll('#test-root :nth-child(n+3):nth-child(-n+6)')[2].id is "testcase5"
+PASS document.querySelectorAll('#test-root :nth-child(n+3):nth-child(-n+6)')[3].id is "testcase6"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(-n+6):nth-child(n+3)"
+PASS document.querySelectorAll('#test-root :nth-child(-n+6):nth-child(n+3)').length is 4
+PASS document.querySelectorAll('#test-root :nth-child(-n+6):nth-child(n+3)')[0].id is "testcase3"
+PASS document.querySelectorAll('#test-root :nth-child(-n+6):nth-child(n+3)')[1].id is "testcase4"
+PASS document.querySelectorAll('#test-root :nth-child(-n+6):nth-child(n+3)')[2].id is "testcase5"
+PASS document.querySelectorAll('#test-root :nth-child(-n+6):nth-child(n+3)')[3].id is "testcase6"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(n+1):nth-child(-n+3)"
+PASS document.querySelectorAll('#test-root :nth-child(n+1):nth-child(-n+3)').length is 3
+PASS document.querySelectorAll('#test-root :nth-child(n+1):nth-child(-n+3)')[0].id is "testcase1"
+PASS document.querySelectorAll('#test-root :nth-child(n+1):nth-child(-n+3)')[1].id is "testcase2"
+PASS document.querySelectorAll('#test-root :nth-child(n+1):nth-child(-n+3)')[2].id is "testcase3"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(-n+3):nth-child(n+1)"
+PASS document.querySelectorAll('#test-root :nth-child(-n+3):nth-child(n+1)').length is 3
+PASS document.querySelectorAll('#test-root :nth-child(-n+3):nth-child(n+1)')[0].id is "testcase1"
+PASS document.querySelectorAll('#test-root :nth-child(-n+3):nth-child(n+1)')[1].id is "testcase2"
+PASS document.querySelectorAll('#test-root :nth-child(-n+3):nth-child(n+1)')[2].id is "testcase3"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(n+3):nth-child(-n+6):nth-child(n+1):nth-child(-n+3)"
+PASS document.querySelectorAll('#test-root :nth-child(n+3):nth-child(-n+6):nth-child(n+1):nth-child(-n+3)').length is 1
+PASS document.querySelectorAll('#test-root :nth-child(n+3):nth-child(-n+6):nth-child(n+1):nth-child(-n+3)')[0].id is "testcase3"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(-n+6):nth-child(n+3):nth-child(-n+3):nth-child(n+1)"
+PASS document.querySelectorAll('#test-root :nth-child(-n+6):nth-child(n+3):nth-child(-n+3):nth-child(n+1)').length is 1
+PASS document.querySelectorAll('#test-root :nth-child(-n+6):nth-child(n+3):nth-child(-n+3):nth-child(n+1)')[0].id is "testcase3"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(n+3):nth-child(odd):nth-child(-n+6)"
+PASS document.querySelectorAll('#test-root :nth-child(n+3):nth-child(odd):nth-child(-n+6)').length is 2
+PASS document.querySelectorAll('#test-root :nth-child(n+3):nth-child(odd):nth-child(-n+6)')[0].id is "testcase3"
+PASS document.querySelectorAll('#test-root :nth-child(n+3):nth-child(odd):nth-child(-n+6)')[1].id is "testcase5"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(-n+6):nth-child(odd):nth-child(n+3)"
+PASS document.querySelectorAll('#test-root :nth-child(-n+6):nth-child(odd):nth-child(n+3)').length is 2
+PASS document.querySelectorAll('#test-root :nth-child(-n+6):nth-child(odd):nth-child(n+3)')[0].id is "testcase3"
+PASS document.querySelectorAll('#test-root :nth-child(-n+6):nth-child(odd):nth-child(n+3)')[1].id is "testcase5"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(odd):nth-child(n+3):nth-child(-n+6)"
+PASS document.querySelectorAll('#test-root :nth-child(odd):nth-child(n+3):nth-child(-n+6)').length is 2
+PASS document.querySelectorAll('#test-root :nth-child(odd):nth-child(n+3):nth-child(-n+6)')[0].id is "testcase3"
+PASS document.querySelectorAll('#test-root :nth-child(odd):nth-child(n+3):nth-child(-n+6)')[1].id is "testcase5"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(odd):nth-child(-n+6):nth-child(n+3)"
+PASS document.querySelectorAll('#test-root :nth-child(odd):nth-child(-n+6):nth-child(n+3)').length is 2
+PASS document.querySelectorAll('#test-root :nth-child(odd):nth-child(-n+6):nth-child(n+3)')[0].id is "testcase3"
+PASS document.querySelectorAll('#test-root :nth-child(odd):nth-child(-n+6):nth-child(n+3)')[1].id is "testcase5"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(n+3):nth-child(-n+6):nth-child(odd)"
+PASS document.querySelectorAll('#test-root :nth-child(n+3):nth-child(-n+6):nth-child(odd)').length is 2
+PASS document.querySelectorAll('#test-root :nth-child(n+3):nth-child(-n+6):nth-child(odd)')[0].id is "testcase3"
+PASS document.querySelectorAll('#test-root :nth-child(n+3):nth-child(-n+6):nth-child(odd)')[1].id is "testcase5"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(-n+6):nth-child(n+3):nth-child(odd)"
+PASS document.querySelectorAll('#test-root :nth-child(-n+6):nth-child(n+3):nth-child(odd)').length is 2
+PASS document.querySelectorAll('#test-root :nth-child(-n+6):nth-child(n+3):nth-child(odd)')[0].id is "testcase3"
+PASS document.querySelectorAll('#test-root :nth-child(-n+6):nth-child(n+3):nth-child(odd)')[1].id is "testcase5"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(n+1):nth-child(even):nth-child(-n+3)"
+PASS document.querySelectorAll('#test-root :nth-child(n+1):nth-child(even):nth-child(-n+3)').length is 1
+PASS document.querySelectorAll('#test-root :nth-child(n+1):nth-child(even):nth-child(-n+3)')[0].id is "testcase2"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(-n+3):nth-child(even):nth-child(n+1)"
+PASS document.querySelectorAll('#test-root :nth-child(-n+3):nth-child(even):nth-child(n+1)').length is 1
+PASS document.querySelectorAll('#test-root :nth-child(-n+3):nth-child(even):nth-child(n+1)')[0].id is "testcase2"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(even):nth-child(n+1):nth-child(-n+3)"
+PASS document.querySelectorAll('#test-root :nth-child(even):nth-child(n+1):nth-child(-n+3)').length is 1
+PASS document.querySelectorAll('#test-root :nth-child(even):nth-child(n+1):nth-child(-n+3)')[0].id is "testcase2"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(even):nth-child(-n+3):nth-child(n+1)"
+PASS document.querySelectorAll('#test-root :nth-child(even):nth-child(-n+3):nth-child(n+1)').length is 1
+PASS document.querySelectorAll('#test-root :nth-child(even):nth-child(-n+3):nth-child(n+1)')[0].id is "testcase2"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(-n+3):nth-child(n+1):nth-child(even)"
+PASS document.querySelectorAll('#test-root :nth-child(-n+3):nth-child(n+1):nth-child(even)').length is 1
+PASS document.querySelectorAll('#test-root :nth-child(-n+3):nth-child(n+1):nth-child(even)')[0].id is "testcase2"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(n+1):nth-child(-n+3):nth-child(even)"
+PASS document.querySelectorAll('#test-root :nth-child(n+1):nth-child(-n+3):nth-child(even)').length is 1
+PASS document.querySelectorAll('#test-root :nth-child(n+1):nth-child(-n+3):nth-child(even)')[0].id is "testcase2"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(n+3):nth-child(odd):nth-child(-n+6):nth-child(n+1):nth-child(-n+3):nth-child(even)"
+PASS document.querySelectorAll('#test-root :nth-child(n+3):nth-child(odd):nth-child(-n+6):nth-child(n+1):nth-child(-n+3):nth-child(even)').length is 0
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastselectorsnthchildbasicshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/selectors/nth-child-basics.html (0 => 174035)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/selectors/nth-child-basics.html         (rev 0)
+++ trunk/LayoutTests/fast/selectors/nth-child-basics.html        2014-09-27 18:49:12 UTC (rev 174035)
</span><span class="lines">@@ -0,0 +1,107 @@
</span><ins>+<!doctype html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<style>
+#test-root * {
+ background-color: red;
+}
+</style>
+<style id="style">
+</style>
+</head>
+<body>
+ <div style="display:none" id="test-root">
+ <testcase id="testcase1"></testcase>
+ <testcase id="testcase2"></testcase>
+ <testcase id="testcase3"></testcase>
+ <testcase id="testcase4"></testcase>
+ <testcase id="testcase5"></testcase>
+ <testcase id="testcase6"></testcase>
+ <testcase id="testcase7"></testcase>
+ <testcase id="testcase8"></testcase>
+ <testcase id="testcase9"></testcase>
+ <testcase id="testcase10"></testcase>
+ <testcase id="testcase11"></testcase>
+ </div>
+</body>
+<script>
+description('Test basic uses cases of :nth-child().');
+
+function testQuerySelector(selector, expectedIds) {
+ shouldBe("document.querySelectorAll('" + selector + "').length", '' + expectedIds.length);
+ for (var i = 0; i < expectedIds.length; ++i)
+ shouldBeEqualToString("document.querySelectorAll('" + selector + "')[" + i + "].id", expectedIds[i]);
+}
+
+function testStyling(selector, expectedIds) {
+ var stylingElement = document.getElementById("style");
+ stylingElement.innerHTML = '' + selector + ' { background-color: rgb(10, 100, 200); }';
+
+ var allTestCases = document.querySelectorAll("#test-root *");
+ for (var i = 0; i < allTestCases.length; ++i) {
+ var expectMatch = expectedIds.indexOf(allTestCases[i].id) >= 0;
+ shouldBeEqualToString('getComputedStyle(document.querySelectorAll("#test-root *")[' + i + ']).backgroundColor', expectMatch ? 'rgb(10, 100, 200)' : 'rgb(255, 0, 0)');
+ }
+
+ stylingElement.innerHTML = '';
+}
+
+function testSelector(selector, expectedIds) {
+ debug("Testing \"" + selector + "\"");
+ testQuerySelector("#test-root " + selector, expectedIds);
+ testStyling("#test-root " + selector, expectedIds);
+ debug("");
+}
+
+// Test cases presented on http://nthmaster.com/ to have a simple baseline.
+testSelector(":nth-child(8)", ["testcase8"]);
+testSelector(":nth-child(n+6)", ["testcase6", "testcase7", "testcase8", "testcase9", "testcase10", "testcase11"]);
+testSelector(":nth-child(-n+9)", ["testcase1", "testcase2", "testcase3", "testcase4", "testcase5", "testcase6", "testcase7", "testcase8", "testcase9"]);
+testSelector(":nth-child(n+4):nth-child(-n+8)", ["testcase4", "testcase5", "testcase6", "testcase7", "testcase8"]);
+testSelector(":nth-child(-n+8):nth-child(n+4)", ["testcase4", "testcase5", "testcase6", "testcase7", "testcase8"]);
+testSelector(":nth-child(n+2):nth-child(odd):nth-child(-n+9)", ["testcase3", "testcase5", "testcase7", "testcase9"]);
+testSelector(":nth-child(3n+1):nth-child(even)", ["testcase4", "testcase10"]);
+testSelector(":nth-child(even):nth-child(3n+1)", ["testcase4", "testcase10"]);
+
+// The following was using :nth-child() on http://nthmaster.com/. It is adapted here for completness.
+testSelector(":nth-child(3)", ["testcase3"]);
+testSelector(":nth-child(4)", ["testcase4"]);
+testSelector(":nth-child(3):nth-child(4)", []);
+testSelector(":nth-child(4):nth-child(3)", []);
+
+testSelector(":nth-child(n+3)", ["testcase3", "testcase4", "testcase5", "testcase6", "testcase7", "testcase8", "testcase9", "testcase10", "testcase11"]);
+testSelector(":nth-child(2n+2)", ["testcase2", "testcase4", "testcase6", "testcase8", "testcase10"]);
+testSelector(":nth-child(n+3):nth-child(2n+2)", ["testcase4", "testcase6", "testcase8", "testcase10"]);
+testSelector(":nth-child(2n+2):nth-child(n+3)", ["testcase4", "testcase6", "testcase8", "testcase10"]);
+
+testSelector(":nth-child(-n+4)", ["testcase1", "testcase2", "testcase3", "testcase4"]);
+testSelector(":nth-child(-n+5)", ["testcase1", "testcase2", "testcase3", "testcase4", "testcase5"]);
+testSelector(":nth-child(-n+4):nth-child(-n+5)", ["testcase1", "testcase2", "testcase3", "testcase4"]);
+testSelector(":nth-child(-n+5):nth-child(-n+4)", ["testcase1", "testcase2", "testcase3", "testcase4"]);
+
+testSelector(":nth-child(n+3):nth-child(-n+6)", ["testcase3", "testcase4", "testcase5", "testcase6"]);
+testSelector(":nth-child(-n+6):nth-child(n+3)", ["testcase3", "testcase4", "testcase5", "testcase6"]);
+testSelector(":nth-child(n+1):nth-child(-n+3)", ["testcase1", "testcase2", "testcase3"]);
+testSelector(":nth-child(-n+3):nth-child(n+1)", ["testcase1", "testcase2", "testcase3"]);
+testSelector(":nth-child(n+3):nth-child(-n+6):nth-child(n+1):nth-child(-n+3)", ["testcase3"]);
+testSelector(":nth-child(-n+6):nth-child(n+3):nth-child(-n+3):nth-child(n+1)", ["testcase3"]);
+
+testSelector(":nth-child(n+3):nth-child(odd):nth-child(-n+6)", ["testcase3", "testcase5"]);
+testSelector(":nth-child(-n+6):nth-child(odd):nth-child(n+3)", ["testcase3", "testcase5"]);
+testSelector(":nth-child(odd):nth-child(n+3):nth-child(-n+6)", ["testcase3", "testcase5"]);
+testSelector(":nth-child(odd):nth-child(-n+6):nth-child(n+3)", ["testcase3", "testcase5"]);
+testSelector(":nth-child(n+3):nth-child(-n+6):nth-child(odd)", ["testcase3", "testcase5"]);
+testSelector(":nth-child(-n+6):nth-child(n+3):nth-child(odd)", ["testcase3", "testcase5"]);
+
+testSelector(":nth-child(n+1):nth-child(even):nth-child(-n+3)", ["testcase2"]);
+testSelector(":nth-child(-n+3):nth-child(even):nth-child(n+1)", ["testcase2"]);
+testSelector(":nth-child(even):nth-child(n+1):nth-child(-n+3)", ["testcase2"]);
+testSelector(":nth-child(even):nth-child(-n+3):nth-child(n+1)", ["testcase2"]);
+testSelector(":nth-child(-n+3):nth-child(n+1):nth-child(even)", ["testcase2"]);
+testSelector(":nth-child(n+1):nth-child(-n+3):nth-child(even)", ["testcase2"]);
+
+testSelector(":nth-child(n+3):nth-child(odd):nth-child(-n+6):nth-child(n+1):nth-child(-n+3):nth-child(even)", []);
+</script>
+<script src="../../resources/js-test-post.js"></script>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastselectorsnthchildchainedexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/selectors/nth-child-chained-expected.txt (0 => 174035)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/selectors/nth-child-chained-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/selectors/nth-child-chained-expected.txt        2014-09-27 18:49:12 UTC (rev 174035)
</span><span class="lines">@@ -0,0 +1,184 @@
</span><ins>+Test chaining many :nth-child() selectors. This verifies register allocation is correct.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Testing ":nth-child(-n+21):nth-child(odd):nth-child(-2n+21):nth-child(3n+1):nth-child(-3n+22):nth-child(4n+1):nth-child(-5n+51)"
+PASS document.querySelectorAll('testcase:nth-child(-n+21):nth-child(odd):nth-child(-2n+21):nth-child(3n+1):nth-child(-3n+22):nth-child(4n+1):nth-child(-5n+51)').length is 1
+PASS document.querySelectorAll('testcase:nth-child(-n+21):nth-child(odd):nth-child(-2n+21):nth-child(3n+1):nth-child(-3n+22):nth-child(4n+1):nth-child(-5n+51)')[0].id is "testcase1"
+PASS getComputedStyle(document.querySelectorAll("testcase")[0]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[10]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[11]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[12]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[13]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[14]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[15]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[16]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[17]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[18]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[19]).backgroundColor is "rgb(255, 0, 0)"
+PASS document.querySelectorAll('div>testcase:nth-child(-n+21):nth-child(odd):nth-child(-2n+21):nth-child(3n+1):nth-child(-3n+22):nth-child(4n+1):nth-child(-5n+51)>div>div>div span').length is 1
+
+Testing ":nth-child(2n-200):nth-child(3n-1):nth-child(4n-38):nth-child(5n-98)"
+PASS document.querySelectorAll('testcase:nth-child(2n-200):nth-child(3n-1):nth-child(4n-38):nth-child(5n-98)').length is 1
+PASS document.querySelectorAll('testcase:nth-child(2n-200):nth-child(3n-1):nth-child(4n-38):nth-child(5n-98)')[0].id is "testcase2"
+PASS getComputedStyle(document.querySelectorAll("testcase")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[1]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[10]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[11]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[12]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[13]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[14]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[15]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[16]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[17]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[18]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[19]).backgroundColor is "rgb(255, 0, 0)"
+PASS document.querySelectorAll('div>testcase:nth-child(2n-200):nth-child(3n-1):nth-child(4n-38):nth-child(5n-98)>div>div>div span').length is 1
+
+Testing ":nth-child(even):nth-child(3n):nth-child(4n-2):nth-child(5n+1)"
+PASS document.querySelectorAll('testcase:nth-child(even):nth-child(3n):nth-child(4n-2):nth-child(5n+1)').length is 1
+PASS document.querySelectorAll('testcase:nth-child(even):nth-child(3n):nth-child(4n-2):nth-child(5n+1)')[0].id is "testcase6"
+PASS getComputedStyle(document.querySelectorAll("testcase")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[5]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[10]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[11]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[12]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[13]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[14]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[15]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[16]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[17]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[18]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[19]).backgroundColor is "rgb(255, 0, 0)"
+PASS document.querySelectorAll('div>testcase:nth-child(even):nth-child(3n):nth-child(4n-2):nth-child(5n+1)>div>div>div span').length is 1
+
+Testing ":nth-child(-n+9000):nth-child(-2n+683):nth-child(-3n+31):nth-child(-4n+47):nth-child(-5n+107):nth-child(-6n+73):nth-child(-7n+70)"
+PASS document.querySelectorAll('testcase:nth-child(-n+9000):nth-child(-2n+683):nth-child(-3n+31):nth-child(-4n+47):nth-child(-5n+107):nth-child(-6n+73):nth-child(-7n+70)').length is 1
+PASS document.querySelectorAll('testcase:nth-child(-n+9000):nth-child(-2n+683):nth-child(-3n+31):nth-child(-4n+47):nth-child(-5n+107):nth-child(-6n+73):nth-child(-7n+70)')[0].id is "testcase7"
+PASS getComputedStyle(document.querySelectorAll("testcase")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[6]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[10]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[11]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[12]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[13]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[14]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[15]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[16]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[17]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[18]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[19]).backgroundColor is "rgb(255, 0, 0)"
+PASS document.querySelectorAll('div>testcase:nth-child(-n+9000):nth-child(-2n+683):nth-child(-3n+31):nth-child(-4n+47):nth-child(-5n+107):nth-child(-6n+73):nth-child(-7n+70)>div>div>div span').length is 1
+
+Testing ":nth-child(odd):nth-child(3n+1):nth-child(4n-1):nth-child(5n+4)"
+PASS document.querySelectorAll('testcase:nth-child(odd):nth-child(3n+1):nth-child(4n-1):nth-child(5n+4)').length is 1
+PASS document.querySelectorAll('testcase:nth-child(odd):nth-child(3n+1):nth-child(4n-1):nth-child(5n+4)')[0].id is "testcase19"
+PASS getComputedStyle(document.querySelectorAll("testcase")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[10]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[11]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[12]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[13]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[14]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[15]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[16]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[17]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[18]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[19]).backgroundColor is "rgb(255, 0, 0)"
+PASS document.querySelectorAll('div>testcase:nth-child(odd):nth-child(3n+1):nth-child(4n-1):nth-child(5n+4)>div>div>div span').length is 1
+
+Testing ":nth-child(-n+1500):nth-child(2n+1):nth-child(-3n+45):nth-child(4n+3):nth-child(-5n+1545)"
+PASS document.querySelectorAll('testcase:nth-child(-n+1500):nth-child(2n+1):nth-child(-3n+45):nth-child(4n+3):nth-child(-5n+1545)').length is 1
+PASS document.querySelectorAll('testcase:nth-child(-n+1500):nth-child(2n+1):nth-child(-3n+45):nth-child(4n+3):nth-child(-5n+1545)')[0].id is "testcase15"
+PASS getComputedStyle(document.querySelectorAll("testcase")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[10]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[11]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[12]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[13]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[14]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[15]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[16]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[17]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[18]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[19]).backgroundColor is "rgb(255, 0, 0)"
+PASS document.querySelectorAll('div>testcase:nth-child(-n+1500):nth-child(2n+1):nth-child(-3n+45):nth-child(4n+3):nth-child(-5n+1545)>div>div>div span').length is 1
+
+Testing ":nth-child(n+2):nth-child(-n+6000):nth-child(n-2):nth-child(2n):nth-child(-2n+20):nth-child(2n+2):nth-child(3n+1):nth-child(-3n+49):nth-child(3n-92):nth-child(4n+2):nth-child(-4n+50)"
+PASS document.querySelectorAll('testcase:nth-child(n+2):nth-child(-n+6000):nth-child(n-2):nth-child(2n):nth-child(-2n+20):nth-child(2n+2):nth-child(3n+1):nth-child(-3n+49):nth-child(3n-92):nth-child(4n+2):nth-child(-4n+50)').length is 1
+PASS document.querySelectorAll('testcase:nth-child(n+2):nth-child(-n+6000):nth-child(n-2):nth-child(2n):nth-child(-2n+20):nth-child(2n+2):nth-child(3n+1):nth-child(-3n+49):nth-child(3n-92):nth-child(4n+2):nth-child(-4n+50)')[0].id is "testcase10"
+PASS getComputedStyle(document.querySelectorAll("testcase")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[9]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[10]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[11]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[12]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[13]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[14]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[15]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[16]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[17]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[18]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[19]).backgroundColor is "rgb(255, 0, 0)"
+PASS document.querySelectorAll('div>testcase:nth-child(n+2):nth-child(-n+6000):nth-child(n-2):nth-child(2n):nth-child(-2n+20):nth-child(2n+2):nth-child(3n+1):nth-child(-3n+49):nth-child(3n-92):nth-child(4n+2):nth-child(-4n+50)>div>div>div span').length is 1
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastselectorsnthchildchainedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/selectors/nth-child-chained.html (0 => 174035)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/selectors/nth-child-chained.html         (rev 0)
+++ trunk/LayoutTests/fast/selectors/nth-child-chained.html        2014-09-27 18:49:12 UTC (rev 174035)
</span><span class="lines">@@ -0,0 +1,94 @@
</span><ins>+<!doctype html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<style>
+testcase {
+ background-color: red;
+}
+</style>
+<style id="style">
+</style>
+</head>
+<body>
+ <div style="display:none">
+ <testcase id="testcase1"><div><div><div><div><div><div><div><div><span></span></div></div></div></div></div></div></div></div></testcase>
+ <testcase id="testcase2"><div><div><div><div><div><div><div><div><span></span></div></div></div></div></div></div></div></div></testcase>
+ <testcase id="testcase3"><div><div><div><div><div><div><div><div><span></span></div></div></div></div></div></div></div></div></testcase>
+ <testcase id="testcase4"><div><div><div><div><div><div><div><div><span></span></div></div></div></div></div></div></div></div></testcase>
+ <testcase id="testcase5"><div><div><div><div><div><div><div><div><span></span></div></div></div></div></div></div></div></div></testcase>
+ <testcase id="testcase6"><div><div><div><div><div><div><div><div><span></span></div></div></div></div></div></div></div></div></testcase>
+ <testcase id="testcase7"><div><div><div><div><div><div><div><div><span></span></div></div></div></div></div></div></div></div></testcase>
+ <testcase id="testcase8"><div><div><div><div><div><div><div><div><span></span></div></div></div></div></div></div></div></div></testcase>
+ <testcase id="testcase9"><div><div><div><div><div><div><div><div><span></span></div></div></div></div></div></div></div></div></testcase>
+ <testcase id="testcase10"><div><div><div><div><div><div><div><div><span></span></div></div></div></div></div></div></div></div></testcase>
+ <testcase id="testcase11"><div><div><div><div><div><div><div><div><span></span></div></div></div></div></div></div></div></div></testcase>
+ <testcase id="testcase12"><div><div><div><div><div><div><div><div><span></span></div></div></div></div></div></div></div></div></testcase>
+ <testcase id="testcase13"><div><div><div><div><div><div><div><div><span></span></div></div></div></div></div></div></div></div></testcase>
+ <testcase id="testcase14"><div><div><div><div><div><div><div><div><span></span></div></div></div></div></div></div></div></div></testcase>
+ <testcase id="testcase15"><div><div><div><div><div><div><div><div><span></span></div></div></div></div></div></div></div></div></testcase>
+ <testcase id="testcase16"><div><div><div><div><div><div><div><div><span></span></div></div></div></div></div></div></div></div></testcase>
+ <testcase id="testcase17"><div><div><div><div><div><div><div><div><span></span></div></div></div></div></div></div></div></div></testcase>
+ <testcase id="testcase18"><div><div><div><div><div><div><div><div><span></span></div></div></div></div></div></div></div></div></testcase>
+ <testcase id="testcase19"><div><div><div><div><div><div><div><div><span></span></div></div></div></div></div></div></div></div></testcase>
+ <testcase id="testcase20"><div><div><div><div><div><div><div><div><span></span></div></div></div></div></div></div></div></div></testcase>
+ </div>
+</body>
+<script>
+description('Test chaining many :nth-child() selectors. This verifies register allocation is correct.');
+
+function testQuerySelector(selector, expectedIds) {
+ shouldBe("document.querySelectorAll('" + selector + "').length", '' + expectedIds.length);
+ for (var i = 0; i < expectedIds.length; ++i)
+ shouldBeEqualToString("document.querySelectorAll('" + selector + "')[" + i + "].id", expectedIds[i]);
+}
+
+function testStyling(selector, expectedIds) {
+ var stylingElement = document.getElementById("style");
+ stylingElement.innerHTML = '' + selector + ' { background-color: rgb(10, 100, 200); }';
+
+ var allTestCases = document.querySelectorAll("testcase");
+ for (var i = 0; i < allTestCases.length; ++i) {
+ var expectMatch = expectedIds.indexOf(allTestCases[i].id) >= 0;
+ shouldBeEqualToString('getComputedStyle(document.querySelectorAll("testcase")[' + i + ']).backgroundColor', expectMatch ? 'rgb(10, 100, 200)' : 'rgb(255, 0, 0)');
+ }
+
+ stylingElement.innerHTML = '';
+}
+
+function testSelector(selector, expectedIds) {
+ debug("Testing \"" + selector + "\"");
+ testQuerySelector("testcase" + selector, expectedIds);
+ testStyling("testcase" + selector, expectedIds);
+
+ // Test the same request with a backtracking register.
+ shouldBe("document.querySelectorAll('div>testcase" + selector + ">div>div>div span').length", '' + expectedIds.length);
+
+ debug("");
+}
+
+// The :nth-child() should not completely overlap to ensure all of them are executed.
+
+// All positive B.
+testSelector(":nth-child(-n+21):nth-child(odd):nth-child(-2n+21):nth-child(3n+1):nth-child(-3n+22):nth-child(4n+1):nth-child(-5n+51)", ["testcase1"]);
+
+// All negative B.
+testSelector(":nth-child(2n-200):nth-child(3n-1):nth-child(4n-38):nth-child(5n-98)", ["testcase2"]);
+
+// All positive A.
+testSelector(":nth-child(even):nth-child(3n):nth-child(4n-2):nth-child(5n+1)", ["testcase6"]);
+
+// All negative A.
+testSelector(":nth-child(-n+9000):nth-child(-2n+683):nth-child(-3n+31):nth-child(-4n+47):nth-child(-5n+107):nth-child(-6n+73):nth-child(-7n+70)", ["testcase7"]);
+
+// Positive and Negative B.
+testSelector(":nth-child(odd):nth-child(3n+1):nth-child(4n-1):nth-child(5n+4)", ["testcase19"]);
+
+// Positive and Negative A.
+testSelector(":nth-child(-n+1500):nth-child(2n+1):nth-child(-3n+45):nth-child(4n+3):nth-child(-5n+1545)", ["testcase15"]);
+
+// Everything.
+testSelector(":nth-child(n+2):nth-child(-n+6000):nth-child(n-2):nth-child(2n):nth-child(-2n+20):nth-child(2n+2):nth-child(3n+1):nth-child(-3n+49):nth-child(3n-92):nth-child(4n+2):nth-child(-4n+50)", ["testcase10"]);
+</script>
+<script src="../../resources/js-test-post.js"></script>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastselectorsnthchildofbasics2expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/selectors/nth-child-of-basics-2-expected.txt (0 => 174035)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/selectors/nth-child-of-basics-2-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/selectors/nth-child-of-basics-2-expected.txt        2014-09-27 18:49:12 UTC (rev 174035)
</span><span class="lines">@@ -0,0 +1,906 @@
</span><ins>+Check the basic features of the ":nth-child(An+B of selectorList)" pseudo class.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Testing ":nth-child(8 of [class], [id])"
+PASS document.querySelectorAll('#test-root :nth-child(8 of [class], [id])').length is 1
+PASS document.querySelectorAll('#test-root :nth-child(8 of [class], [id])')[0].id is "testcase8"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[11]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[12]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[13]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[14]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[15]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[16]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[17]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[18]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[19]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[20]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[21]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[22]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[23]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[24]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[25]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[26]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[27]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[28]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[29]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(n+6 of [class], [id])"
+PASS document.querySelectorAll('#test-root :nth-child(n+6 of [class], [id])').length is 25
+PASS document.querySelectorAll('#test-root :nth-child(n+6 of [class], [id])')[0].id is "testcase6"
+PASS document.querySelectorAll('#test-root :nth-child(n+6 of [class], [id])')[1].id is "testcase7"
+PASS document.querySelectorAll('#test-root :nth-child(n+6 of [class], [id])')[2].id is "testcase8"
+PASS document.querySelectorAll('#test-root :nth-child(n+6 of [class], [id])')[3].id is "testcase9"
+PASS document.querySelectorAll('#test-root :nth-child(n+6 of [class], [id])')[4].id is "testcase10"
+PASS document.querySelectorAll('#test-root :nth-child(n+6 of [class], [id])')[5].id is "testcase11"
+PASS document.querySelectorAll('#test-root :nth-child(n+6 of [class], [id])')[6].id is "testcase12"
+PASS document.querySelectorAll('#test-root :nth-child(n+6 of [class], [id])')[7].id is "testcase13"
+PASS document.querySelectorAll('#test-root :nth-child(n+6 of [class], [id])')[8].id is "testcase14"
+PASS document.querySelectorAll('#test-root :nth-child(n+6 of [class], [id])')[9].id is "testcase15"
+PASS document.querySelectorAll('#test-root :nth-child(n+6 of [class], [id])')[10].id is "testcase16"
+PASS document.querySelectorAll('#test-root :nth-child(n+6 of [class], [id])')[11].id is "testcase17"
+PASS document.querySelectorAll('#test-root :nth-child(n+6 of [class], [id])')[12].id is "testcase18"
+PASS document.querySelectorAll('#test-root :nth-child(n+6 of [class], [id])')[13].id is "testcase19"
+PASS document.querySelectorAll('#test-root :nth-child(n+6 of [class], [id])')[14].id is "testcase20"
+PASS document.querySelectorAll('#test-root :nth-child(n+6 of [class], [id])')[15].id is "testcase21"
+PASS document.querySelectorAll('#test-root :nth-child(n+6 of [class], [id])')[16].id is "testcase22"
+PASS document.querySelectorAll('#test-root :nth-child(n+6 of [class], [id])')[17].id is "testcase23"
+PASS document.querySelectorAll('#test-root :nth-child(n+6 of [class], [id])')[18].id is "testcase24"
+PASS document.querySelectorAll('#test-root :nth-child(n+6 of [class], [id])')[19].id is "testcase25"
+PASS document.querySelectorAll('#test-root :nth-child(n+6 of [class], [id])')[20].id is "testcase26"
+PASS document.querySelectorAll('#test-root :nth-child(n+6 of [class], [id])')[21].id is "testcase27"
+PASS document.querySelectorAll('#test-root :nth-child(n+6 of [class], [id])')[22].id is "testcase28"
+PASS document.querySelectorAll('#test-root :nth-child(n+6 of [class], [id])')[23].id is "testcase29"
+PASS document.querySelectorAll('#test-root :nth-child(n+6 of [class], [id])')[24].id is "testcase30"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[11]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[12]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[13]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[14]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[15]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[16]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[17]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[18]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[19]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[20]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[21]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[22]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[23]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[24]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[25]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[26]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[27]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[28]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[29]).backgroundColor is "rgb(10, 100, 200)"
+
+Testing ":nth-child(-n+9 of [class], [id])"
+PASS document.querySelectorAll('#test-root :nth-child(-n+9 of [class], [id])').length is 9
+PASS document.querySelectorAll('#test-root :nth-child(-n+9 of [class], [id])')[0].id is "testcase1"
+PASS document.querySelectorAll('#test-root :nth-child(-n+9 of [class], [id])')[1].id is "testcase2"
+PASS document.querySelectorAll('#test-root :nth-child(-n+9 of [class], [id])')[2].id is "testcase3"
+PASS document.querySelectorAll('#test-root :nth-child(-n+9 of [class], [id])')[3].id is "testcase4"
+PASS document.querySelectorAll('#test-root :nth-child(-n+9 of [class], [id])')[4].id is "testcase5"
+PASS document.querySelectorAll('#test-root :nth-child(-n+9 of [class], [id])')[5].id is "testcase6"
+PASS document.querySelectorAll('#test-root :nth-child(-n+9 of [class], [id])')[6].id is "testcase7"
+PASS document.querySelectorAll('#test-root :nth-child(-n+9 of [class], [id])')[7].id is "testcase8"
+PASS document.querySelectorAll('#test-root :nth-child(-n+9 of [class], [id])')[8].id is "testcase9"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[11]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[12]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[13]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[14]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[15]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[16]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[17]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[18]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[19]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[20]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[21]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[22]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[23]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[24]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[25]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[26]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[27]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[28]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[29]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(n+4 of [class], [id]):nth-child(-n+8 of [class])"
+PASS document.querySelectorAll('#test-root :nth-child(n+4 of [class], [id]):nth-child(-n+8 of [class])').length is 5
+PASS document.querySelectorAll('#test-root :nth-child(n+4 of [class], [id]):nth-child(-n+8 of [class])')[0].id is "testcase4"
+PASS document.querySelectorAll('#test-root :nth-child(n+4 of [class], [id]):nth-child(-n+8 of [class])')[1].id is "testcase5"
+PASS document.querySelectorAll('#test-root :nth-child(n+4 of [class], [id]):nth-child(-n+8 of [class])')[2].id is "testcase6"
+PASS document.querySelectorAll('#test-root :nth-child(n+4 of [class], [id]):nth-child(-n+8 of [class])')[3].id is "testcase7"
+PASS document.querySelectorAll('#test-root :nth-child(n+4 of [class], [id]):nth-child(-n+8 of [class])')[4].id is "testcase8"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[11]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[12]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[13]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[14]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[15]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[16]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[17]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[18]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[19]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[20]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[21]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[22]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[23]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[24]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[25]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[26]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[27]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[28]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[29]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(-n+8 of [class], [id]):nth-child(n+4 of [class])"
+PASS document.querySelectorAll('#test-root :nth-child(-n+8 of [class], [id]):nth-child(n+4 of [class])').length is 5
+PASS document.querySelectorAll('#test-root :nth-child(-n+8 of [class], [id]):nth-child(n+4 of [class])')[0].id is "testcase4"
+PASS document.querySelectorAll('#test-root :nth-child(-n+8 of [class], [id]):nth-child(n+4 of [class])')[1].id is "testcase5"
+PASS document.querySelectorAll('#test-root :nth-child(-n+8 of [class], [id]):nth-child(n+4 of [class])')[2].id is "testcase6"
+PASS document.querySelectorAll('#test-root :nth-child(-n+8 of [class], [id]):nth-child(n+4 of [class])')[3].id is "testcase7"
+PASS document.querySelectorAll('#test-root :nth-child(-n+8 of [class], [id]):nth-child(n+4 of [class])')[4].id is "testcase8"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[11]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[12]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[13]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[14]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[15]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[16]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[17]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[18]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[19]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[20]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[21]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[22]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[23]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[24]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[25]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[26]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[27]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[28]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[29]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(n+2 of [class], [id]):nth-child(odd of [class]):nth-child(-n+9 of [class])"
+PASS document.querySelectorAll('#test-root :nth-child(n+2 of [class], [id]):nth-child(odd of [class]):nth-child(-n+9 of [class])').length is 4
+PASS document.querySelectorAll('#test-root :nth-child(n+2 of [class], [id]):nth-child(odd of [class]):nth-child(-n+9 of [class])')[0].id is "testcase3"
+PASS document.querySelectorAll('#test-root :nth-child(n+2 of [class], [id]):nth-child(odd of [class]):nth-child(-n+9 of [class])')[1].id is "testcase5"
+PASS document.querySelectorAll('#test-root :nth-child(n+2 of [class], [id]):nth-child(odd of [class]):nth-child(-n+9 of [class])')[2].id is "testcase7"
+PASS document.querySelectorAll('#test-root :nth-child(n+2 of [class], [id]):nth-child(odd of [class]):nth-child(-n+9 of [class])')[3].id is "testcase9"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[11]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[12]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[13]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[14]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[15]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[16]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[17]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[18]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[19]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[20]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[21]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[22]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[23]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[24]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[25]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[26]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[27]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[28]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[29]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(3n+1 of [class], [id]):nth-child(even of [class])"
+PASS document.querySelectorAll('#test-root :nth-child(3n+1 of [class], [id]):nth-child(even of [class])').length is 5
+PASS document.querySelectorAll('#test-root :nth-child(3n+1 of [class], [id]):nth-child(even of [class])')[0].id is "testcase4"
+PASS document.querySelectorAll('#test-root :nth-child(3n+1 of [class], [id]):nth-child(even of [class])')[1].id is "testcase10"
+PASS document.querySelectorAll('#test-root :nth-child(3n+1 of [class], [id]):nth-child(even of [class])')[2].id is "testcase16"
+PASS document.querySelectorAll('#test-root :nth-child(3n+1 of [class], [id]):nth-child(even of [class])')[3].id is "testcase22"
+PASS document.querySelectorAll('#test-root :nth-child(3n+1 of [class], [id]):nth-child(even of [class])')[4].id is "testcase28"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[11]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[12]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[13]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[14]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[15]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[16]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[17]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[18]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[19]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[20]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[21]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[22]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[23]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[24]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[25]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[26]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[27]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[28]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[29]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(even of [class], [id]):nth-child(3n+1 of [class])"
+PASS document.querySelectorAll('#test-root :nth-child(even of [class], [id]):nth-child(3n+1 of [class])').length is 5
+PASS document.querySelectorAll('#test-root :nth-child(even of [class], [id]):nth-child(3n+1 of [class])')[0].id is "testcase4"
+PASS document.querySelectorAll('#test-root :nth-child(even of [class], [id]):nth-child(3n+1 of [class])')[1].id is "testcase10"
+PASS document.querySelectorAll('#test-root :nth-child(even of [class], [id]):nth-child(3n+1 of [class])')[2].id is "testcase16"
+PASS document.querySelectorAll('#test-root :nth-child(even of [class], [id]):nth-child(3n+1 of [class])')[3].id is "testcase22"
+PASS document.querySelectorAll('#test-root :nth-child(even of [class], [id]):nth-child(3n+1 of [class])')[4].id is "testcase28"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[11]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[12]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[13]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[14]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[15]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[16]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[17]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[18]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[19]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[20]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[21]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[22]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[23]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[24]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[25]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[26]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[27]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[28]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[29]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing "testcaseA:nth-child(3 of testcaseA)"
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(3 of testcaseA)').length is 1
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(3 of testcaseA)')[0].id is "testcase5"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[11]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[12]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[13]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[14]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[15]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[16]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[17]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[18]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[19]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[20]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[21]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[22]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[23]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[24]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[25]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[26]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[27]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[28]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[29]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(3 of testcaseA)"
+PASS document.querySelectorAll('#test-root :nth-child(3 of testcaseA)').length is 2
+PASS document.querySelectorAll('#test-root :nth-child(3 of testcaseA)')[0].id is "testcase4"
+PASS document.querySelectorAll('#test-root :nth-child(3 of testcaseA)')[1].id is "testcase5"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[11]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[12]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[13]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[14]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[15]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[16]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[17]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[18]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[19]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[20]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[21]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[22]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[23]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[24]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[25]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[26]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[27]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[28]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[29]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing "testcaseB:nth-child(4 of testcaseB)"
+PASS document.querySelectorAll('#test-root testcaseB:nth-child(4 of testcaseB)').length is 1
+PASS document.querySelectorAll('#test-root testcaseB:nth-child(4 of testcaseB)')[0].id is "testcase8"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[11]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[12]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[13]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[14]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[15]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[16]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[17]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[18]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[19]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[20]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[21]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[22]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[23]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[24]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[25]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[26]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[27]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[28]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[29]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(4 of testcaseB)"
+PASS document.querySelectorAll('#test-root :nth-child(4 of testcaseB)').length is 2
+PASS document.querySelectorAll('#test-root :nth-child(4 of testcaseB)')[0].id is "testcase7"
+PASS document.querySelectorAll('#test-root :nth-child(4 of testcaseB)')[1].id is "testcase8"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[11]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[12]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[13]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[14]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[15]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[16]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[17]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[18]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[19]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[20]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[21]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[22]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[23]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[24]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[25]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[26]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[27]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[28]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[29]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing "testcaseA:nth-child(n+3 of testcaseA)"
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(n+3 of testcaseA)').length is 13
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(n+3 of testcaseA)')[0].id is "testcase5"
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(n+3 of testcaseA)')[1].id is "testcase7"
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(n+3 of testcaseA)')[2].id is "testcase9"
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(n+3 of testcaseA)')[3].id is "testcase11"
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(n+3 of testcaseA)')[4].id is "testcase13"
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(n+3 of testcaseA)')[5].id is "testcase15"
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(n+3 of testcaseA)')[6].id is "testcase17"
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(n+3 of testcaseA)')[7].id is "testcase19"
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(n+3 of testcaseA)')[8].id is "testcase21"
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(n+3 of testcaseA)')[9].id is "testcase23"
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(n+3 of testcaseA)')[10].id is "testcase25"
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(n+3 of testcaseA)')[11].id is "testcase27"
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(n+3 of testcaseA)')[12].id is "testcase29"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[11]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[12]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[13]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[14]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[15]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[16]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[17]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[18]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[19]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[20]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[21]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[22]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[23]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[24]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[25]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[26]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[27]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[28]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[29]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing ":nth-child(n+3 of testcaseA)"
+PASS document.querySelectorAll('#test-root :nth-child(n+3 of testcaseA)').length is 27
+PASS document.querySelectorAll('#test-root :nth-child(n+3 of testcaseA)')[0].id is "testcase4"
+PASS document.querySelectorAll('#test-root :nth-child(n+3 of testcaseA)')[1].id is "testcase5"
+PASS document.querySelectorAll('#test-root :nth-child(n+3 of testcaseA)')[2].id is "testcase6"
+PASS document.querySelectorAll('#test-root :nth-child(n+3 of testcaseA)')[3].id is "testcase7"
+PASS document.querySelectorAll('#test-root :nth-child(n+3 of testcaseA)')[4].id is "testcase8"
+PASS document.querySelectorAll('#test-root :nth-child(n+3 of testcaseA)')[5].id is "testcase9"
+PASS document.querySelectorAll('#test-root :nth-child(n+3 of testcaseA)')[6].id is "testcase10"
+PASS document.querySelectorAll('#test-root :nth-child(n+3 of testcaseA)')[7].id is "testcase11"
+PASS document.querySelectorAll('#test-root :nth-child(n+3 of testcaseA)')[8].id is "testcase12"
+PASS document.querySelectorAll('#test-root :nth-child(n+3 of testcaseA)')[9].id is "testcase13"
+PASS document.querySelectorAll('#test-root :nth-child(n+3 of testcaseA)')[10].id is "testcase14"
+PASS document.querySelectorAll('#test-root :nth-child(n+3 of testcaseA)')[11].id is "testcase15"
+PASS document.querySelectorAll('#test-root :nth-child(n+3 of testcaseA)')[12].id is "testcase16"
+PASS document.querySelectorAll('#test-root :nth-child(n+3 of testcaseA)')[13].id is "testcase17"
+PASS document.querySelectorAll('#test-root :nth-child(n+3 of testcaseA)')[14].id is "testcase18"
+PASS document.querySelectorAll('#test-root :nth-child(n+3 of testcaseA)')[15].id is "testcase19"
+PASS document.querySelectorAll('#test-root :nth-child(n+3 of testcaseA)')[16].id is "testcase20"
+PASS document.querySelectorAll('#test-root :nth-child(n+3 of testcaseA)')[17].id is "testcase21"
+PASS document.querySelectorAll('#test-root :nth-child(n+3 of testcaseA)')[18].id is "testcase22"
+PASS document.querySelectorAll('#test-root :nth-child(n+3 of testcaseA)')[19].id is "testcase23"
+PASS document.querySelectorAll('#test-root :nth-child(n+3 of testcaseA)')[20].id is "testcase24"
+PASS document.querySelectorAll('#test-root :nth-child(n+3 of testcaseA)')[21].id is "testcase25"
+PASS document.querySelectorAll('#test-root :nth-child(n+3 of testcaseA)')[22].id is "testcase26"
+PASS document.querySelectorAll('#test-root :nth-child(n+3 of testcaseA)')[23].id is "testcase27"
+PASS document.querySelectorAll('#test-root :nth-child(n+3 of testcaseA)')[24].id is "testcase28"
+PASS document.querySelectorAll('#test-root :nth-child(n+3 of testcaseA)')[25].id is "testcase29"
+PASS document.querySelectorAll('#test-root :nth-child(n+3 of testcaseA)')[26].id is "testcase30"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[11]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[12]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[13]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[14]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[15]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[16]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[17]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[18]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[19]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[20]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[21]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[22]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[23]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[24]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[25]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[26]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[27]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[28]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[29]).backgroundColor is "rgb(10, 100, 200)"
+
+Testing "testcaseA:nth-child(2n+2 of testcaseA)"
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(2n+2 of testcaseA)').length is 7
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(2n+2 of testcaseA)')[0].id is "testcase3"
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(2n+2 of testcaseA)')[1].id is "testcase7"
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(2n+2 of testcaseA)')[2].id is "testcase11"
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(2n+2 of testcaseA)')[3].id is "testcase15"
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(2n+2 of testcaseA)')[4].id is "testcase19"
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(2n+2 of testcaseA)')[5].id is "testcase23"
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(2n+2 of testcaseA)')[6].id is "testcase27"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[11]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[12]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[13]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[14]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[15]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[16]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[17]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[18]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[19]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[20]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[21]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[22]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[23]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[24]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[25]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[26]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[27]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[28]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[29]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing "testcaseA:nth-child(-n+4 of testcaseA)"
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(-n+4 of testcaseA)').length is 4
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(-n+4 of testcaseA)')[0].id is "testcase1"
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(-n+4 of testcaseA)')[1].id is "testcase3"
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(-n+4 of testcaseA)')[2].id is "testcase5"
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(-n+4 of testcaseA)')[3].id is "testcase7"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[11]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[12]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[13]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[14]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[15]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[16]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[17]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[18]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[19]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[20]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[21]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[22]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[23]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[24]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[25]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[26]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[27]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[28]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[29]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing "testcaseB:nth-child(-n+5 of testcaseB)"
+PASS document.querySelectorAll('#test-root testcaseB:nth-child(-n+5 of testcaseB)').length is 5
+PASS document.querySelectorAll('#test-root testcaseB:nth-child(-n+5 of testcaseB)')[0].id is "testcase2"
+PASS document.querySelectorAll('#test-root testcaseB:nth-child(-n+5 of testcaseB)')[1].id is "testcase4"
+PASS document.querySelectorAll('#test-root testcaseB:nth-child(-n+5 of testcaseB)')[2].id is "testcase6"
+PASS document.querySelectorAll('#test-root testcaseB:nth-child(-n+5 of testcaseB)')[3].id is "testcase8"
+PASS document.querySelectorAll('#test-root testcaseB:nth-child(-n+5 of testcaseB)')[4].id is "testcase10"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[11]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[12]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[13]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[14]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[15]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[16]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[17]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[18]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[19]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[20]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[21]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[22]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[23]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[24]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[25]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[26]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[27]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[28]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[29]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing "testcaseA:nth-child(n+3 of testcaseA):nth-child(-n+6 of testcaseA)"
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(n+3 of testcaseA):nth-child(-n+6 of testcaseA)').length is 4
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(n+3 of testcaseA):nth-child(-n+6 of testcaseA)')[0].id is "testcase5"
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(n+3 of testcaseA):nth-child(-n+6 of testcaseA)')[1].id is "testcase7"
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(n+3 of testcaseA):nth-child(-n+6 of testcaseA)')[2].id is "testcase9"
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(n+3 of testcaseA):nth-child(-n+6 of testcaseA)')[3].id is "testcase11"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[11]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[12]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[13]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[14]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[15]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[16]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[17]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[18]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[19]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[20]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[21]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[22]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[23]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[24]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[25]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[26]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[27]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[28]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[29]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing "testcaseA:nth-child(-n+6 of testcaseA):nth-child(n+3 of testcaseA)"
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(-n+6 of testcaseA):nth-child(n+3 of testcaseA)').length is 4
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(-n+6 of testcaseA):nth-child(n+3 of testcaseA)')[0].id is "testcase5"
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(-n+6 of testcaseA):nth-child(n+3 of testcaseA)')[1].id is "testcase7"
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(-n+6 of testcaseA):nth-child(n+3 of testcaseA)')[2].id is "testcase9"
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(-n+6 of testcaseA):nth-child(n+3 of testcaseA)')[3].id is "testcase11"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[11]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[12]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[13]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[14]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[15]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[16]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[17]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[18]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[19]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[20]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[21]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[22]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[23]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[24]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[25]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[26]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[27]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[28]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[29]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing "testcaseB:nth-child(n+1 of testcaseB):nth-child(-n+3 of testcaseB)"
+PASS document.querySelectorAll('#test-root testcaseB:nth-child(n+1 of testcaseB):nth-child(-n+3 of testcaseB)').length is 3
+PASS document.querySelectorAll('#test-root testcaseB:nth-child(n+1 of testcaseB):nth-child(-n+3 of testcaseB)')[0].id is "testcase2"
+PASS document.querySelectorAll('#test-root testcaseB:nth-child(n+1 of testcaseB):nth-child(-n+3 of testcaseB)')[1].id is "testcase4"
+PASS document.querySelectorAll('#test-root testcaseB:nth-child(n+1 of testcaseB):nth-child(-n+3 of testcaseB)')[2].id is "testcase6"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[11]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[12]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[13]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[14]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[15]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[16]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[17]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[18]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[19]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[20]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[21]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[22]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[23]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[24]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[25]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[26]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[27]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[28]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[29]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing "testcaseB:nth-child(-n+3 of testcaseB):nth-child(n+1 of testcaseB)"
+PASS document.querySelectorAll('#test-root testcaseB:nth-child(-n+3 of testcaseB):nth-child(n+1 of testcaseB)').length is 3
+PASS document.querySelectorAll('#test-root testcaseB:nth-child(-n+3 of testcaseB):nth-child(n+1 of testcaseB)')[0].id is "testcase2"
+PASS document.querySelectorAll('#test-root testcaseB:nth-child(-n+3 of testcaseB):nth-child(n+1 of testcaseB)')[1].id is "testcase4"
+PASS document.querySelectorAll('#test-root testcaseB:nth-child(-n+3 of testcaseB):nth-child(n+1 of testcaseB)')[2].id is "testcase6"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[11]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[12]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[13]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[14]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[15]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[16]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[17]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[18]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[19]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[20]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[21]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[22]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[23]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[24]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[25]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[26]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[27]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[28]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[29]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing "testcaseA:nth-child(n+3 of testcaseA):nth-child(odd of testcaseA):nth-child(-n+6 of testcaseA)"
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(n+3 of testcaseA):nth-child(odd of testcaseA):nth-child(-n+6 of testcaseA)').length is 2
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(n+3 of testcaseA):nth-child(odd of testcaseA):nth-child(-n+6 of testcaseA)')[0].id is "testcase5"
+PASS document.querySelectorAll('#test-root testcaseA:nth-child(n+3 of testcaseA):nth-child(odd of testcaseA):nth-child(-n+6 of testcaseA)')[1].id is "testcase9"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[11]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[12]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[13]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[14]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[15]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[16]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[17]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[18]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[19]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[20]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[21]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[22]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[23]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[24]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[25]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[26]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[27]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[28]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[29]).backgroundColor is "rgb(255, 0, 0)"
+
+Testing "testcaseB:nth-child(n+1 of testcaseB):nth-child(even of testcaseB):nth-child(-n+3 of testcaseB)"
+PASS document.querySelectorAll('#test-root testcaseB:nth-child(n+1 of testcaseB):nth-child(even of testcaseB):nth-child(-n+3 of testcaseB)').length is 1
+PASS document.querySelectorAll('#test-root testcaseB:nth-child(n+1 of testcaseB):nth-child(even of testcaseB):nth-child(-n+3 of testcaseB)')[0].id is "testcase4"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[10]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[11]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[12]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[13]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[14]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[15]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[16]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[17]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[18]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[19]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[20]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[21]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[22]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[23]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[24]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[25]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[26]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[27]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[28]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#test-root *")[29]).backgroundColor is "rgb(255, 0, 0)"
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastselectorsnthchildofbasics2html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/selectors/nth-child-of-basics-2.html (0 => 174035)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/selectors/nth-child-of-basics-2.html         (rev 0)
+++ trunk/LayoutTests/fast/selectors/nth-child-of-basics-2.html        2014-09-27 18:49:12 UTC (rev 174035)
</span><span class="lines">@@ -0,0 +1,110 @@
</span><ins>+<!doctype html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<style>
+#test-root * {
+ background-color: red;
+}
+</style>
+<style id="style">
+</style>
+</head>
+<body>
+ <div style="display:none" id="test-root">
+ <testcaseA id="testcase1" attribute1="value1" class="bar baz bazoo" attribute3="value3">Not empty</testcaseA>
+ <testcaseB id="testcase2" class="bar baz bazoo" attribute2="value2" attribute3="value3"></testcaseB>
+ <testcaseA id="testcase3" attribute1="value1" class="foo baz bazoo">Not empty</testcaseA>
+ <testcaseB id="testcase4" attribute1="value1" class="foo bar bazoo">Not empty</testcaseB>
+ <testcaseA id="testcase5" class="foo baz bazoo" attribute2="value2" attribute3="value3">Not empty</testcaseA>
+ <testcaseB id="testcase6" attribute1="value1" class="foo bar baz" attribute3="value3">Not empty</testcaseB>
+ <testcaseA id="testcase7" attribute1="value1" class="bar baz bazoo">Not empty</testcaseA>
+ <testcaseB id="testcase8" attribute1="value1" class="foo baz bazoo">Not empty</testcaseB>
+ <testcaseA id="testcase9" class="foo bar bazoo" attribute2="value2" attribute3="value3"></testcaseA>
+ <testcaseB id="testcase10" attribute1="value1" class="foo bar bazoo" attribute3="value3">Not empty</testcaseB>
+ <testcaseA id="testcase11" attribute1="value1" class="foo bar baz">Not empty</testcaseA>
+ <testcaseB id="testcase12" attribute1="value1" class="bar baz bazoo">Not empty</testcaseB>
+ <testcaseA id="testcase13" attribute1="value1" class="foo baz bazoo" attribute3="value3">Not empty</testcaseA>
+ <testcaseB id="testcase14" class="foo bar baz" attribute2="value2">Not empty</testcaseB>
+ <testcaseA id="testcase15" attribute1="value1" class="foo bar bazoo">Not empty</testcaseA>
+ <testcaseB id="testcase16" attribute1="value1" class="foo bar baz" attribute3="value3">Not empty</testcaseB>
+ <testcaseA id="testcase17" attribute1="value1" class="bar baz bazoo" attribute3="value3">Not empty</testcaseA>
+ <testcaseB id="testcase18" attribute1="value1" class="foo baz bazoo">Not empty</testcaseB>
+ <testcaseA id="testcase19" attribute1="value1" class="foo bar bazoo">Not empty</testcaseA>
+ <testcaseB id="testcase20" class="bar baz bazoo" attribute2="value2" attribute3="value3">Not empty</testcaseB>
+ <testcaseA id="testcase21" attribute1="value1" class="foo bar baz" attribute3="value3"></testcaseA>
+ <testcaseB id="testcase22" attribute1="value1" class="bar baz bazoo">Not empty</testcaseB>
+ <testcaseA id="testcase23" attribute1="value1" class="foo baz bazoo">Not empty</testcaseA>
+ <testcaseB id="testcase24" attribute1="value1" class="foo bar bazoo" attribute3="value3">Not empty</testcaseB>
+ <testcaseA id="testcase25" attribute1="value1" class="foo bar baz" attribute3="value3">Not empty</testcaseA>
+ <testcaseB id="testcase26" attribute1="value1" class="bar baz bazoo">Not empty</testcaseB>
+ <testcaseA id="testcase27" class="foo baz bazoo" attribute2="value2"></testcaseA>
+ <testcaseB id="testcase28" attribute1="value1" class="foo baz bazoo" attribute3="value3">Not empty</testcaseB>
+ <testcaseA id="testcase29" attribute1="value1" class="foo bar bazoo">Not empty</testcaseA>
+ <testcaseB id="testcase30" attribute1="value1" class="foo bar baz">Not empty</testcaseB>
+ </div>
+</body>
+<script>
+description('Check the basic features of the ":nth-child(An+B of selectorList)" pseudo class.');
+
+function testQuerySelector(selector, expectedIds) {
+ shouldBe("document.querySelectorAll('" + selector + "').length", '' + expectedIds.length);
+ for (var i = 0; i < expectedIds.length; ++i)
+ shouldBeEqualToString("document.querySelectorAll('" + selector + "')[" + i + "].id", expectedIds[i]);
+}
+
+function testStyling(selector, expectedIds) {
+ var stylingElement = document.getElementById("style");
+ stylingElement.innerHTML = '' + selector + ' { background-color: rgb(10, 100, 200); }';
+
+ var allTestCases = document.querySelectorAll("#test-root *");
+ for (var i = 0; i < allTestCases.length; ++i) {
+ var expectMatch = expectedIds.indexOf(allTestCases[i].id) >= 0;
+ shouldBeEqualToString('getComputedStyle(document.querySelectorAll("#test-root *")[' + i + ']).backgroundColor', expectMatch ? 'rgb(10, 100, 200)' : 'rgb(255, 0, 0)');
+ }
+
+ stylingElement.innerHTML = '';
+}
+
+function testSelector(selector, expectedIds) {
+ debug("Testing \"" + selector + "\"");
+ testQuerySelector("#test-root " + selector, expectedIds);
+ testStyling("#test-root " + selector, expectedIds);
+ debug("");
+}
+
+// Test cases inspired by the :nth-child() examples from http://nthmaster.com/.
+testSelector(":nth-child(8 of [class], [id])", ["testcase8"]);
+testSelector(":nth-child(n+6 of [class], [id])", ["testcase6", "testcase7", "testcase8", "testcase9", "testcase10", "testcase11", "testcase12", "testcase13", "testcase14", "testcase15", "testcase16", "testcase17", "testcase18", "testcase19", "testcase20", "testcase21", "testcase22", "testcase23", "testcase24", "testcase25", "testcase26", "testcase27", "testcase28", "testcase29", "testcase30"]);
+testSelector(":nth-child(-n+9 of [class], [id])", ["testcase1", "testcase2", "testcase3", "testcase4", "testcase5", "testcase6", "testcase7", "testcase8", "testcase9"]);
+testSelector(":nth-child(n+4 of [class], [id]):nth-child(-n+8 of [class])", ["testcase4", "testcase5", "testcase6", "testcase7", "testcase8"]);
+testSelector(":nth-child(-n+8 of [class], [id]):nth-child(n+4 of [class])", ["testcase4", "testcase5", "testcase6", "testcase7", "testcase8"]);
+testSelector(":nth-child(n+2 of [class], [id]):nth-child(odd of [class]):nth-child(-n+9 of [class])", ["testcase3", "testcase5", "testcase7", "testcase9"]);
+testSelector(":nth-child(3n+1 of [class], [id]):nth-child(even of [class])", ["testcase4", "testcase10", "testcase16", "testcase22", "testcase28"]);
+testSelector(":nth-child(even of [class], [id]):nth-child(3n+1 of [class])", ["testcase4", "testcase10", "testcase16", "testcase22", "testcase28"]);
+
+// Test cases inspired by the :nth-of-type() examples from http://nthmaster.com/.
+testSelector("testcaseA:nth-child(3 of testcaseA)", ["testcase5"]);
+testSelector(":nth-child(3 of testcaseA)", ["testcase4", "testcase5"]);
+testSelector("testcaseB:nth-child(4 of testcaseB)", ["testcase8"]);
+testSelector(":nth-child(4 of testcaseB)", ["testcase7", "testcase8"]);
+
+testSelector("testcaseA:nth-child(n+3 of testcaseA)", ["testcase5", "testcase7", "testcase9", "testcase11", "testcase13", "testcase15", "testcase17", "testcase19", "testcase21", "testcase23", "testcase25", "testcase27", "testcase29"]);
+testSelector(":nth-child(n+3 of testcaseA)", ["testcase4", "testcase5", "testcase6", "testcase7", "testcase8", "testcase9", "testcase10", "testcase11", "testcase12", "testcase13", "testcase14", "testcase15", "testcase16", "testcase17", "testcase18", "testcase19", "testcase20", "testcase21", "testcase22", "testcase23", "testcase24", "testcase25", "testcase26", "testcase27", "testcase28", "testcase29", "testcase30"]);
+
+testSelector("testcaseA:nth-child(2n+2 of testcaseA)", ["testcase3", "testcase7", "testcase11", "testcase15", "testcase19", "testcase23", "testcase27"]);
+
+testSelector("testcaseA:nth-child(-n+4 of testcaseA)", ["testcase1", "testcase3", "testcase5", "testcase7"]);
+testSelector("testcaseB:nth-child(-n+5 of testcaseB)", ["testcase2", "testcase4", "testcase6", "testcase8", "testcase10"]);
+
+testSelector("testcaseA:nth-child(n+3 of testcaseA):nth-child(-n+6 of testcaseA)", ["testcase5", "testcase7", "testcase9", "testcase11"]);
+testSelector("testcaseA:nth-child(-n+6 of testcaseA):nth-child(n+3 of testcaseA)", ["testcase5", "testcase7", "testcase9", "testcase11"]);
+
+testSelector("testcaseB:nth-child(n+1 of testcaseB):nth-child(-n+3 of testcaseB)", ["testcase2", "testcase4", "testcase6"]);
+testSelector("testcaseB:nth-child(-n+3 of testcaseB):nth-child(n+1 of testcaseB)", ["testcase2", "testcase4", "testcase6"]);
+
+testSelector("testcaseA:nth-child(n+3 of testcaseA):nth-child(odd of testcaseA):nth-child(-n+6 of testcaseA)", ["testcase5", "testcase9"]);
+testSelector("testcaseB:nth-child(n+1 of testcaseB):nth-child(even of testcaseB):nth-child(-n+3 of testcaseB)", ["testcase4"]);
+</script>
+<script src="../../resources/js-test-post.js"></script>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastselectorsnthchildofchainedexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/selectors/nth-child-of-chained-expected.txt (0 => 174035)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/selectors/nth-child-of-chained-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/selectors/nth-child-of-chained-expected.txt        2014-09-27 18:49:12 UTC (rev 174035)
</span><span class="lines">@@ -0,0 +1,184 @@
</span><ins>+Test chaining many :nth-child() selectors. This verifies register allocation is correct.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Testing ":nth-child(-n+21 of testcase):nth-child(odd of testcase):nth-child(-2n+21 of testcase):nth-child(3n+1 of testcase):nth-child(-3n+22 of testcase):nth-child(4n+1 of testcase):nth-child(-5n+51 of testcase)"
+PASS document.querySelectorAll('testcase:nth-child(-n+21 of testcase):nth-child(odd of testcase):nth-child(-2n+21 of testcase):nth-child(3n+1 of testcase):nth-child(-3n+22 of testcase):nth-child(4n+1 of testcase):nth-child(-5n+51 of testcase)').length is 1
+PASS document.querySelectorAll('testcase:nth-child(-n+21 of testcase):nth-child(odd of testcase):nth-child(-2n+21 of testcase):nth-child(3n+1 of testcase):nth-child(-3n+22 of testcase):nth-child(4n+1 of testcase):nth-child(-5n+51 of testcase)')[0].id is "testcase1"
+PASS getComputedStyle(document.querySelectorAll("testcase")[0]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[10]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[11]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[12]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[13]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[14]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[15]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[16]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[17]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[18]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[19]).backgroundColor is "rgb(255, 0, 0)"
+PASS document.querySelectorAll('div>testcase:nth-child(-n+21 of testcase):nth-child(odd of testcase):nth-child(-2n+21 of testcase):nth-child(3n+1 of testcase):nth-child(-3n+22 of testcase):nth-child(4n+1 of testcase):nth-child(-5n+51 of testcase)>div>div>div span').length is 1
+
+Testing ":nth-child(2n-200 of testcase):nth-child(3n-1 of testcase):nth-child(4n-38 of testcase):nth-child(5n-98 of testcase)"
+PASS document.querySelectorAll('testcase:nth-child(2n-200 of testcase):nth-child(3n-1 of testcase):nth-child(4n-38 of testcase):nth-child(5n-98 of testcase)').length is 1
+PASS document.querySelectorAll('testcase:nth-child(2n-200 of testcase):nth-child(3n-1 of testcase):nth-child(4n-38 of testcase):nth-child(5n-98 of testcase)')[0].id is "testcase2"
+PASS getComputedStyle(document.querySelectorAll("testcase")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[1]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[10]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[11]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[12]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[13]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[14]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[15]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[16]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[17]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[18]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[19]).backgroundColor is "rgb(255, 0, 0)"
+PASS document.querySelectorAll('div>testcase:nth-child(2n-200 of testcase):nth-child(3n-1 of testcase):nth-child(4n-38 of testcase):nth-child(5n-98 of testcase)>div>div>div span').length is 1
+
+Testing ":nth-child(even of testcase):nth-child(3n of testcase):nth-child(4n-2 of testcase):nth-child(5n+1 of testcase)"
+PASS document.querySelectorAll('testcase:nth-child(even of testcase):nth-child(3n of testcase):nth-child(4n-2 of testcase):nth-child(5n+1 of testcase)').length is 1
+PASS document.querySelectorAll('testcase:nth-child(even of testcase):nth-child(3n of testcase):nth-child(4n-2 of testcase):nth-child(5n+1 of testcase)')[0].id is "testcase6"
+PASS getComputedStyle(document.querySelectorAll("testcase")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[5]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[10]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[11]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[12]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[13]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[14]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[15]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[16]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[17]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[18]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[19]).backgroundColor is "rgb(255, 0, 0)"
+PASS document.querySelectorAll('div>testcase:nth-child(even of testcase):nth-child(3n of testcase):nth-child(4n-2 of testcase):nth-child(5n+1 of testcase)>div>div>div span').length is 1
+
+Testing ":nth-child(-n+9000 of testcase):nth-child(-2n+683 of testcase):nth-child(-3n+31 of testcase):nth-child(-4n+47 of testcase):nth-child(-5n+107 of testcase):nth-child(-6n+73 of testcase):nth-child(-7n+70 of testcase)"
+PASS document.querySelectorAll('testcase:nth-child(-n+9000 of testcase):nth-child(-2n+683 of testcase):nth-child(-3n+31 of testcase):nth-child(-4n+47 of testcase):nth-child(-5n+107 of testcase):nth-child(-6n+73 of testcase):nth-child(-7n+70 of testcase)').length is 1
+PASS document.querySelectorAll('testcase:nth-child(-n+9000 of testcase):nth-child(-2n+683 of testcase):nth-child(-3n+31 of testcase):nth-child(-4n+47 of testcase):nth-child(-5n+107 of testcase):nth-child(-6n+73 of testcase):nth-child(-7n+70 of testcase)')[0].id is "testcase7"
+PASS getComputedStyle(document.querySelectorAll("testcase")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[6]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[10]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[11]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[12]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[13]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[14]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[15]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[16]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[17]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[18]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[19]).backgroundColor is "rgb(255, 0, 0)"
+PASS document.querySelectorAll('div>testcase:nth-child(-n+9000 of testcase):nth-child(-2n+683 of testcase):nth-child(-3n+31 of testcase):nth-child(-4n+47 of testcase):nth-child(-5n+107 of testcase):nth-child(-6n+73 of testcase):nth-child(-7n+70 of testcase)>div>div>div span').length is 1
+
+Testing ":nth-child(odd of testcase):nth-child(3n+1 of testcase):nth-child(4n-1 of testcase):nth-child(5n+4 of testcase)"
+PASS document.querySelectorAll('testcase:nth-child(odd of testcase):nth-child(3n+1 of testcase):nth-child(4n-1 of testcase):nth-child(5n+4 of testcase)').length is 1
+PASS document.querySelectorAll('testcase:nth-child(odd of testcase):nth-child(3n+1 of testcase):nth-child(4n-1 of testcase):nth-child(5n+4 of testcase)')[0].id is "testcase19"
+PASS getComputedStyle(document.querySelectorAll("testcase")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[10]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[11]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[12]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[13]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[14]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[15]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[16]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[17]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[18]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[19]).backgroundColor is "rgb(255, 0, 0)"
+PASS document.querySelectorAll('div>testcase:nth-child(odd of testcase):nth-child(3n+1 of testcase):nth-child(4n-1 of testcase):nth-child(5n+4 of testcase)>div>div>div span').length is 1
+
+Testing ":nth-child(-n+1500 of testcase):nth-child(2n+1 of testcase):nth-child(-3n+45 of testcase):nth-child(4n+3 of testcase):nth-child(-5n+1545 of testcase)"
+PASS document.querySelectorAll('testcase:nth-child(-n+1500 of testcase):nth-child(2n+1 of testcase):nth-child(-3n+45 of testcase):nth-child(4n+3 of testcase):nth-child(-5n+1545 of testcase)').length is 1
+PASS document.querySelectorAll('testcase:nth-child(-n+1500 of testcase):nth-child(2n+1 of testcase):nth-child(-3n+45 of testcase):nth-child(4n+3 of testcase):nth-child(-5n+1545 of testcase)')[0].id is "testcase15"
+PASS getComputedStyle(document.querySelectorAll("testcase")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[9]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[10]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[11]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[12]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[13]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[14]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[15]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[16]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[17]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[18]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[19]).backgroundColor is "rgb(255, 0, 0)"
+PASS document.querySelectorAll('div>testcase:nth-child(-n+1500 of testcase):nth-child(2n+1 of testcase):nth-child(-3n+45 of testcase):nth-child(4n+3 of testcase):nth-child(-5n+1545 of testcase)>div>div>div span').length is 1
+
+Testing ":nth-child(n+2 of testcase):nth-child(-n+6000 of testcase):nth-child(n-2 of testcase):nth-child(2n of testcase):nth-child(-2n+20 of testcase):nth-child(2n+2 of testcase):nth-child(3n+1 of testcase):nth-child(-3n+49 of testcase):nth-child(3n-92 of testcase):nth-child(4n+2 of testcase):nth-child(-4n+50 of testcase)"
+PASS document.querySelectorAll('testcase:nth-child(n+2 of testcase):nth-child(-n+6000 of testcase):nth-child(n-2 of testcase):nth-child(2n of testcase):nth-child(-2n+20 of testcase):nth-child(2n+2 of testcase):nth-child(3n+1 of testcase):nth-child(-3n+49 of testcase):nth-child(3n-92 of testcase):nth-child(4n+2 of testcase):nth-child(-4n+50 of testcase)').length is 1
+PASS document.querySelectorAll('testcase:nth-child(n+2 of testcase):nth-child(-n+6000 of testcase):nth-child(n-2 of testcase):nth-child(2n of testcase):nth-child(-2n+20 of testcase):nth-child(2n+2 of testcase):nth-child(3n+1 of testcase):nth-child(-3n+49 of testcase):nth-child(3n-92 of testcase):nth-child(4n+2 of testcase):nth-child(-4n+50 of testcase)')[0].id is "testcase10"
+PASS getComputedStyle(document.querySelectorAll("testcase")[0]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[1]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[2]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[3]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[4]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[5]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[6]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[7]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[8]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[9]).backgroundColor is "rgb(10, 100, 200)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[10]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[11]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[12]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[13]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[14]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[15]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[16]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[17]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[18]).backgroundColor is "rgb(255, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("testcase")[19]).backgroundColor is "rgb(255, 0, 0)"
+PASS document.querySelectorAll('div>testcase:nth-child(n+2 of testcase):nth-child(-n+6000 of testcase):nth-child(n-2 of testcase):nth-child(2n of testcase):nth-child(-2n+20 of testcase):nth-child(2n+2 of testcase):nth-child(3n+1 of testcase):nth-child(-3n+49 of testcase):nth-child(3n-92 of testcase):nth-child(4n+2 of testcase):nth-child(-4n+50 of testcase)>div>div>div span').length is 1
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastselectorsnthchildofchainedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/selectors/nth-child-of-chained.html (0 => 174035)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/selectors/nth-child-of-chained.html         (rev 0)
+++ trunk/LayoutTests/fast/selectors/nth-child-of-chained.html        2014-09-27 18:49:12 UTC (rev 174035)
</span><span class="lines">@@ -0,0 +1,94 @@
</span><ins>+<!doctype html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<style>
+testcase {
+ background-color: red;
+}
+</style>
+<style id="style">
+</style>
+</head>
+<body>
+ <div style="display:none">
+ <testcase id="testcase1"><div><div><div><div><div><div><div><div><span></span></div></div></div></div></div></div></div></div></testcase>
+ <testcase id="testcase2"><div><div><div><div><div><div><div><div><span></span></div></div></div></div></div></div></div></div></testcase>
+ <testcase id="testcase3"><div><div><div><div><div><div><div><div><span></span></div></div></div></div></div></div></div></div></testcase>
+ <testcase id="testcase4"><div><div><div><div><div><div><div><div><span></span></div></div></div></div></div></div></div></div></testcase>
+ <testcase id="testcase5"><div><div><div><div><div><div><div><div><span></span></div></div></div></div></div></div></div></div></testcase>
+ <testcase id="testcase6"><div><div><div><div><div><div><div><div><span></span></div></div></div></div></div></div></div></div></testcase>
+ <testcase id="testcase7"><div><div><div><div><div><div><div><div><span></span></div></div></div></div></div></div></div></div></testcase>
+ <testcase id="testcase8"><div><div><div><div><div><div><div><div><span></span></div></div></div></div></div></div></div></div></testcase>
+ <testcase id="testcase9"><div><div><div><div><div><div><div><div><span></span></div></div></div></div></div></div></div></div></testcase>
+ <testcase id="testcase10"><div><div><div><div><div><div><div><div><span></span></div></div></div></div></div></div></div></div></testcase>
+ <testcase id="testcase11"><div><div><div><div><div><div><div><div><span></span></div></div></div></div></div></div></div></div></testcase>
+ <testcase id="testcase12"><div><div><div><div><div><div><div><div><span></span></div></div></div></div></div></div></div></div></testcase>
+ <testcase id="testcase13"><div><div><div><div><div><div><div><div><span></span></div></div></div></div></div></div></div></div></testcase>
+ <testcase id="testcase14"><div><div><div><div><div><div><div><div><span></span></div></div></div></div></div></div></div></div></testcase>
+ <testcase id="testcase15"><div><div><div><div><div><div><div><div><span></span></div></div></div></div></div></div></div></div></testcase>
+ <testcase id="testcase16"><div><div><div><div><div><div><div><div><span></span></div></div></div></div></div></div></div></div></testcase>
+ <testcase id="testcase17"><div><div><div><div><div><div><div><div><span></span></div></div></div></div></div></div></div></div></testcase>
+ <testcase id="testcase18"><div><div><div><div><div><div><div><div><span></span></div></div></div></div></div></div></div></div></testcase>
+ <testcase id="testcase19"><div><div><div><div><div><div><div><div><span></span></div></div></div></div></div></div></div></div></testcase>
+ <testcase id="testcase20"><div><div><div><div><div><div><div><div><span></span></div></div></div></div></div></div></div></div></testcase>
+ </div>
+</body>
+<script>
+description('Test chaining many :nth-child() selectors. This verifies register allocation is correct.');
+
+function testQuerySelector(selector, expectedIds) {
+ shouldBe("document.querySelectorAll('" + selector + "').length", '' + expectedIds.length);
+ for (var i = 0; i < expectedIds.length; ++i)
+ shouldBeEqualToString("document.querySelectorAll('" + selector + "')[" + i + "].id", expectedIds[i]);
+}
+
+function testStyling(selector, expectedIds) {
+ var stylingElement = document.getElementById("style");
+ stylingElement.innerHTML = '' + selector + ' { background-color: rgb(10, 100, 200); }';
+
+ var allTestCases = document.querySelectorAll("testcase");
+ for (var i = 0; i < allTestCases.length; ++i) {
+ var expectMatch = expectedIds.indexOf(allTestCases[i].id) >= 0;
+ shouldBeEqualToString('getComputedStyle(document.querySelectorAll("testcase")[' + i + ']).backgroundColor', expectMatch ? 'rgb(10, 100, 200)' : 'rgb(255, 0, 0)');
+ }
+
+ stylingElement.innerHTML = '';
+}
+
+function testSelector(selector, expectedIds) {
+ debug("Testing \"" + selector + "\"");
+ testQuerySelector("testcase" + selector, expectedIds);
+ testStyling("testcase" + selector, expectedIds);
+
+ // Test the same request with a backtracking register.
+ shouldBe("document.querySelectorAll('div>testcase" + selector + ">div>div>div span').length", '' + expectedIds.length);
+
+ debug("");
+}
+
+// The :nth-child() should not completely overlap to ensure all of them are executed.
+
+// All positive B.
+testSelector(":nth-child(-n+21 of testcase):nth-child(odd of testcase):nth-child(-2n+21 of testcase):nth-child(3n+1 of testcase):nth-child(-3n+22 of testcase):nth-child(4n+1 of testcase):nth-child(-5n+51 of testcase)", ["testcase1"]);
+
+// All negative B.
+testSelector(":nth-child(2n-200 of testcase):nth-child(3n-1 of testcase):nth-child(4n-38 of testcase):nth-child(5n-98 of testcase)", ["testcase2"]);
+
+// All positive A.
+testSelector(":nth-child(even of testcase):nth-child(3n of testcase):nth-child(4n-2 of testcase):nth-child(5n+1 of testcase)", ["testcase6"]);
+
+// All negative A.
+testSelector(":nth-child(-n+9000 of testcase):nth-child(-2n+683 of testcase):nth-child(-3n+31 of testcase):nth-child(-4n+47 of testcase):nth-child(-5n+107 of testcase):nth-child(-6n+73 of testcase):nth-child(-7n+70 of testcase)", ["testcase7"]);
+
+// Positive and Negative B.
+testSelector(":nth-child(odd of testcase):nth-child(3n+1 of testcase):nth-child(4n-1 of testcase):nth-child(5n+4 of testcase)", ["testcase19"]);
+
+// Positive and Negative A.
+testSelector(":nth-child(-n+1500 of testcase):nth-child(2n+1 of testcase):nth-child(-3n+45 of testcase):nth-child(4n+3 of testcase):nth-child(-5n+1545 of testcase)", ["testcase15"]);
+
+// Everything.
+testSelector(":nth-child(n+2 of testcase):nth-child(-n+6000 of testcase):nth-child(n-2 of testcase):nth-child(2n of testcase):nth-child(-2n+20 of testcase):nth-child(2n+2 of testcase):nth-child(3n+1 of testcase):nth-child(-3n+49 of testcase):nth-child(3n-92 of testcase):nth-child(4n+2 of testcase):nth-child(-4n+50 of testcase)", ["testcase10"]);
+</script>
+<script src="../../resources/js-test-post.js"></script>
+</html>
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (174034 => 174035)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-09-27 07:13:44 UTC (rev 174034)
+++ trunk/Source/WebCore/ChangeLog        2014-09-27 18:49:12 UTC (rev 174035)
</span><span class="lines">@@ -1,3 +1,41 @@
</span><ins>+2014-09-27 Benjamin Poulain <bpoulain@apple.com>
+
+ Chaining multiple :nth-child() does not work properly
+ https://bugs.webkit.org/show_bug.cgi?id=137032
+
+ Reviewed by Gavin Barraclough.
+
+ When multiple :nth-child() are chained, the evaluation of each "An+B" could depend on
+ the execution of the previous "An+B". The reason is that the register holding the position
+ of the current element could be modified by the evaluation of "An+B".
+
+ There are two cases in which the register was used as the destination of an operation:
+ 1) When A and B are positive, the counter would be the destination of "counter - B".
+ 2) When A is not 1 or 2, the modulo operation was not preserving the input register.
+
+ For (1), we a copy of the counter in that case of generateElementIsNthChild().
+
+ For (2), we also preserve a copy of the input if it is used by the operation. In this case,
+ if the input register is one of the argument we need for idiv, we preserve it on the stack
+ or in a register depending on what is available.
+
+ This increases the register requirements by 2 in the worst case on x86. The extra registers
+ can push generateElementIsNthChild() above the 4 available registers. To accomodate for that,
+ minimumRegisterRequirements() reserve more registers on x86.
+
+ The extra register pressure has strictly no effect on performance, x86_64 has 9 registers
+ available without pushing anything. The extra allocation is only necessary for debugging.
+
+ Tests: fast/selectors/nth-child-basics.html
+ fast/selectors/nth-child-chained.html
+ fast/selectors/nth-child-of-basics-2.html
+ fast/selectors/nth-child-of-chained.html
+
+ * cssjit/SelectorCompiler.cpp:
+ (WebCore::SelectorCompiler::minimumRegisterRequirements):
+ (WebCore::SelectorCompiler::SelectorCodeGenerator::modulo):
+ (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthChild):
+
</ins><span class="cx"> 2014-09-26 Christophe Dumez <cdumez@apple.com>
</span><span class="cx">
</span><span class="cx"> Stop using legacy NODE_TYPE_CASTS() macro for HTML Elements
</span></span></pre></div>
<a id="trunkSourceWebCorecssjitSelectorCompilercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/cssjit/SelectorCompiler.cpp (174034 => 174035)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/cssjit/SelectorCompiler.cpp        2014-09-27 07:13:44 UTC (rev 174034)
+++ trunk/Source/WebCore/cssjit/SelectorCompiler.cpp        2014-09-27 18:49:12 UTC (rev 174035)
</span><span class="lines">@@ -848,9 +848,15 @@
</span><span class="cx"> // Strict minimum to match anything interesting:
</span><span class="cx"> // Element + BacktrackingRegister + ElementData + a pointer to values + an index on that pointer + the value we expect;
</span><span class="cx"> static const unsigned minimumRequiredRegisterCount = 6;
</span><ins>+
</ins><span class="cx"> // Element + ElementData + scratchRegister + attributeArrayPointer + expectedLocalName + (qualifiedNameImpl && expectedValue).
</span><span class="cx"> static const unsigned minimumRequiredRegisterCountForAttributeFilter = 6;
</span><span class="cx">
</span><ins>+#if CPU(X86_64)
+// Element + SiblingCounter + SiblingCounterCopy + divisor + dividend + remainder.
+static const unsigned minimumRequiredRegisterCountForNthChildFilter = 6;
+#endif
+
</ins><span class="cx"> static inline unsigned minimumRegisterRequirements(const SelectorFragment& selectorFragment)
</span><span class="cx"> {
</span><span class="cx"> unsigned minimum = minimumRequiredRegisterCount;
</span><span class="lines">@@ -877,6 +883,11 @@
</span><span class="cx"> minimum = std::max(minimum, attributeMinimum);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if CPU(X86_64)
+ if (!selectorFragment.nthChildFilters.isEmpty())
+ minimum = std::max(minimum, minimumRequiredRegisterCountForNthChildFilter + backtrackingRegisterRequirements);
+#endif
+
</ins><span class="cx"> // :not pseudo class filters cause some register pressure.
</span><span class="cx"> for (const SelectorFragment& subFragment : selectorFragment.notFilters) {
</span><span class="cx"> unsigned notFilterMinimum = minimumRegisterRequirements(subFragment) + backtrackingRegisterRequirements;
</span><span class="lines">@@ -1754,7 +1765,7 @@
</span><span class="cx"> if (inputDividend != dividend) {
</span><span class="cx"> bool registerIsInUse = m_registerAllocator.allocatedRegisters().contains(dividend);
</span><span class="cx"> if (registerIsInUse) {
</span><del>- if (m_registerAllocator.availableRegisterCount()) {
</del><ins>+ if (m_registerAllocator.availableRegisterCount() > 1) {
</ins><span class="cx"> temporaryDividendCopy = m_registerAllocator.allocateRegister();
</span><span class="cx"> m_assembler.move(dividend, temporaryDividendCopy);
</span><span class="cx"> dividendAllocation = RegisterAllocationType::CopiedToTemporary;
</span><span class="lines">@@ -1776,7 +1787,7 @@
</span><span class="cx"> if (inputDividend != remainder) {
</span><span class="cx"> bool registerIsInUse = m_registerAllocator.allocatedRegisters().contains(remainder);
</span><span class="cx"> if (registerIsInUse) {
</span><del>- if (m_registerAllocator.availableRegisterCount()) {
</del><ins>+ if (m_registerAllocator.availableRegisterCount() > 1) {
</ins><span class="cx"> temporaryRemainderCopy = m_registerAllocator.allocateRegister();
</span><span class="cx"> m_assembler.move(remainder, temporaryRemainderCopy);
</span><span class="cx"> remainderAllocation = RegisterAllocationType::CopiedToTemporary;
</span><span class="lines">@@ -1789,6 +1800,22 @@
</span><span class="cx"> remainderAllocation = RegisterAllocationType::AllocatedLocally;
</span><span class="cx"> }
</span><span class="cx"> }
</span><ins>+
+ // If the input register is used by idiv, save its value to restore it after the operation.
+ Assembler::RegisterID inputDividendCopy;
+ StackAllocator::StackReference pushedInputDividendStackReference;
+ RegisterAllocationType savedInputDividendAllocationType = RegisterAllocationType::External;
+ if (inputDividend == dividend || inputDividend == remainder) {
+ if (m_registerAllocator.availableRegisterCount() > 1) {
+ inputDividendCopy = m_registerAllocator.allocateRegister();
+ m_assembler.move(inputDividend, inputDividendCopy);
+ savedInputDividendAllocationType = RegisterAllocationType::CopiedToTemporary;
+ } else {
+ pushedInputDividendStackReference = m_stackAllocator.push(inputDividend);
+ savedInputDividendAllocationType = RegisterAllocationType::PushedToStack;
+ }
+ }
+
</ins><span class="cx"> m_assembler.m_assembler.cdq();
</span><span class="cx">
</span><span class="cx"> // 2) Perform the division with idiv.
</span><span class="lines">@@ -1816,6 +1843,14 @@
</span><span class="cx"> } else if (dividendAllocation == RegisterAllocationType::PushedToStack)
</span><span class="cx"> m_stackAllocator.pop(temporaryDividendStackReference, dividend);
</span><span class="cx">
</span><ins>+ if (savedInputDividendAllocationType != RegisterAllocationType::External) {
+ if (savedInputDividendAllocationType == RegisterAllocationType::CopiedToTemporary) {
+ m_assembler.move(inputDividendCopy, inputDividend);
+ m_registerAllocator.deallocateRegister(inputDividendCopy);
+ } else if (savedInputDividendAllocationType == RegisterAllocationType::PushedToStack)
+ m_stackAllocator.pop(pushedInputDividendStackReference, inputDividend);
+ }
+
</ins><span class="cx"> // 4) Branch on the test.
</span><span class="cx"> return m_assembler.branch(condition);
</span><span class="cx"> #else
</span><span class="lines">@@ -2998,9 +3033,13 @@
</span><span class="cx"> // This is the common case 2n+1 (or "odd"), we can test for odd values without doing the arithmetic.
</span><span class="cx"> failureCases.append(m_assembler.branchTest32(Assembler::Zero, elementCounter, Assembler::TrustedImm32(1)));
</span><span class="cx"> } else {
</span><del>- if (b)
- failureCases.append(m_assembler.branchSub32(Assembler::Signed, Assembler::TrustedImm32(b), elementCounter));
- moduloIsZero(failureCases, elementCounter, a);
</del><ins>+ if (b) {
+ LocalRegister elementCounterCopy(m_registerAllocator);
+ m_assembler.move(elementCounter, elementCounterCopy);
+ failureCases.append(m_assembler.branchSub32(Assembler::Signed, Assembler::TrustedImm32(b), elementCounterCopy));
+ moduloIsZero(failureCases, elementCounterCopy, a);
+ } else
+ moduloIsZero(failureCases, elementCounter, a);
</ins><span class="cx"> }
</span><span class="cx"> } else {
</span><span class="cx"> LocalRegister bRegister(m_registerAllocator);
</span></span></pre>
</div>
</div>
</body>
</html>