Implement getComputedStyle

This commit is contained in:
David Zbarsky 2015-07-27 23:05:18 -04:00
parent 416931f4be
commit e484d6b5e3
24 changed files with 886 additions and 152 deletions

View file

@ -1,9 +1,8 @@
[events-006.htm]
type: testharness
expected: TIMEOUT
[transition padding-left on :before / events]
expected: NOTRUN
expected: FAIL
[transition padding-left on :after / events]
expected: NOTRUN
expected: FAIL

View file

@ -1,15 +1,14 @@
[pseudo-elements-001.htm]
type: testharness
expected: TIMEOUT
[transition padding-left on :before / values]
expected: NOTRUN
expected: FAIL
[transition padding-left on :after / values]
expected: NOTRUN
expected: FAIL
[transition padding-left on :before, changing content / values]
expected: NOTRUN
expected: FAIL
[transition padding-left on :after, changing content / values]
expected: NOTRUN
expected: FAIL

View file

@ -1,20 +0,0 @@
[Element-classlist.html]
type: testharness
[CSS .foo selectors must not match elements without any class]
expected: FAIL
[computed style must update when setting .className]
expected: FAIL
[classList.add must not cause the CSS selector to stop matching]
expected: FAIL
[classList.remove must not break case-sensitive CSS selector matching]
expected: FAIL
[classList.toggle must not break case-sensitive CSS selector matching]
expected: FAIL
[CSS class selectors must stop matching when all classes have been removed]
expected: FAIL

View file

@ -1,20 +0,0 @@
[id-attribute.html]
type: testharness
[User agents must associate the element with an id value for purposes of CSS.]
expected: FAIL
[Association for CSS is exact and therefore case-sensitive.]
expected: FAIL
[Spaces are allowed in an id and still make an association.]
expected: FAIL
[Non-ASCII is allowed in an id and still make an association for CSS.]
expected: FAIL
[After setting id via id attribute, CSS association is via the new ID.]
expected: FAIL
[After setting id via setAttribute attribute, CSS association is via the new ID.]
expected: FAIL

View file

@ -1,5 +0,0 @@
[del_effect.html]
type: testharness
[HTML Test: Text in the del element should be 'line-through']
expected: FAIL

View file

@ -1,5 +0,0 @@
[ins_effect.html]
type: testharness
[HTML Test: Text in the ins element should be 'underline']
expected: FAIL

View file

@ -533,6 +533,12 @@
"url": "/_mozilla/mozilla/getBoundingClientRect.html"
}
],
"mozilla/getComputedStyle.html": [
{
"path": "mozilla/getComputedStyle.html",
"url": "/_mozilla/mozilla/getComputedStyle.html"
}
],
"mozilla/getPropertyPriority.html": [
{
"path": "mozilla/getPropertyPriority.html",
@ -974,4 +980,4 @@
"rev": null,
"url_base": "/_mozilla/",
"version": 2
}
}

View file

@ -0,0 +1,45 @@
<!DOCTYPE html>
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
#foo:before {
color: red;
}
#foo {
width: 50px;
}
</style>
</head>
<body>
<div id="foo"></div>
<script>
test(function() {
var div = document.getElementById("foo");
var cs = getComputedStyle(div);
assert_equals(cs.getPropertyValue("left"), "auto");
assert_equals(cs.getPropertyValue("right"), "auto");
assert_equals(cs.getPropertyValue("top"), "auto");
assert_equals(cs.getPropertyValue("bottom"), "auto");
assert_equals(cs.getPropertyValue("width"), "50px");
assert_equals(cs.getPropertyValue("height"), "auto");
assert_equals(cs.getPropertyValue("color"), "rgb(0, 0, 0)");
}, "Element's resolved values");
test(function() {
var div = document.getElementById("foo");
assert_equals(getComputedStyle(div, ':before').getPropertyValue("color"), "rgb(255, 0, 0)");
assert_equals(getComputedStyle(div, '::before').getPropertyValue("color"), "rgb(255, 0, 0)");
}, "Existing :before pseudoelement");
test(function() {
var div = document.getElementById("foo");
assert_equals(getComputedStyle(div, ':after').getPropertyValue("color"), "");
assert_equals(getComputedStyle(div, '::after').getPropertyValue("color"), "");
}, "Missing :after pseudoelement");
</script>
</body>
</html>