chromium/third_party/blink/web_tests/fast/selectors/querySelector-leftmost-selector-matches-ancestor.html

<!doctype html>
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body id="body" class="body">
  <div class="parentSibling"></div>
  <div class="parent">
    <div id="sibling" class="sibling"></div>
    <div id="rootNode" class="rootNode">
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
    </div>
  </div>
</body>
<script>
description('Test for crbug.com/304069: querySelectorAll regression.');

var rootNode = document.getElementById('rootNode');
shouldBe("rootNode.querySelectorAll('#body div').length", "6");
shouldBe("rootNode.querySelectorAll('#body').length", "0");
shouldBe("rootNode.querySelectorAll('div + #rootNode div').length", "6");

shouldBe("rootNode.querySelectorAll('.sibling + .rootNode div').length", "6");
shouldBe("rootNode.querySelectorAll('.sibling ~ .rootNode div').length", "6");
shouldBe("rootNode.querySelectorAll('.sibling .rootNode div').length", "0");
shouldBe("rootNode.querySelectorAll('.sibling div').length", "0");
shouldBe("rootNode.querySelectorAll('.body .rootNode div').length", "6");
shouldBe("rootNode.querySelectorAll('.body .sibling + .rootNode div').length", "6");
shouldBe("rootNode.querySelectorAll('.body .parentSibling + .parent div').length", "6");
shouldBe("rootNode.querySelectorAll('.body .parentSibling ~ .parent div').length", "6");
shouldBe("rootNode.querySelectorAll('.body div').length", "6");
shouldBe("rootNode.querySelectorAll('.body').length", "0");

shouldBe("rootNode.querySelectorAll('body div').length", "6");
shouldBe("rootNode.querySelectorAll('body').length", "0");

shouldBeNull("rootNode.querySelector('#body')");
shouldBeNull("rootNode.querySelector('.body')");
shouldBeNull("rootNode.querySelector('body')");
</script>
</html>