<!doctype html>
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
<style>
span.target {
    background-color:rgb(0,0,0);
}

a:-webkit-any(.house, .horse) span.target {
    background-color:rgb(1,2,3);
}

b.rabbit:-webkit-any(.house, .horse):-webkit-any(.cocoa, .cappuccino) span.target {
    background-color:rgb(2,3,4);
}

c.rabbit:-webkit-any(.house, :not(.horse)) span.target {
    background-color:rgb(3,4,5);
}

/* Maximum register case */
d > d:-webkit-any([rel="drink"][data-cocoa][data-cappuccino], .ok) > d > d span.target {
    background-color:rgb(4,5,6);
}
</style>
</head>
<body>
<div style="display:none">
    <!-- a:any(.house, .horse) span.target -->
    <test1>
        <a class="house">
            <span class="target" id="target1"></span>
        </a>

        <a class="house">
            <span class="target" id="target2"></span>
        </a>

        <a>
            <span class="target" id="target3"></span>
        </a>
    </test1>

    <!-- b.rabbit:-webkit-any(.house, .horse):-webkit-any(.cocoa, .cappuccino) span.target -->
    <test2>
        <b class="rabbit horse cocoa">
            <span class="target" id="target4"></span>
        </b>

        <b class="rabbit house cappuccino">
            <span class="target" id="target5"></span>
        </b>

        <b class="rabbit house horse">
            <span class="target" id="target6"></span>
        </b>

        <b class="horse cocoa">
            <span class="target" id="target7"></span>
        </b>

        <b class="rabbit cocoa cappuccino">
            <span class="target" id="target8"></span>
        </b>
    </test2>

    <!-- c.rabbit:-webkit-any(.house, :not(.horse)) span.target -->
    <test3>
        <c class="rabbit house">
            <span class="target" id="target9"></span>
        </c>

        <c class="rabbit cappuccino">
            <span class="target" id="target10"></span>
        </c>

        <c class="rabbit">
            <span class="target" id="target11"></span>
        </c>

        <c class="rabbit horse">
            <span class="target" id="target12"></span>
        </c>

        <c class="house">
            <span class="target" id="target13"></span>
        </c>
    </test3>

    <!-- d > d:-webkit-any([rel="drink"][data-cocoa][data-cappuccino], .ok) > d > d span.target -->
    <test4>
        <d>  <!-- Matched. -->
            <d rel="drink" data-cocoa data-cappuccino>
                <d data-cocoa>  <!-- Failed. Backtracking from the tail. -->
                    <d>
                        <d>
                            <span class="target" id="target14"></span>
                        </d>
                    </d>
                </d>
            </d>
        </d>

        <d>  <!-- Matched. -->
            <d class="ok">
                <d data-cocoa>  <!-- Failed. Backtracking from the tail. -->
                    <d>
                        <d>
                            <span class="target" id="target15"></span>
                        </d>
                    </d>
                </d>
            </d>
        </d>

        <a>  <!-- Failed. -->
            <d class="ok">
                <d data-cocoa>  <!-- Failed. Backtracking from the tail. -->
                    <d>
                        <d>
                            <span class="target" id="target16"></span>
                        </d>
                    </d>
                </d>
            </d>
        </a>
    </test4>
</div>
</body>
<script>
description('The pseudo class :any');

debug("simple :any selector list matched.");
shouldBeEqualToString('getComputedStyle(document.getElementById("target1")).backgroundColor', 'rgb(1, 2, 3)');

debug("simple :any selector list matched.");
shouldBeEqualToString('getComputedStyle(document.getElementById("target2")).backgroundColor', 'rgb(1, 2, 3)');

debug("simple :any selector unmatched.");
shouldBeEqualToString('getComputedStyle(document.getElementById("target3")).backgroundColor', 'rgb(0, 0, 0)');

debug("multiple :any selector list matched.");
shouldBeEqualToString('getComputedStyle(document.getElementById("target4")).backgroundColor', 'rgb(2, 3, 4)');

debug("multiple :any selector list matched.");
shouldBeEqualToString('getComputedStyle(document.getElementById("target5")).backgroundColor', 'rgb(2, 3, 4)');

debug("multiple :any selector list unmatched.");
shouldBeEqualToString('getComputedStyle(document.getElementById("target6")).backgroundColor', 'rgb(0, 0, 0)');

debug("multiple :any selector list unmatched.");
shouldBeEqualToString('getComputedStyle(document.getElementById("target7")).backgroundColor', 'rgb(0, 0, 0)');

debug("multiple :any selector list unmatched.");
shouldBeEqualToString('getComputedStyle(document.getElementById("target8")).backgroundColor', 'rgb(0, 0, 0)');

debug("simple :any selector list including :not matched.");
shouldBeEqualToString('getComputedStyle(document.getElementById("target9")).backgroundColor', 'rgb(3, 4, 5)');

debug("simple :any selector list including :not matched.");
shouldBeEqualToString('getComputedStyle(document.getElementById("target10")).backgroundColor', 'rgb(3, 4, 5)');

debug("simple :any selector list including :not matched.");
shouldBeEqualToString('getComputedStyle(document.getElementById("target11")).backgroundColor', 'rgb(3, 4, 5)');

debug("simple :any selector list including :not unmatched.");
shouldBeEqualToString('getComputedStyle(document.getElementById("target12")).backgroundColor', 'rgb(0, 0, 0)');

debug("simple :any selector list including :not unmatched.");
shouldBeEqualToString('getComputedStyle(document.getElementById("target13")).backgroundColor', 'rgb(0, 0, 0)');

debug(":any selector including attributes matched.");
shouldBeEqualToString('getComputedStyle(document.getElementById("target14")).backgroundColor', 'rgb(4, 5, 6)');

debug(":any selector including attributes matched.");
shouldBeEqualToString('getComputedStyle(document.getElementById("target15")).backgroundColor', 'rgb(4, 5, 6)');

debug(":any selector including attributes unmatched.");
shouldBeEqualToString('getComputedStyle(document.getElementById("target16")).backgroundColor', 'rgb(0, 0, 0)');
</script>
<script src="../../resources/js-test-post.js"></script>
</html>
