forked from WebKit/WebKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathElement-style.html
More file actions
46 lines (40 loc) · 2.13 KB
/
Element-style.html
File metadata and controls
46 lines (40 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<!DOCTYPE html>
<html>
<body>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<div id="testDiv" style="background-color: red"></div>
<svg id="testSVG" style="background-color: red"></div>
<script>
test(() => {
const testDiv = document.getElementById("testDiv");
assert_equals(testDiv.__proto__, HTMLDivElement.prototype, "testDiv is an HTMLDivElement");
assert_idl_attribute(testDiv, "style", "HTMLElement has 'style' attribute");
assert_own_property(HTMLElement.prototype, "style", "'style' is on HTMLElement prototype");
const testSVG = document.getElementById("testSVG");
assert_equals(testSVG.__proto__, SVGSVGElement.prototype, "testSVG is an SVGSVGElement");
assert_idl_attribute(testSVG, "style", "SVGElement has 'style' attribute");
assert_own_property(SVGElement.prototype, "style", "'style' is on SVGElement prototype");
assert_not_own_property("Element.prototype", "style", "'style' is not on Element prototype");
}, "'style' property location");
test(() => {
const testDiv = document.getElementById("testDiv");
assert_equals(testDiv.style.__proto__, CSSStyleDeclaration.prototype, "HTMLElement.style type");
const testSVG = document.getElementById("testSVG");
assert_equals(testSVG.style.__proto__, CSSStyleDeclaration.prototype, "SVGElement.style type");
}, "'style' property type");
test(() => {
const testDiv = document.getElementById("testDiv");
assert_equals(testDiv.style.backgroundColor, "red", "HTMLElement.style getter");
assert_readonly(testDiv, "style", "HTMLElement.style is readonly");
testDiv.style = "background-color: green";
assert_equals(testDiv.style.backgroundColor, "green", "HTMLElement.style setter");
const testSVG = document.getElementById("testSVG");
assert_equals(testSVG.style.backgroundColor, "red", "SVGElement.style getter");
assert_readonly(testSVG, "style", "SVGElement.style is readonly");
testSVG.style = "background-color: green";
assert_equals(testSVG.style.backgroundColor, "green", "SVGElement.style setter");
}, "style should be settable");
</script>
</body>
</html>