mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
Merge remote-tracking branch 'origin' into filaraujo-feature/domTemplate
This commit is contained in:
commit
eb70ea9731
@ -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) {
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -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');
|
||||
});
|
||||
|
||||
|
@ -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'
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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>
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user