File tree 2 files changed +87
-0
lines changed
2 files changed +87
-0
lines changed Original file line number Diff line number Diff line change 20
20
var matchesSelector = Polymer . DomApi . matchesSelector ;
21
21
var styleUtil = Polymer . StyleUtil ;
22
22
var styleTransformer = Polymer . StyleTransformer ;
23
+ var IS_IE = navigator . userAgent . match ( 'Trident' ) ;
23
24
24
25
var settings = Polymer . Settings ;
25
26
493
494
}
494
495
element . _customStyle = style ;
495
496
}
497
+ // @media rules may be stale in IE 10 and 11
498
+ if ( IS_IE ) {
499
+ style . textContent = style . textContent ;
500
+ }
496
501
return style ;
497
502
} ,
498
503
Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html >
3
+ < head >
4
+ < script src ="../../../webcomponentsjs/webcomponents-lite.min.js "> </ script >
5
+ < link href ="../../polymer.html " rel ="import ">
6
+
7
+ < style >
8
+
9
+ @media (min-width : 800px ) {
10
+ body {
11
+ background : red;
12
+ }
13
+ }
14
+
15
+ @media (max-width : 799px ) {
16
+ body {
17
+ background : green;
18
+ }
19
+ }
20
+ </ style >
21
+
22
+
23
+ </ head >
24
+ < body >
25
+
26
+ < dom-module id ="x-foo ">
27
+ < template >
28
+ < style >
29
+
30
+ : host {
31
+ dis play: block;
32
+ margin- left: var(--foo , 0px);
33
+ }
34
+
35
+ .item {
36
+ width : 100px ;
37
+ height : 100px ;
38
+ border : 1px solid white;
39
+ }
40
+
41
+ @media (min-width : 800px ) {
42
+ : host {
43
+ --foo : 10px ;
44
+ }
45
+
46
+ .item {
47
+ background : red;
48
+ }
49
+ }
50
+
51
+ @media (max-width : 799px ) {
52
+ .item {
53
+ background : green;
54
+ }
55
+ }
56
+
57
+ </ style >
58
+
59
+ < div class ="item "> </ div >
60
+ </ template >
61
+ < script >
62
+ HTMLImports . whenReady ( function ( ) {
63
+ Polymer ( {
64
+ is : 'x-foo'
65
+ } ) ;
66
+ } ) ;
67
+ var debouncer ;
68
+ window . onresize = function ( ) {
69
+ Polymer . Debounce ( debouncer , function ( ) {
70
+ Polymer . updateStyles ( ) ;
71
+ } , 100 ) ;
72
+ } ;
73
+ </ script >
74
+ </ dom-module >
75
+
76
+
77
+ < h1 > The box should match the background color</ h1 >
78
+
79
+ < x-foo > </ x-foo >
80
+
81
+ </ body >
82
+ </ html >
You can’t perform that action at this time.
0 commit comments