<head>
<style type="text/css">
#a:nth-child(n-1) { color: green; }
#b:nth-child(n- 10) { color: green; }
#c:nth-child(n- 1 2) { color: green; }
#d:nth-child(n-b1) { color: green; }
#e:nth-child(n-+1) { color: green; }
#f:nth-child(n-1n) { color: green; }
#g:nth-child(-n-1) { color: green; }
#h:nth-child(-n- 10) { color: green; }
#i:nth-child(-n -b1) { color: green; }
#j:nth-child(-1n- b1) { color: green; }
#k:nth-child(-n-13b1) { color: green; }
#l:nth-child(-n-+1) { color: green; }
#m:nth-child(-n+n) { color: green; }
#n:nth-child(-n
    - 1) { color: green; }
#o:nth-child(-n
    +13) { color: green; }
</style>
<script>

/** Changes the result text font size. */
function runTest()
{
    if (window.testRunner)
        testRunner.dumpAsText();

    var rules = document.styleSheets[0].cssRules;
    var text = "";
    for (var i = 0; i < rules.length; i++) {
        text += rules.item(i).cssText;
        text += "\n";
    }

    document.getElementById("result").appendChild(document.createTextNode(text));

    if (document.getElementById("result").firstChild.data === document.getElementById("expected").firstChild.data)
        document.getElementById("message").firstChild.data = "SUCCESS";
    else
        document.getElementById("message").firstChild.data = "FAILURE";
}

</script>
</head>
<body onload="runTest()">
<p id="message">TEST DID NOT COMPLETE</p>

<p>Rules from the stylesheet:</p>

<pre id="result"></pre>

<p>Expected result:</p>

<pre id="expected">#a:nth-child(n-1) { color: green; }
#b:nth-child(n-10) { color: green; }
#g:nth-child(-n-1) { color: green; }
#h:nth-child(-n-10) { color: green; }
#n:nth-child(-n-1) { color: green; }
#o:nth-child(-n+13) { color: green; }
</pre>
</body>
