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', is: 'my-element',
factoryImpl: function(foo, bar) { factoryImpl: function(foo, bar) {
el.foo = foo; this.foo = foo;
el.configureWithBar(bar); this.configureWithBar(bar);
}, },
configureWithBar: function(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; return prototype.constructor;
}; };
window.Polymer = Polymer;
if (userPolymer) { if (userPolymer) {
for (var i in userPolymer) { for (var i in userPolymer) {
Polymer[i] = userPolymer[i]; Polymer[i] = userPolymer[i];
@ -98,4 +96,3 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
}; };
</script> </script>

View File

@ -30,9 +30,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* :host(...) -> scopeName... * :host(...) -> scopeName...
* ::content -> ' ' NOTE: requires use of scoping selector and selectors * ::content -> ' '
cannot otherwise be scoped:
e.g. :host ::content > .bar -> x-foo > .bar
* ::shadow, /deep/: processed similar to ::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 stop = false;
var hostContext = false; var hostContext = false;
var self = this; var self = this;
selector = selector.replace(CONTENT_START, HOST + ' $1');
selector = selector.replace(SIMPLE_SELECTOR_SEP, function(m, c, s) { selector = selector.replace(SIMPLE_SELECTOR_SEP, function(m, c, s) {
if (!stop) { if (!stop) {
var info = self._transformCompoundSelector(s, c, scope, hostScope); 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 // NOTE: this supports 1 nested () pair for things like
// :host(:not([selected]), more general support requires // :host(:not([selected]), more general support requires
// parsing which seems like overkill // parsing which seems like overkill
var HOST_PAREN = /(\:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/g; var HOST_PAREN = /(:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/g;
var HOST_CONTEXT = ':host-context'; var HOST_CONTEXT = ':host-context';
var HOST_CONTEXT_PAREN = /(.*)(?::host-context)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))(.*)/; var HOST_CONTEXT_PAREN = /(.*)(?::host-context)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))(.*)/;
var CONTENT = '::content'; 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 CSS_ATTR_SUFFIX = ']';
var PSEUDO_PREFIX = ':'; var PSEUDO_PREFIX = ':';
var CLASS = 'class'; var CLASS = 'class';
var CONTENT_START = new RegExp('^(' + CONTENT + ')');
// exports // exports
return api; 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++) { for (var i=0, l=fx.length, x; (i<l) && (x=fx[i]); i++) {
// TODO(kschaaf): compound bindings (as well as computed effects) // TODO(kschaaf): compound bindings (as well as computed effects)
// are excluded from top-down configure for now; to be revisited // 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]; var node = this._nodes[x.effect.index];
// seeding configuration only // seeding configuration only
if (node._configValue) { if (node._configValue) {

View File

@ -283,7 +283,11 @@ suite('hostAttributes', function() {
// applied to property with effect // applied to property with effect
assert.strictEqual(compose.$.basic.prop, 'compose'); assert.strictEqual(compose.$.basic.prop, 'compose');
assert.equal(compose.$.basic.propChangedCount, 1); 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'); assert.equal(compose.prop2, 'hi');
}); });

View File

@ -128,7 +128,7 @@
<dom-module id="x-configure-host"> <dom-module id="x-configure-host">
<template> <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> </template>
<script> <script>
Polymer({ Polymer({
@ -156,6 +156,9 @@
}, },
stomp: { stomp: {
value: 5 value: 5
},
attrValue: {
value: 'attrValue'
} }
} }

View File

@ -81,6 +81,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
assert.equal(e.readOnly, 'default'); 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> </script>

View File

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