Skip to content

Commit e2c272e

Browse files
committed
style inside template
1 parent acba4db commit e2c272e

File tree

5 files changed

+99
-97
lines changed

5 files changed

+99
-97
lines changed

.versions

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
babel-compiler@6.13.0
2-
babel-runtime@0.1.12
1+
babel-compiler@6.14.1
2+
babel-runtime@1.0.1
33
blaze-tools@1.0.10
44
caching-compiler@1.1.9
55
caching-html-compiler@1.0.7
66
deps@1.0.12
7-
ecmascript@0.5.9
7+
ecmascript@0.6.3
88
ecmascript-runtime@0.3.15
99
html-tools@1.0.11
1010
htmljs@1.0.11
11-
meteor@1.6.0
12-
minifier-js@1.2.14
13-
modules@0.7.7
14-
modules-runtime@0.7.7
15-
mwc:layout@1.1.22
11+
meteor@1.6.1
12+
minifier-js@1.2.18
13+
modules@0.7.9
14+
modules-runtime@0.7.9
15+
mwc:layout@1.1.23
1616
mwc:synthesis@1.3.7
1717
mwc:synthesis-compiler@1.3.5
1818
promise@0.8.8
1919
random@1.0.10
2020
spacebars-compiler@1.0.13
2121
templating-tools@1.0.5
22-
tracker@1.0.14
22+
tracker@1.1.2
2323
underscore@1.0.10

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
"type": "git",
1212
"url": "https://github.com/meteorwebcomponents/layout.git"
1313
},
14-
"version": "1.1.21"
14+
"version": "1.1.23"
1515
}

mwc-layout.html

Lines changed: 84 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,111 +1,112 @@
11
<dom-module id="mwc-layout">
22

3+
<template>
34
<style>
4-
:host {
5-
display: none!important;
6-
}
7-
5+
:host {
6+
display: none!important;
7+
}
8+
89
:host([active]) {
9-
display: block!important;
10+
display: block!important;
1011
}
1112
</style>
1213

