-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix some bad cascade computation in getComputedStyle()
Closes #3182.
- Loading branch information
1 parent
8021a56
commit 0dedfc0
Showing
3 changed files
with
70 additions
and
1 deletion.
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
27 changes: 27 additions & 0 deletions
27
...web-platform-tests/to-upstream/cssom/getComputedStyle-visibility-nominal-case-inline.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,27 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>Computed visibility in nominal case for inline styles</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
|
||
<!-- Test for https://github.com/jsdom/jsdom/issues/3182 --> | ||
|
||
<body> | ||
<div id="hiddenDiv" style="visibility: hidden;">Hello, Ronron!</div> | ||
</body> | ||
|
||
<script> | ||
"use strict"; | ||
|
||
|
||
test(() => { | ||
const element = document.querySelector("body"); | ||
assert_equals(getComputedStyle(element).visibility, "visible"); | ||
}, "Sanity check: getComputedStyle returns apparent visibility"); | ||
|
||
test(() => { | ||
const element = document.querySelector("#hiddenDiv"); | ||
assert_equals(getComputedStyle(element).visibility, "hidden"); | ||
}, "Real check: getComputedStyle returns hidden visibility for inline styles"); | ||
|
||
</script> |
38 changes: 38 additions & 0 deletions
38
test/web-platform-tests/to-upstream/cssom/getComputedStyle-visibility-nominal-case.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,38 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>Computed visibility in nominal case</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
|
||
<!-- Test for https://github.com/jsdom/jsdom/issues/3182 --> | ||
|
||
<style> | ||
#hiddenDiv { | ||
visibility: hidden; | ||
} | ||
|
||
/* This rule is important because add rule on the div */ | ||
* { | ||
margin-bottom: 10px; | ||
} | ||
</style> | ||
|
||
<body> | ||
<div id="hiddenDiv">Hello, Ronron!</div> | ||
</body> | ||
|
||
<script> | ||
"use strict"; | ||
|
||
|
||
test(() => { | ||
const element = document.querySelector("body"); | ||
assert_equals(getComputedStyle(element).visibility, "visible"); | ||
}, "Sanity check: getComputedStyle returns apparent visibility"); | ||
|
||
test(() => { | ||
const element = document.querySelector("#hiddenDiv"); | ||
assert_equals(getComputedStyle(element).visibility, "hidden"); | ||
}, "Real check: getComputedStyle returns hidden visibility"); | ||
|
||
</script> |