-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Expand file tree
/
Copy pathcssstyledeclaration-csstext.html
More file actions
102 lines (72 loc) · 2.92 KB
/
cssstyledeclaration-csstext.html
File metadata and controls
102 lines (72 loc) · 2.92 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<!DOCTYPE html>
<html>
<head>
<title>CSSOM Test: CSSStyleDeclaration.cssText Test</title>
<link rel="author" title="kkoichi" href="mailto:coarse.ground@gmail.com">
<link rel="reviewer" title="Simon Pieters" href="mailto:simonp@opera.com"><!-- 06-27-2013 -->
<link rel="help" href="https://drafts.csswg.org/cssom-1/#dom-cssstyledeclaration-csstext">
<meta name="assert" content="CSS declarations is serialized as expected">
<meta name="flags" content="dom">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
<script>
function newElm() {
return document.body.appendChild(document.createElement('div'));
}
test(function(){
var style = newElm().style;
style.COLOR = 'red';
assert_equals(style.cssText, '');
}, 'uppercase property');
test(function(){
var style = newElm().style;
style.color = 'RED';
// https://www.w3.org/Bugs/Public/show_bug.cgi?id=29317
assert_any(assert_equals, style.cssText, ['color: red;', 'color: RED;']);
}, 'uppercase value');
test(function(){
var style = newElm().style;
style.color = 'red';
style.color = 'unknown color';
assert_equals(style.cssText, 'color: red;');
}, 'overwriting with invalid value');
test(function(){
var style = newElm().style;
style.color = 'rgb(255, 0, 0)';
assert_equals(style.cssText, 'color: rgb(255, 0, 0);');
}, 'use rgb');
test(function(){
var e = newElm();
var style = e.style;
style.color = 'red';
style.fontSize = '10pt';
style.fontWeight = 'bold';
assert_equals(style.cssText, 'color: red; font-size: 10pt; font-weight: bold;');
}, 'cssText order');
test(function(){
var e = newElm();
var style = e.style;
style.fontWeight = 'bold';
style.color = 'red';
style.fontSize = '10pt';
assert_equals(style.cssText, 'font-weight: bold; color: red; font-size: 10pt;');
}, 'another cssText order (non-alphabetical order)');
test(function(){
var style = newElm().style;
style.color = ' red';
style.fontSize = '10pt ';
assert_equals(style.cssText, 'color: red; font-size: 10pt;');
}, 'whitespaces in value');
test(function(){
var style = newElm().style;
style.color = 'red';
style.unknown = 'unknown';
style.fontSize = '10pt';
assert_equals(style.cssText, 'color: red; font-size: 10pt;');
}, 'invalid property does not appear');
</script>
</body>
</html>