mirror of
https://github.com/servo/servo.git
synced 2025-07-05 22:43:40 +01:00
101 lines
No EOL
2.9 KiB
HTML
101 lines
No EOL
2.9 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml"><head>
|
|
<title>CSSOM Test: CSSStyleDeclaration.cssText Test</title>
|
|
<link href="coarse.ground@gmail.com" rel="author" title="kkoichi" />
|
|
<link href="simonp@opera.com" rel="reviewer" title="Simon Pieters" /><!-- 06-27-2013 -->
|
|
<link href="https://drafts.csswg.org/cssom-1/#dom-cssstyledeclaration-csstext" rel="help" />
|
|
<meta content="CSS declarations is serialized as expected" name="assert" />
|
|
<meta content="dom" name="flags" />
|
|
<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';
|
|
|
|
assert_equals(style.cssText, '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> |