OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <head> | 2 <head> |
3 <title>Test background properties obtained by using cssText when the properties
are set by using style element's textContent.</title> | 3 <title>Test background properties obtained by using cssText when the properties
are set by using style element's textContent.</title> |
4 <script src="../../resources/testharness.js"></script> | 4 <script src="../../resources/testharness.js"></script> |
5 <script src="../../resources/testharnessreport.js"></script> | 5 <script src="../../resources/testharnessreport.js"></script> |
6 </head> | 6 </head> |
7 <script> | 7 <script> |
8 test(function() { | 8 test(function() { |
9 var style = document.createElement('style'); | 9 var style = document.createElement('style'); |
10 document.head.appendChild(style); | 10 document.head.appendChild(style); |
11 assert_equals(getStyle('.test { background: none; }'), '.test { background: none
; }'); | 11 assert_equals(getStyle('.test { background: none; }'), '.test { background: none
; }'); |
12 assert_equals(getStyle('.test { background: none; background-color: black;}'), '
.test { background: none black; }'); | 12 assert_equals(getStyle('.test { background: none; background-color: black;}'), '
.test { background: none black; }'); |
13 assert_equals(getStyle('.test { background: none; background-color: initial !imp
ortant;}'), '.test { background-image: none; background-position: initial; backg
round-size: initial; background-repeat: initial; background-attachment: initial;
background-origin: initial; background-clip: initial; background-color: initial
!important; }'); | 13 assert_equals(getStyle('.test { background: none; background-color: initial !imp
ortant;}'), '.test { background-image: none; background-position: initial; backg
round-size: initial; background-repeat: initial; background-attachment: initial;
background-origin: initial; background-clip: initial; background-color: initial
!important; }'); |
14 assert_equals(getStyle('.test { background: initial; }'), '.test { background: i
nitial; }'); | 14 assert_equals(getStyle('.test { background: initial; }'), '.test { background: i
nitial; }'); |
15 assert_equals(getStyle('.test { background: initial; background-color: black; }'
), '.test { background-image: initial; background-position: initial; background-
size: initial; background-repeat: initial; background-attachment: initial; backg
round-origin: initial; background-clip: initial; background-color: black; }'); | 15 assert_equals(getStyle('.test { background: initial; background-color: black; }'
), '.test { background-image: initial; background-position: initial; background-
size: initial; background-repeat: initial; background-attachment: initial; backg
round-origin: initial; background-clip: initial; background-color: black; }'); |
16 assert_equals(getStyle('.test { background: inherit; }'), '.test { background: i
nherit; }'); | 16 assert_equals(getStyle('.test { background: inherit; }'), '.test { background: i
nherit; }'); |
17 assert_equals(getStyle('.test { background: inherit; background-color: black; }'
), '.test { background-image: inherit; background-position: inherit; background-
size: inherit; background-repeat: inherit; background-attachment: inherit; backg
round-origin: inherit; background-clip: inherit; background-color: black; }'); | 17 assert_equals(getStyle('.test { background: inherit; background-color: black; }'
), '.test { background-image: inherit; background-position: inherit; background-
size: inherit; background-repeat: inherit; background-attachment: inherit; backg
round-origin: inherit; background-clip: inherit; background-color: black; }'); |
| 18 assert_equals(getStyle('.test { background: unset; background-color: black; }'),
'.test { background-image: unset; background-position: unset; background-size:
unset; background-repeat: unset; background-attachment: unset; background-origin
: unset; background-clip: unset; background-color: black; }'); |
| 19 assert_equals(getStyle('.test { background: unset; }'), '.test { background: uns
et; }'); |
18 assert_equals(getStyle('.test { background: none; background-repeat: repeat-x !i
mportant;}'), '.test { background-image: none; background-position: initial; bac
kground-size: initial; background-attachment: initial; background-origin: initia
l; background-clip: initial; background-color: initial; background-repeat: repea
t-x !important; }'); | 20 assert_equals(getStyle('.test { background: none; background-repeat: repeat-x !i
mportant;}'), '.test { background-image: none; background-position: initial; bac
kground-size: initial; background-attachment: initial; background-origin: initia
l; background-clip: initial; background-color: initial; background-repeat: repea
t-x !important; }'); |
19 assert_equals(getStyle('.test { background: none; background-repeat: repeat-x;}'
), '.test { background: none repeat-x; }'); | 21 assert_equals(getStyle('.test { background: none; background-repeat: repeat-x;}'
), '.test { background: none repeat-x; }'); |
20 assert_equals(getStyle('.test { background: none; background-position-x: 0%;}'),
'.test { background: none 0%; }'); | 22 assert_equals(getStyle('.test { background: none; background-position-x: 0%;}'),
'.test { background: none 0%; }'); |
21 assert_equals(getStyle('.test { background: none; background-position: 20% 80%;}
'), '.test { background: none 20% 80%; }'); | 23 assert_equals(getStyle('.test { background: none; background-position: 20% 80%;}
'), '.test { background: none 20% 80%; }'); |
22 assert_equals(getStyle('.test { background-position-x: 5%; }'), '.test { backgro
und-position-x: 5%; }'); | 24 assert_equals(getStyle('.test { background-position-x: 5%; }'), '.test { backgro
und-position-x: 5%; }'); |
23 assert_equals(getStyle('.test { background-position-y: 5%; }'), '.test { backgro
und-position-y: 5%; }'); | 25 assert_equals(getStyle('.test { background-position-y: 5%; }'), '.test { backgro
und-position-y: 5%; }'); |
24 assert_equals(getStyle('.test { background-position-x: 5%; background-position-y
: 10%; }'), '.test { background-position: 5% 10%; }'); | 26 assert_equals(getStyle('.test { background-position-x: 5%; background-position-y
: 10%; }'), '.test { background-position: 5% 10%; }'); |
25 assert_equals(getStyle('.test { background-position-x: 5%; background-position-y
: 10% !important; }'), '.test { background-position-x: 5%; background-position-y
: 10% !important; }'); | 27 assert_equals(getStyle('.test { background-position-x: 5%; background-position-y
: 10% !important; }'), '.test { background-position-x: 5%; background-position-y
: 10% !important; }'); |
26 assert_equals(getStyle('.test { background: url(dummy://test.png); }'), '.test {
background: url("dummy://test.png"); }'); | 28 assert_equals(getStyle('.test { background: url(dummy://test.png); }'), '.test {
background: url("dummy://test.png"); }'); |
27 assert_equals(getStyle('.test { background: url(dummy://test.png); background-co
lor: black; }'), '.test { background: url("dummy://test.png") black; }'); | 29 assert_equals(getStyle('.test { background: url(dummy://test.png); background-co
lor: black; }'), '.test { background: url("dummy://test.png") black; }'); |
28 | 30 |
29 function getStyle(text) { | 31 function getStyle(text) { |
30 style.textContent = text; | 32 style.textContent = text; |
31 return style.sheet.cssRules[0].cssText; | 33 return style.sheet.cssRules[0].cssText; |
32 } | 34 } |
33 }); | 35 }); |
34 </script> | 36 </script> |
OLD | NEW |