Skip to content

Commit

Permalink
Ensure literals are excluded from parent props.
Browse files Browse the repository at this point in the history
Fixes #3128. Fixes #3121.
  • Loading branch information
kevinpschaaf committed Dec 3, 2015
1 parent 34bf229 commit 526fa3c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
11 changes: 8 additions & 3 deletions src/standard/annotations.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@
this._notes = this._template._content._notes;
} else {
this._notes = Polymer.Annotations.parseAnnotations(this._template);
this._processAnnotations(this._notes);
}
this._processAnnotations(this._notes);
Polymer.Annotations.prepElement = null;
}
},
Expand Down Expand Up @@ -188,10 +188,15 @@
if (p.signature) {
var args = p.signature.args;
for (var kk=0; kk<args.length; kk++) {
pp[args[kk].model] = true;
var model = args[kk].model;
if (model) {
pp[model] = true;
}
}
} else {
pp[p.model] = true;
if (p.model) {
pp[p.model] = true;
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/standard/effectBuilder.html
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,7 @@
;
// basic argument descriptor
var a = {
name: arg,
model: this._modelForPath(arg)
name: arg
};
// detect literal value (must be String or Number)
var fc = arg[0];
Expand All @@ -246,6 +245,7 @@
}
// if not literal, look for structured path
if (!a.literal) {
a.model = this._modelForPath(arg);
// detect structured path (has dots)
a.structured = arg.indexOf('.') > 0;
if (a.structured) {
Expand Down
4 changes: 3 additions & 1 deletion test/unit/templatizer-elements.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
obj="{{obj}}"
obj-prop="{{obj.prop}}"
conflict="{{outerInnerConflict.prop}}"
computed-from-literal="{{computeFromLiteral(33, prop)}}"
></x-child>
</template>
</x-templatizer>
Expand Down Expand Up @@ -238,7 +239,8 @@
],
outerObjChanged: function() {},
objAChanged: function() {},
objBChanged: function() {}
objBChanged: function() {},
computeFromLiteral: function() {}
});

</script>
Expand Down
5 changes: 5 additions & 0 deletions test/unit/templatizer.html
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,11 @@
assert.equal(childA.conflict, 'bar');
});

test('ensure literals are not forwarded to templates', function() {
assert.notOk(host._propertyEffects[33]);
assert.notOk(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(host), 33));
});

});

</script>
Expand Down

0 comments on commit 526fa3c

Please sign in to comment.