Skip to content

Commit 99f23e6

Browse files
author
Steven Orvell
committed
Fix for #1582
1 parent 66c0f39 commit 99f23e6

File tree

3 files changed

+38
-4
lines changed

3 files changed

+38
-4
lines changed

src/mini/ready.html

+2
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,12 @@
135135
// for system overriding
136136
_beforeClientsReady: function() {},
137137
_afterClientsReady: function() {},
138+
_beforeAttached: function() {},
138139

139140
// normalize lifecycle: ensure attached occurs only after ready.
140141
attachedCallback: function() {
141142
if (this._readied) {
143+
this._beforeAttached();
142144
baseAttachedCallback.call(this);
143145
} else {
144146
this._attachedPending = true;

src/standard/x-styling.html

+1-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
<script>
1515
(function() {
1616

17-
var attachedCallback = Polymer.Base.attachedCallback;
1817
var serializeValueToAttribute = Polymer.Base.serializeValueToAttribute;
1918

2019
var propertyUtils = Polymer.StyleProperties;
@@ -44,13 +43,12 @@
4443
this._ownStylePropertyNames.length);
4544
},
4645

47-
attachedCallback: function() {
46+
_beforeAttached: function() {
4847
// note: do this once automatically,
4948
// then requires calling `updateStyles`
5049
if (!this._scopeSelector && this._needsStyleProperties()) {
5150
this._updateStyleProperties();
5251
}
53-
attachedCallback.call(this);
5452
},
5553

5654
_updateStyleProperties: function() {

test/unit/styling-cross-scope-var.html

+35-1
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,30 @@
123123
</script>
124124
</dom-module>
125125

126+
<dom-module id="x-has-if">
127+
<style>
128+
.iffy {
129+
border: var(--scope-var);
130+
}
131+
</style>
132+
133+
<template>
134+
<template is="dom-if" if="{{gogo}}">
135+
<div class="iffy">iffy</div>
136+
</template>
137+
</template>
138+
<script>
139+
HTMLImports.whenReady(function() {
140+
Polymer({
141+
is: 'x-has-if',
142+
properties: {
143+
gogo: {value: true}
144+
}
145+
});
146+
});
147+
</script>
148+
</dom-module>
149+
126150
<dom-module id="x-scope">
127151
<style>
128152
:host {
@@ -197,10 +221,13 @@
197221
<div id="calc">Calc</div>
198222
<div id="shadow">Shadow</div>
199223
<x-host-property id="hostProp"></x-host-property>
224+
<x-has-if id="iffy"></x-has-if>
200225
</template>
201226
<script>
202227
HTMLImports.whenReady(function() {
203-
Polymer({is: 'x-scope'});
228+
Polymer({
229+
is: 'x-scope'
230+
});
204231
});
205232
</script>
206233
</dom-module>
@@ -299,6 +326,13 @@
299326
}
300327
assertComputed(styled.$.child.$.me, '2px');
301328
});
329+
330+
test('style properties with dom-if', function() {
331+
var e = styled.$.iffy;
332+
var c = Polymer.dom(e.root).querySelector('.iffy');
333+
assert.ok(c, 'dom-if did not stamp');
334+
assertComputed(c, '1px');
335+
});
302336

303337
});
304338

0 commit comments

Comments
 (0)