Merge branch 'master' into rewrite-expression-parser

This commit is contained in:
Tim van der Lippe
2018-03-31 15:52:33 +02:00
23 changed files with 308 additions and 23 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ If you are asking a question rather than filing a bug, try one of these instead:
#### Live Demo
<!-- jsBin starting point (fork and edit) -->
https://jsbin.com/luhaxab/1/edit
https://jsbin.com/luhaxab/edit
<!-- glitch.me starting point (remix and edit -- must be logged in to persist!) -->
https://glitch.com/edit/#!/polymer-repro?path=my-element.html:2:0
<!-- ...or provide your own repro URL -->
+125
View File
@@ -1,5 +1,130 @@
# Change Log
## [v2.6.0](https://github.com/Polymer/polymer/tree/v2.6.0) (2018-03-22)
- Use function instead of Set ([commit](https://github.com/Polymer/polymer/commit/33d2e1a8))
- [ci skip] Fix typo ([commit](https://github.com/Polymer/polymer/commit/0d1b1c2e))
- Fix test in shady DOM ([commit](https://github.com/Polymer/polymer/commit/a586b72c))
- Deduplicate style includes ([commit](https://github.com/Polymer/polymer/commit/acfef71d))
- use a clearer test for shadowRoot ([commit](https://github.com/Polymer/polymer/commit/b2fb1cfd))
- Returning null in template should nullify parent template ([commit](https://github.com/Polymer/polymer/commit/2a6c0a2a))
- [ci skip] Add clarifying comment ([commit](https://github.com/Polymer/polymer/commit/0573d483))
- Correct the JSBin version ([commit](https://github.com/Polymer/polymer/commit/cb1ae7d3))
- Put attribute capitalization fix in property-effects ([commit](https://github.com/Polymer/polymer/commit/d45dd575))
- Add note about pre v3 releases ([commit](https://github.com/Polymer/polymer/commit/f9391618))
- Add note for npm package ([commit](https://github.com/Polymer/polymer/commit/8f2cc0d5))
- Add iron-component-page dev-dependency ([commit](https://github.com/Polymer/polymer/commit/d93dd1ce))
- Update several gulp dependencies ([commit](https://github.com/Polymer/polymer/commit/ca57a1f3))
- Update dom5 to 3.0.0 ([commit](https://github.com/Polymer/polymer/commit/d4a0914e))
- Update Google Closure Compiler version and fix cast ([commit](https://github.com/Polymer/polymer/commit/4004c9c4))
- Update types ([commit](https://github.com/Polymer/polymer/commit/bb61a20d))
- Fix several issues in the documentation of dom-* elements ([commit](https://github.com/Polymer/polymer/commit/8e1b3f45))
- Handle `disabled` attribute correctly for tap gesture ([commit](https://github.com/Polymer/polymer/commit/5c0f3e6a))
- add test case for nested label ([commit](https://github.com/Polymer/polymer/commit/c11c99b2))
- Add docs and cleanup matchingLabels ([commit](https://github.com/Polymer/polymer/commit/e1df1662))
- Add tests ([commit](https://github.com/Polymer/polymer/commit/70edf1f8))
- update types ([commit](https://github.com/Polymer/polymer/commit/2d674e75))
- fix tests and add dependency import ([commit](https://github.com/Polymer/polymer/commit/a37ba7e2))
- fix typings ([commit](https://github.com/Polymer/polymer/commit/8f8135b2))
- Ensure DisableUpgradeMixin extends PropertiesMixin ([commit](https://github.com/Polymer/polymer/commit/7e74e363))
- Format comment and remove deduping mixin ([commit](https://github.com/Polymer/polymer/commit/b8c66ded))
- update types ([commit](https://github.com/Polymer/polymer/commit/1fd5f9cf))
- update types ([commit](https://github.com/Polymer/polymer/commit/5bc45ce3))
- Add mixin to automatically detect capitalized HTML attributes ([commit](https://github.com/Polymer/polymer/commit/37fd5ffe))
- Add instructions for locally viewing the source documentation ([commit](https://github.com/Polymer/polymer/commit/206d3610))
- Simplify condition checking in stylesFromModule function ([commit](https://github.com/Polymer/polymer/commit/e6903821))
- Bump type generator and generate new typings. (#5119) ([commit](https://github.com/Polymer/polymer/commit/5c027309))
- dispatchEvent returns boolean (#5117) ([commit](https://github.com/Polymer/polymer/commit/9d86135c))
- Update types ([commit](https://github.com/Polymer/polymer/commit/63e7bbc7))
- Fix license links ([commit](https://github.com/Polymer/polymer/commit/f3939875))
- Fix issue with not genering the Templatizer docs ([commit](https://github.com/Polymer/polymer/commit/55708acf))
- Bump TS type generator to pick up transitive mixin handling. ([commit](https://github.com/Polymer/polymer/commit/c3dad540))
- Remove unnecessary mutableData property from MutableData mixin ([commit](https://github.com/Polymer/polymer/commit/92b83249))
- Update types ([commit](https://github.com/Polymer/polymer/commit/868fba7c))
- Add note to updateStyles regarding updates to CSS mixins ([commit](https://github.com/Polymer/polymer/commit/d458bab3))
- Avoid timing issues with polyfilled Promise ([commit](https://github.com/Polymer/polymer/commit/6b3e007e))
- Revert use of async/await due to lack of build/serve support. ([commit](https://github.com/Polymer/polymer/commit/d4a7a45b))
- Revert types. ([commit](https://github.com/Polymer/polymer/commit/dea90802))
- Update eslint parserOptions to es2017 for async/await support. ([commit](https://github.com/Polymer/polymer/commit/ef579e29))
- Use stronger check for PropertyEffects clients. Fixes #5017 ([commit](https://github.com/Polymer/polymer/commit/e6d558ec))
- Remove unneeded file ([commit](https://github.com/Polymer/polymer/commit/a5393b6d))
- [PropertiesChanged]: allow old data to be gc'd after `_propertiesChanged` ([commit](https://github.com/Polymer/polymer/commit/74907b9a))
- Update package-lock.json ([commit](https://github.com/Polymer/polymer/commit/c58f3e0d))
- Make Travis update-types failure style the same as the elements. ([commit](https://github.com/Polymer/polymer/commit/8189382d))
- Bump TypeScript generator version. ([commit](https://github.com/Polymer/polymer/commit/3e432190))
- Make EventApi.path EventTarget type non-nullable. ([commit](https://github.com/Polymer/polymer/commit/3ede9b51))
- Lint and type fixes ([commit](https://github.com/Polymer/polymer/commit/5607a2d8))
- [PropertiesChanged]: adds _shouldPropertiesChange ([commit](https://github.com/Polymer/polymer/commit/c1885a6a))
- Update docs: templatize() cannot be called multiple times ([commit](https://github.com/Polymer/polymer/commit/27fc21c5))
- [ci skip] update changelog ([commit](https://github.com/Polymer/polymer/commit/65b4df86))
- Update types. ([commit](https://github.com/Polymer/polymer/commit/c3b6236a))
- Fix JSDoc example formatting ([commit](https://github.com/Polymer/polymer/commit/699cd87f))
- Use latest webcomponents polyfill bundle ([commit](https://github.com/Polymer/polymer/commit/8fef6776))
- Fix label tap by checking matched label pairs ([commit](https://github.com/Polymer/polymer/commit/a77d64e5))
- Defer creation related work via `disable-upgrade` ([commit](https://github.com/Polymer/polymer/commit/a7eb9754))
- lint fixes ([commit](https://github.com/Polymer/polymer/commit/de0ac5a2))
- Adds `Polymer.DisableUpgradeMixin` ([commit](https://github.com/Polymer/polymer/commit/62ce3148))
## [v2.5.0](https://github.com/Polymer/polymer/tree/v2.5.0) (2018-02-02)
- Update types ([commit](https://github.com/Polymer/polymer/commit/5fa059fa))
+5 -3
View File
@@ -105,9 +105,10 @@ Polymer_PropertiesChanged.prototype._shouldPropertyChange = function(property, v
* @param {string} name Name of attribute that changed
* @param {?string} old Old attribute value
* @param {?string} value New attribute value
* @param {?string} namespace Attribute namespace.
* @return {void}
*/
Polymer_PropertiesChanged.prototype.attributeChangedCallback = function(name, old, value){};
Polymer_PropertiesChanged.prototype.attributeChangedCallback = function(name, old, value, namespace){};
/**
* @param {string} attribute Name of attribute to deserialize.
* @param {?string} value of the attribute.
@@ -972,9 +973,10 @@ Polymer_LegacyElementMixin.prototype._initializeProperties = function(){};
* @param {string} name Name of attribute.
* @param {?string} old Old value of attribute.
* @param {?string} value Current value of attribute.
* @param {?string} namespace Attribute namespace.
* @return {void}
*/
Polymer_LegacyElementMixin.prototype.attributeChangedCallback = function(name, old, value){};
Polymer_LegacyElementMixin.prototype.attributeChangedCallback = function(name, old, value, namespace){};
/**
* @override
* @return {void}
@@ -1402,7 +1404,7 @@ Polymer_DisableUpgradeMixin.prototype._enableProperties = function(){};
/**
* @override
*/
Polymer_DisableUpgradeMixin.prototype.attributeChangedCallback = function(name, old, value){};
Polymer_DisableUpgradeMixin.prototype.attributeChangedCallback = function(name, old, value, namespace){};
/**
* @override
*/
+4 -1
View File
@@ -74,17 +74,20 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
return null;
}
/* eslint-disable no-unused-vars */
/**
* @param {string} name Name of attribute.
* @param {?string} old Old value of attribute.
* @param {?string} value Current value of attribute.
* @param {?string} namespace Attribute namespace.
* @return {void}
*/
attributeChangedCallback(name, old, value) {
attributeChangedCallback(name, old, value, namespace) {
if (old !== value) {
this.register();
}
}
/* eslint-enable no-unused-args */
/**
* The absolute URL of the original location of this `dom-module`.
+3 -2
View File
@@ -137,12 +137,13 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {string} name Name of attribute.
* @param {?string} old Old value of attribute.
* @param {?string} value Current value of attribute.
* @param {?string} namespace Attribute namespace.
* @return {void}
* @override
*/
attributeChangedCallback(name, old, value) {
attributeChangedCallback(name, old, value, namespace) {
if (old !== value) {
super.attributeChangedCallback(name, old, value);
super.attributeChangedCallback(name, old, value, namespace);
this.attributeChanged(name, old, value);
}
}
+3 -3
View File
@@ -60,13 +60,13 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
}
/** @override */
attributeChangedCallback(name, old, value) {
attributeChangedCallback(name, old, value, namespace) {
if (name == DISABLED_ATTR) {
if (!this.__dataEnabled && value == null && this.isConnected) {
super.connectedCallback();
}
} else {
super.attributeChangedCallback(name, old, value);
super.attributeChangedCallback(name, old, value, namespace);
}
}
@@ -113,4 +113,4 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
})();
</script>
</script>
+1 -1
View File
@@ -311,9 +311,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
} else {
template = template.cloneNode(true);
}
this.prototype._template = template;
}
this.prototype._template = template;
}
/**
+3 -2
View File
@@ -407,15 +407,16 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {string} name Name of attribute that changed
* @param {?string} old Old attribute value
* @param {?string} value New attribute value
* @param {?string} namespace Attribute namespace.
* @return {void}
* @suppress {missingProperties} Super may or may not implement the callback
*/
attributeChangedCallback(name, old, value) {
attributeChangedCallback(name, old, value, namespace) {
if (old !== value) {
this._attributeToProperty(name, value);
}
if (super.attributeChangedCallback) {
super.attributeChangedCallback(name, old, value);
super.attributeChangedCallback(name, old, value, namespace);
}
}
+9 -1
View File
@@ -43,6 +43,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
READ_ONLY: '__readOnly'
};
/** @const {string} */
const capitalAttributeRegex = /[A-Z]/;
/**
* @typedef {{
* name: (string | undefined),
@@ -2535,7 +2538,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
// Attribute or property
let origName = name;
let kind = 'property';
if (name[name.length-1] == '$') {
// The only way we see a capital letter here is if the attr has
// a capital letter in it per spec. In this case, to make sure
// this binding works, we go ahead and make the binding to the attribute.
if (capitalAttributeRegex.test(name)) {
kind = 'attribute';
} else if (name[name.length-1] == '$') {
name = name.slice(0, -1);
kind = 'attribute';
}
+1 -1
View File
@@ -49,7 +49,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
};
/* eslint-enable */
window.Polymer.version = '2.5.0';
window.Polymer.version = '2.6.0';
/* eslint-disable no-unused-vars */
/*
+1
View File
@@ -113,6 +113,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
}
}
/** @const */
Polymer.Debouncer = Debouncer;
})();
</script>
+3 -1
View File
@@ -123,7 +123,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
// other dom-modules that contain styling
let include = e.getAttribute(INCLUDE_ATTR);
if (include) {
styles.push(...this.stylesFromModules(include));
styles.push(...this.stylesFromModules(include).filter(function(item, index, self) {
return self.indexOf(item) === index;
}));
}
if (baseURI) {
e.textContent = Polymer.ResolveUrl.resolveCss(e.textContent, baseURI);
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@polymer/polymer",
"version": "2.5.0",
"version": "2.6.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@polymer/polymer",
"version": "2.5.0",
"version": "2.6.0",
"description": "The Polymer library makes it easy to create your own web components. Give your element some markup and properties, and then use it on a site. Polymer provides features like dynamic templates and data binding to reduce the amount of boilerplate you need to write",
"main": "polymer.html",
"directories": {
+2
View File
@@ -22,6 +22,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
</template>
</dom-module>
<script>
/** @polymerBehavior */
var MyBehavior = {
properties: {
behaviorProp: {
@@ -37,6 +38,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
}
}
/** @polymerBehavior */
var MyBehavior2 = {
ready: function() {
console.log(this.localName, 'MyBehavior2.ready');
+36 -1
View File
@@ -113,6 +113,24 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
</script>
</dom-module>
<dom-module id="parent-element-template-overriding">
<script>
HTMLImports.whenReady(function() {
class ParentElementWithTemplate extends Polymer.Element {
static get template() {
return Polymer.html`This template should not exist`;
}
}
class ChildWithNoTemplate extends ParentElementWithTemplate {
static get template() {
return null;
}
}
customElements.define('child-with-no-template', ChildWithNoTemplate);
});
</script>
</dom-module>
<test-fixture id="basic">
<template>
<base-el></base-el>
@@ -237,6 +255,23 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
assert.equal(child.handleCustomEvent.callCount, 1);
});
});
suite('child overriding a template', function() {
let el;
setup(function() {
el = document.createElement('child-with-no-template');
document.body.appendChild(el);
});
teardown(function() {
document.body.removeChild(el);
});
test('returning null nullifies the parent template', function() {
assert.equal(el.shadowRoot, null);
});
});
</script>
</body>
</html>
</html>
+22
View File
@@ -7,7 +7,9 @@ The complete set of contributors may be found at http://polymer.github.io/CONTRI
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<link rel="import" href="../../polymer.html">
<link rel="import" href="../../lib/mixins/strict-binding-parser.html">
<dom-module id="x-basic">
<template>
<div id="boundChild"
@@ -1084,3 +1086,23 @@ class SubObserverElement extends SuperObserverElement {
}
customElements.define(SubObserverElement.is, SubObserverElement);
</script>
<dom-module id="svg-element">
<template>
<svg id="svg" viewBox="[[value]]"></svg>
</template>
<script>
class SVGElement extends Polymer.Element {
static get is() { return 'svg-element'; }
static get properties() {
return {
value: {
type: String,
value: '0 0 50 50'
}
};
}
}
customElements.define(SVGElement.is, SVGElement);
</script>
</dom-module>
+17
View File
@@ -427,6 +427,23 @@ suite('single-element binding effects', function() {
});
});
suite('automated attribute capitalization detection', function() {
let el;
setup(function() {
el = document.createElement('svg-element');
document.body.appendChild(el);
});
teardown(function() {
document.body.removeChild(el);
});
test('can handle capitalized HTML attribute', function() {
assert.equal(el.$.svg.getAttribute('viewBox'), el.value);
});
});
suite('can work with strict binding parser', function() {
setup(function() {
document.body.removeChild(el);
+63
View File
@@ -729,6 +729,37 @@ HTMLImports.whenReady(function() {
</script>
</dom-module>
<dom-module id="double-shared-style">
<template>
<style>
.double-shared-style {
color: green;
}
</style>
</template>
</dom-module>
<dom-module id="importing-double-shared-style">
<template>
<style include="double-shared-style">
</style>
</template>
</dom-module>
<dom-module id="double-shared-styling-element">
<template>
<style include="importing-double-shared-style double-shared-style"></style>
</template>
<script>
HTMLImports.whenReady(() => {
class DoubleSharedStylingElement extends Polymer.Element {
static get is() { return 'double-shared-styling-element'; }
}
customElements.define(DoubleSharedStylingElement.is, DoubleSharedStylingElement);
});
</script>
</dom-module>
<script>
(function() {
function assertComputed(element, value, property, pseudo) {
@@ -1012,6 +1043,38 @@ HTMLImports.whenReady(function() {
});
suite('double including style sheets', function() {
let el;
setup(function() {
el = document.createElement('double-shared-styling-element');
document.body.appendChild(el);
});
teardown(function() {
document.body.removeChild(el);
});
test('only includes style modules once', function() {
const style = el.shadowRoot.querySelector('style');
// We cant use the regular "does a sub-node have the correct style",
// because we actually need to assert on the actual style content.
// In native shadow dom, the style element resides in the shadowRoot,
// but in shadyDOM it has moved to the head and the selector has been altered.
if (style) {
assert.equal(style.textContent, `.double-shared-style {
color: green;
}`, 'There should be only one class selector in this style element');
} else {
assert.equal(document.head.querySelector('[scope="double-shared-styling-element"]').textContent,
`.double-shared-style.double-shared-styling-element {
color: green;
}`);
}
});
});
if (window.ShadyDOM) {
suite('scoped-styling-shady-only', function() {
+2 -1
View File
@@ -63,8 +63,9 @@ declare namespace Polymer {
* @param name Name of attribute.
* @param old Old value of attribute.
* @param value Current value of attribute.
* @param namespace Attribute namespace.
*/
attributeChangedCallback(name: string, old: string|null, value: string|null): void;
attributeChangedCallback(name: string, old: string|null, value: string|null, namespace: string|null): void;
/**
* Registers the dom-module at a given id. This method should only be called
+2 -1
View File
@@ -63,8 +63,9 @@ declare namespace Polymer {
* @param name Name of attribute.
* @param old Old value of attribute.
* @param value Current value of attribute.
* @param namespace Attribute namespace.
*/
attributeChangedCallback(name: string, old: string|null, value: string|null): void;
attributeChangedCallback(name: string, old: string|null, value: string|null, namespace: string|null): void;
/**
* Provides an implementation of `connectedCallback`
+1 -1
View File
@@ -42,7 +42,7 @@ declare namespace Polymer {
interface DisableUpgradeMixin {
_initializeProperties(): void;
_enableProperties(): void;
attributeChangedCallback(name: any, old: any, value: any): void;
attributeChangedCallback(name: any, old: any, value: any, namespace: any): void;
connectedCallback(): void;
disconnectedCallback(): void;
}
+2 -1
View File
@@ -235,8 +235,9 @@ declare namespace Polymer {
* @param name Name of attribute that changed
* @param old Old attribute value
* @param value New attribute value
* @param namespace Attribute namespace.
*/
attributeChangedCallback(name: string, old: string|null, value: string|null): void;
attributeChangedCallback(name: string, old: string|null, value: string|null, namespace: string|null): void;
/**
* Deserializes an attribute to its associated property.