From b2f8e8fe6cf81ef77402b9681c88ace525c966e9 Mon Sep 17 00:00:00 2001 From: Justin Fagnani Date: Thu, 3 Sep 2015 14:03:45 -0700 Subject: [PATCH 1/6] Remove redundant assign to window.Polymer --- src/lib/polymer-bootstrap.html | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/lib/polymer-bootstrap.html b/src/lib/polymer-bootstrap.html index 3386d515..1b9a5fb9 100644 --- a/src/lib/polymer-bootstrap.html +++ b/src/lib/polymer-bootstrap.html @@ -56,8 +56,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]; @@ -94,4 +92,3 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN }; - From bb4d558ac5d4cfd063caaf8065cdf61805d2165b Mon Sep 17 00:00:00 2001 From: Sanndro Date: Thu, 17 Dec 2015 15:32:32 +0100 Subject: [PATCH 2/6] Update PRIMER.md Without testing my changes, I am pretty sure there is a mistake in the documentation. --- PRIMER.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PRIMER.md b/PRIMER.md index 2508799a..11b77286 100644 --- a/PRIMER.md +++ b/PRIMER.md @@ -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) { From 246ea725a1304a43c074327a427976c2a8954041 Mon Sep 17 00:00:00 2001 From: Kevin Schaaf Date: Wed, 13 Jan 2016 10:36:02 -0800 Subject: [PATCH 3/6] Exclude attribute bindings from configuration. Fixes #3288. --- src/standard/configure.html | 4 +++- test/unit/configure-elements.html | 5 ++++- test/unit/configure.html | 12 +++++++++--- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/standard/configure.html b/src/standard/configure.html index d32205aa..8d4102a7 100644 --- a/src/standard/configure.html +++ b/src/standard/configure.html @@ -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 From d9f3dda973af5d97017cbace8b3770f0db3238ad Mon Sep 17 00:00:00 2001 From: Nazar Mokrynskyi Date: Sun, 6 Sep 2015 01:01:31 +0200 Subject: [PATCH 4/6] Eliminate the need to write `:host ::content` instead of just `::content`, while keeping the same processing under the hood --- src/lib/style-transformer.html | 5 ++--- test/unit/polymer-dom-elements.html | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/lib/style-transformer.html b/src/lib/style-transformer.html index 1a072f76..a8832f7a 100644 --- a/src/lib/style-transformer.html +++ b/src/lib/style-transformer.html @@ -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)/, ':host $1'); selector = selector.replace(SIMPLE_SELECTOR_SEP, function(m, c, s) { if (!stop) { var info = self._transformCompoundSelector(s, c, scope, hostScope); diff --git a/test/unit/polymer-dom-elements.html b/test/unit/polymer-dom-elements.html index d4afa8b2..53956048 100644 --- a/test/unit/polymer-dom-elements.html +++ b/test/unit/polymer-dom-elements.html @@ -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; From c6c28f51970c8be164823356ce7211d3ad5ff829 Mon Sep 17 00:00:00 2001 From: Nazar Mokrynskyi Date: Mon, 2 Nov 2015 04:32:39 +0100 Subject: [PATCH 5/6] Using constant rather than plain `:host` and `::content`, also create regexp object only once --- src/lib/style-transformer.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/style-transformer.html b/src/lib/style-transformer.html index a8832f7a..419c38d6 100644 --- a/src/lib/style-transformer.html +++ b/src/lib/style-transformer.html @@ -159,7 +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)/, ':host $1'); + 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); @@ -255,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'; @@ -265,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; From 5205d6ab1f5dcae184f4e3b075718ac5f0ec24d4 Mon Sep 17 00:00:00 2001 From: Kevin Schaaf Date: Thu, 4 Feb 2016 10:30:56 -0800 Subject: [PATCH 6/6] Fix test regression from PR 3289 --- test/unit/attributes.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/unit/attributes.html b/test/unit/attributes.html index 76d4bd76..66e45fba 100644 --- a/test/unit/attributes.html +++ b/test/unit/attributes.html @@ -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'); });