Skip to content

Commit a862ef8

Browse files
author
Steve Orvell
committed
Merge pull request #3153 from Polymer/3128-kschaaf-literal-forwarding
Ensure literals are excluded from parent props.
2 parents 92edf4a + 526fa3c commit a862ef8

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

src/standard/annotations.html

+8-3
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@
130130
this._notes = this._template._content._notes;
131131
} else {
132132
this._notes = Polymer.Annotations.parseAnnotations(this._template);
133+
this._processAnnotations(this._notes);
133134
}
134-
this._processAnnotations(this._notes);
135135
Polymer.Annotations.prepElement = null;
136136
}
137137
},
@@ -188,10 +188,15 @@
188188
if (p.signature) {
189189
var args = p.signature.args;
190190
for (var kk=0; kk<args.length; kk++) {
191-
pp[args[kk].model] = true;
191+
var model = args[kk].model;
192+
if (model) {
193+
pp[model] = true;
194+
}
192195
}
193196
} else {
194-
pp[p.model] = true;
197+
if (p.model) {
198+
pp[p.model] = true;
199+
}
195200
}
196201
}
197202
}

src/standard/effectBuilder.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,7 @@
222222
;
223223
// basic argument descriptor
224224
var a = {
225-
name: arg,
226-
model: this._modelForPath(arg)
225+
name: arg
227226
};
228227
// detect literal value (must be String or Number)
229228
var fc = arg[0];
@@ -246,6 +245,7 @@
246245
}
247246
// if not literal, look for structured path
248247
if (!a.literal) {
248+
a.model = this._modelForPath(arg);
249249
// detect structured path (has dots)
250250
a.structured = arg.indexOf('.') > 0;
251251
if (a.structured) {

test/unit/templatizer-elements.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
obj="{{obj}}"
1212
obj-prop="{{obj.prop}}"
1313
conflict="{{outerInnerConflict.prop}}"
14+
computed-from-literal="{{computeFromLiteral(33, prop)}}"
1415
></x-child>
1516
</template>
1617
</x-templatizer>
@@ -238,7 +239,8 @@
238239
],
239240
outerObjChanged: function() {},
240241
objAChanged: function() {},
241-
objBChanged: function() {}
242+
objBChanged: function() {},
243+
computeFromLiteral: function() {}
242244
});
243245

244246
</script>

test/unit/templatizer.html

+5
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,11 @@
250250
assert.equal(childA.conflict, 'bar');
251251
});
252252

253+
test('ensure literals are not forwarded to templates', function() {
254+
assert.notOk(host._propertyEffects[33]);
255+
assert.notOk(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(host), 33));
256+
});
257+
253258
});
254259

255260
</script>

0 commit comments

Comments
 (0)