Merge remote-tracking branch 'origin' into filaraujo-feature/domTemplate

This commit is contained in:
Kevin Schaaf 2016-02-04 11:45:22 -08:00
commit eb70ea9731
8 changed files with 30 additions and 18 deletions

View File

@ -167,8 +167,8 @@ MyElement = Polymer({
is: 'my-element',
factoryImpl: function(foo, bar) {
el.foo = foo;
el.configureWithBar(bar);
this.foo = foo;
this.configureWithBar(bar);
},
configureWithBar: function(bar) {

View File

@ -60,8 +60,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
return prototype.constructor;
};
window.Polymer = Polymer;
if (userPolymer) {
for (var i in userPolymer) {
Polymer[i] = userPolymer[i];
@ -98,4 +96,3 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
};
</script>

View File

@ -30,9 +30,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* :host(...) -> scopeName...
* ::content -> ' ' NOTE: requires use of scoping selector and selectors
cannot otherwise be scoped:
e.g. :host ::content > .bar -> x-foo > .bar
* ::content -> ' '
* ::shadow, /deep/: processed similar to ::content
@ -161,6 +159,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
var stop = false;
var hostContext = false;
var self = this;
selector = selector.replace(CONTENT_START, HOST + ' $1');
selector = selector.replace(SIMPLE_SELECTOR_SEP, function(m, c, s) {
if (!stop) {
var info = self._transformCompoundSelector(s, c, scope, hostScope);
@ -256,7 +255,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
// NOTE: this supports 1 nested () pair for things like
// :host(:not([selected]), more general support requires
// parsing which seems like overkill
var HOST_PAREN = /(\:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/g;
var HOST_PAREN = /(:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/g;
var HOST_CONTEXT = ':host-context';
var HOST_CONTEXT_PAREN = /(.*)(?::host-context)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))(.*)/;
var CONTENT = '::content';
@ -266,6 +265,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
var CSS_ATTR_SUFFIX = ']';
var PSEUDO_PREFIX = ':';
var CLASS = 'class';
var CONTENT_START = new RegExp('^(' + CONTENT + ')');
// exports
return api;

View File

@ -136,7 +136,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
for (var i=0, l=fx.length, x; (i<l) && (x=fx[i]); i++) {
// TODO(kschaaf): compound bindings (as well as computed effects)
// are excluded from top-down configure for now; to be revisited
if (x.kind === 'annotation' && !x.isCompound) {
if (x.kind === 'annotation' &&
x.effect.kind !== 'attribute' &&
!x.isCompound) {
var node = this._nodes[x.effect.index];
// seeding configuration only
if (node._configValue) {

View File

@ -283,7 +283,11 @@ suite('hostAttributes', function() {
// applied to property with effect
assert.strictEqual(compose.$.basic.prop, 'compose');
assert.equal(compose.$.basic.propChangedCount, 1);
assert.equal(compose.$.basic.attr1ChangedCount, 1);
// Note: Attribute binding does not participate in efficient configuration
// per #3288. As such, a property bound with an attribute binding will
// see its default value first, then be overwritten when the attribute
// binding runs and re-deserializes to the property, hence 2 observer calls
assert.equal(compose.$.basic.attr1ChangedCount, 2);
assert.equal(compose.prop2, 'hi');
});

View File

@ -128,7 +128,7 @@
<dom-module id="x-configure-host">
<template>
<x-configure-child id="child" content="{{content}}" object="{{object.goo}}"></x-configure-child>
<x-configure-child id="child" content="{{content}}" object="{{object.goo}}" attr$="{{attrValue}}"></x-configure-child>
</template>
<script>
Polymer({
@ -156,6 +156,9 @@
},
stomp: {
value: 5
},
attrValue: {
value: 'attrValue'
}
}

View File

@ -22,9 +22,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<x-configure-value content="attr" object='{"foo": "obj-attr"}'></x-configure-value>
<x-configure-host></x-configure-host>
<x-configure-host></x-configure-host>
<x-configure-host content="attr"></x-configure-host>
<x-configure-host content="attr"></x-configure-host>
<script>
@ -53,7 +53,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
test('value set in properties initializes correctly', function() {
var e = document.querySelector('x-configure-value');
testConfigure(e, 'default', 'obj-default');
testConfigure(e, 'default', 'obj-default');
});
test('attribute overrides value set in properties', function() {
@ -81,6 +81,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
assert.equal(e.readOnly, 'default');
});
test('properties for attribute bindings not configured', function() {
var e = document.querySelector('x-configure-host');
assert.equal(e.$.child.getAttribute('attr'), 'attrValue');
assert.equal(e.$.child.attr, undefined);
});
});
</script>

View File

@ -200,7 +200,7 @@
box-sizing: border-box;
}
:host ::content .add3 {
::content .add3 {
box-sizing: border-box;
height: 20px;
background: #333;
@ -240,7 +240,7 @@
padding: 4px;
}
:host ::content .add2 {
::content .add2 {
box-sizing: border-box;
height: 20px;
background: gray;
@ -281,7 +281,7 @@
padding: 4px;
}
:host ::content .add1 {
::content .add1 {
box-sizing: border-box;
height: 20px;
background: lightgray;