13-
<template>
14-
<content class="mwc-layout" select="*"></content>
15-
</template>
16-
17-
<script>
18-
// HTMLImports.whenReady(function() {
19-
Polymer({
20-
21-
activeChange: function(newValue, oldValue) {
22-
if (newValue === false && oldValue === true) {
23-
var region = Object.keys(this.opt);
24-
25-
for (var A = 0; A < region.length; A++) {
26-
var element = this.querySelectorAll('*[region="' + region[A] + '"]');
27-
28-
for (Z = 0; Z < element.length; Z++) {
29-
element[Z].innerHTML = "";
30-
}
31-
}
32-
}
33-
},
34-
35-
is: "mwc-layout",
36-
37-
properties: {
38-
active: {
39-
notify: true,
40-
observer: "activeChange",
41-
reflectToAttribute: true,
42-
type: Boolean,
43-
value: false
44-
},
45-
opt: {
46-
type: Object
47-
}
48-
},
49-
50-
render: function(opt) {
51-
var region = Object.keys(opt);
52-
53-
for (var A = 0; A < region.length; A++) {
54-
if (typeof(opt[region[A]]) === "object") {
55-
var element = this.querySelectorAll('*[region="' + region[A] + '"]');
56-
57-
for (Z = 0; Z < element.length; Z++) {
58-
element[Z].innerHTML = "";
59-
60-
Polymer.dom(element[Z]).appendChild(opt[region[A]]);
61-
}
62-
} else {
63-
if (document.createElement(opt[region[A]]).constructor !== HTMLElement) {
64-
var element = this.querySelectorAll('*[region="' + region[A] + '"]');
65-
66-
for (Z = 0; Z < element.length; Z++) {
67-
element[Z].innerHTML = "";
68-
69-
Polymer.dom(element[Z]).appendChild(document.createElement(opt[region[A]]));
70-
}
71-
} else {
72-
console.log(opt[region[A]] + " not registered");
73-
}
74-
}
75-
}
76-
77-
this.opt = opt;
14+
15+
<content class="mwc-layout" select="*"></content>
16+
</template>
17+
18+
<script>
19+
// HTMLImports.whenReady(function() {
20+
Polymer({
21+
22+
activeChange: function(newValue, oldValue) {
23+
if (newValue === false && oldValue === true) {
24+
var region = Object.keys(this.opt);
25+
26+
for (var A = 0; A < region.length; A++) {
27+
var element = this.querySelectorAll('*[region="' + region[A] + '"]');
28+
29+
for (Z = 0; Z < element.length; Z++) {
30+
element[Z].innerHTML = "";
31+
}
32+
}
33+
}
34+
},
35+
36+
is: "mwc-layout",
37+
38+
properties: {
39+
active: {
40+
notify: true,
41+
observer: "activeChange",
42+
reflectToAttribute: true,
43+
type: Boolean,
44+
value: false
45+
},
46+
opt: {
47+
type: Object
48+
}
49+
},
50+
51+
render: function(opt) {
52+
var region = Object.keys(opt);
53+
54+
for (var A = 0; A < region.length; A++) {
55+
if (typeof(opt[region[A]]) === "object") {
56+
var element = this.querySelectorAll('*[region="' + region[A] + '"]');
57+
58+
for (Z = 0; Z < element.length; Z++) {
59+
element[Z].innerHTML = "";
60+
61+
Polymer.dom(element[Z]).appendChild(opt[region[A]]);
62+
}
63+
} else {
64+
if (document.createElement(opt[region[A]]).constructor !== HTMLElement) {
65+
var element = this.querySelectorAll('*[region="' + region[A] + '"]');
66+
67+
for (Z = 0; Z < element.length; Z++) {
68+
element[Z].innerHTML = "";
69+
70+
Polymer.dom(element[Z]).appendChild(document.createElement(opt[region[A]]));
71+
}
72+
} else {
73+
console.log(opt[region[A]] + " not registered");
7874
}
75+
}
76+
}
7977

80-
});
81-
// });
82-
</script>
78+
this.opt = opt;
79+
}
80+
81+
});
82+
// });
83+
</script>
8384

8485
</dom-module>
8586

8687
<script>
8788
var PolymerLayout = function() {
88-
this.currentLayout = null;
89+
this.currentLayout = null;
8990
};
9091

9192
// layout[String]
9293
// opt[Object] one-level deep
9394
// forceRender[Boolean]
9495

9596
PolymerLayout.prototype.render = function(layout, opt, forceRender) {
96-
if (document.querySelector('mwc-layout[id="' + layout + '"]')) {
97-
if (this.currentLayout != layout || forceRender) {
98-
if (this.currentLayout) {
99-
document.querySelector('mwc-layout[id="' + this.currentLayout + '"]').active = false
100-
}
97+
if (document.querySelector('mwc-layout[id="' + layout + '"]')) {
98+
if (this.currentLayout != layout || forceRender) {
99+
if (this.currentLayout) {
100+
document.querySelector('mwc-layout[id="' + this.currentLayout + '"]').active = false
101+
}
101102

102-
document.querySelector('mwc-layout[id="' + layout + '"]').render(Object.prototype.toString.call(opt) == "[object Object]" ? opt : {});
103+
document.querySelector('mwc-layout[id="' + layout + '"]').render(Object.prototype.toString.call(opt) == "[object Object]" ? opt : {});
103104

104-
document.querySelector('mwc-layout[id="' + layout + '"]').active = true;
105+
document.querySelector('mwc-layout[id="' + layout + '"]').active = true;
105106

106-
this.currentLayout = layout;
107-
}
107+
this.currentLayout = layout;
108108
}
109+
}
109110
};
110111

111112
mwcLayout = new PolymerLayout();

mwc_layout.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
<dom-module id="mwc-layout">
22

3-
<style>
3+
<template>
4+
<style>
45
:host {
56
display: none!important;
67
}
78

89
:host([active]) {
910
display: block!important;
1011
}
11-
</style>
12+
</style>
13+
1214

13-
<template>
1415
<content class="mwc-layout" select="*"></content>
1516
</template>
1617

package.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Package.describe({
33
git: "https://github.com/meteorwebcomponents/layout.git",
44
name: "mwc:layout",
55
summary: "Polymer Layout renderer",
6-
version: "1.1.22"
6+
version: "1.1.23"
77
});
88

99
Package.onUse(function(api) {

0 commit comments

Comments
 (0)