Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Add a test for queries whose leftmost selector matches the root node
https://bugs.webkit.org/show_bug.cgi?id=123877 Reviewed by Andreas Kling. Merge https://chromium.googlesource.com/chromium/blink/+/22981c70bf93e8a07ee7b4d68a4522aee21b26ce so that we won't introduce the regression they had. * fast/selectors/querySelector-leftmost-selector-matches-rootNode-expected.txt: Added. * fast/selectors/querySelector-leftmost-selector-matches-rootNode.html: Added. Canonical link: https://commits.webkit.org/142058@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@158731 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
3 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
LayoutTests/fast/selectors/querySelector-leftmost-selector-matches-rootNode-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Test queries whose leftmost selector matches the root node. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS document.body.querySelectorAll('#target > div').length is 6 | ||
PASS document.body.querySelectorAll('#target').length is 0 | ||
PASS document.body.querySelectorAll('.target > div').length is 6 | ||
PASS document.body.querySelectorAll('.target').length is 0 | ||
PASS document.body.querySelectorAll('body > div').length is 6 | ||
PASS document.body.querySelectorAll('body').length is 0 | ||
PASS document.body.querySelector('#target') is null | ||
PASS document.body.querySelector('.target') is null | ||
PASS document.body.querySelector('body') is null | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
28 changes: 28 additions & 0 deletions
28
LayoutTests/fast/selectors/querySelector-leftmost-selector-matches-rootNode.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<script src="../../resources/js-test-pre.js"></script> | ||
</head> | ||
<body id="target" class="target"> | ||
<div></div> | ||
<div></div> | ||
<div></div> | ||
<div></div> | ||
<div></div> | ||
<div></div> | ||
<pre id='console'></pre> | ||
</body> | ||
<script> | ||
description('Test queries whose leftmost selector matches the root node.'); | ||
shouldBe("document.body.querySelectorAll('#target > div').length", "6"); | ||
shouldBe("document.body.querySelectorAll('#target').length", "0"); | ||
shouldBe("document.body.querySelectorAll('.target > div').length", "6"); | ||
shouldBe("document.body.querySelectorAll('.target').length", "0"); | ||
shouldBe("document.body.querySelectorAll('body > div').length", "6"); | ||
shouldBe("document.body.querySelectorAll('body').length", "0"); | ||
shouldBeNull("document.body.querySelector('#target')"); | ||
shouldBeNull("document.body.querySelector('.target')"); | ||
shouldBeNull("document.body.querySelector('body')"); | ||
</script> | ||
<script src="../../resources/js-test-post.js"></script> | ||
</html> |