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',
|
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) {
|
||||||
|
@ -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>
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
@ -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) {
|
||||||
|
@ -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');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -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'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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-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>
|
<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() {
|
test('value set in properties initializes correctly', function() {
|
||||||
var e = document.querySelector('x-configure-value');
|
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() {
|
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');
|
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>
|
||||||
|
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user