diff --git a/.eslintrc.json b/.eslintrc.json
index 04b84c2059..027f90891b 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -4,7 +4,21 @@
"rules": {
"no-console": "off",
"no-var": "error",
- "strict": "error"
+ "strict": "error",
+ "valid-jsdoc": ["error", {
+ "requireReturn": false,
+ "prefer": {
+ "arg": "param",
+ "argument": "param",
+ "returns": "return"
+ },
+ "preferType": {
+ "Boolean": "boolean",
+ "Number": "number",
+ "String": "string",
+ "object": "Object"
+ }
+ }]
},
"env": {
"browser": true,
diff --git a/.travis.yml b/.travis.yml
index 6465d133dd..cdb0129741 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,11 +8,14 @@ addons:
sources:
- google-chrome
packages:
- - google-chrome-stable
+ - google-chrome-beta
cache:
directories:
- node_modules
before_script:
+- mkdir -p ~/bin
+- ln -s /usr/bin/google-chrome-beta ~/bin/google-chrome
+- export PATH=$HOME/bin:$PATH
- npm install -g bower gulp-cli@1
- bower install
- gulp lint
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 37b25484d7..7747fca641 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,6 @@
# Change Log
-##[v1.8.1-dev](https://github.com/Polymer/polymer/tree/v1.8.1-dev) (2017-02-27)
+## [v1.8.1-dev](https://github.com/Polymer/polymer/tree/v1.8.1-dev) (2017-02-27)
- Exclude SD polyfill tests for Edge due to lack of workarounds for Edge DocFrag bugs. ([commit](https://github.com/Polymer/polymer/commit/de45ba02))
- [ci skip] Update comment to include reference to problem browser. ([commit](https://github.com/Polymer/polymer/commit/72f21fe6))
@@ -23,7 +23,7 @@
- [ci skip] Update Changelog ([commit](https://github.com/Polymer/polymer/commit/2d804a28))
-##[v1.8.0-dev](https://github.com/Polymer/polymer/tree/v1.8.0-dev) (2017-02-06)
+## [v1.8.0-dev](https://github.com/Polymer/polymer/tree/v1.8.0-dev) (2017-02-06)
- Add comment. ([commit](https://github.com/Polymer/polymer/commit/a42cb209))
- Only keep `disable-upgrade` attribute if it is an attribute binding. ([commit](https://github.com/Polymer/polymer/commit/62e9b84b))
@@ -76,7 +76,7 @@
- Close backtick in ISSUE_TEMPLATE.md ([commit](https://github.com/Polymer/polymer/commit/b0dea8bc))
-##[v1.7.1-dev](https://github.com/Polymer/polymer/tree/v1.7.1-dev) (2016-12-14)
+## [v1.7.1-dev](https://github.com/Polymer/polymer/tree/v1.7.1-dev) (2016-12-14)
- Remove dependency on WebComponets for IE detection ([commit](https://github.com/Polymer/polymer/commit/650c16a9))
- Make sure text nodes are distributed when translating slot to content ([commit](https://github.com/Polymer/polymer/commit/87e312f1))
@@ -121,7 +121,7 @@
- Fix copy&pasted comment ([commit](https://github.com/Polymer/polymer/commit/d595c0cc))
-##[v1.7.0](https://github.com/Polymer/polymer/tree/v1.7.0) (2016-09-28)
+## [v1.7.0](https://github.com/Polymer/polymer/tree/v1.7.0) (2016-09-28)
- Fix IE style cache performance ([commit](https://github.com/Polymer/polymer/commit/d08b694))
- no need for :root to be first in the selector ([commit](https://github.com/Polymer/polymer/commit/63433c8))
@@ -198,7 +198,7 @@
- Revert "Fix _patchMatchesEffect. (#3631)" ([commit](https://github.com/Polymer/polymer/commit/a64f227))
-##[v1.6.1](https://github.com/Polymer/polymer/tree/v1.6.1) (2016-08-01)
+## [v1.6.1](https://github.com/Polymer/polymer/tree/v1.6.1) (2016-08-01)
- Property Shim needs to handle build output from apply shim ([commit](https://github.com/Polymer/polymer/commit/d726a51))
- Do not resolve urls with leading slash and other prototcols ([commit](https://github.com/Polymer/polymer/commit/94f95ec))
@@ -285,7 +285,7 @@
- Ensure fromAbove in _forwardParentProp. ([commit](https://github.com/Polymer/polymer/commit/072dcff))
-##[v1.6.0](https://github.com/Polymer/polymer/tree/v1.6.0) (2016-06-29)
+## [v1.6.0](https://github.com/Polymer/polymer/tree/v1.6.0) (2016-06-29)
- Fix test to account for pseudo element differences x-browser. ([commit](https://github.com/Polymer/polymer/commit/54a462d))
- Restore functionality of selectors like `:host(.foo)::after`. ([commit](https://github.com/Polymer/polymer/commit/ff88e17))
@@ -350,7 +350,7 @@
- [ci skip] update changelog ([commit](https://github.com/Polymer/polymer/commit/adef722))
-##[v1.5.0](https://github.com/Polymer/polymer/tree/v1.5.0) (2016-05-31)
+## [v1.5.0](https://github.com/Polymer/polymer/tree/v1.5.0) (2016-05-31)
- Fix test in Firefox that was hacked to work in Canary (instead filed https://bugs.chromium.org/p/chromium/issues/detail?id=614198). ([commit](https://github.com/Polymer/polymer/commit/1e2aed5))
- remove unneeded argument ([commit](https://github.com/Polymer/polymer/commit/4a99b83))
@@ -419,7 +419,7 @@
- Null debounced callback to set for GC. ([commit](https://github.com/Polymer/polymer/commit/f366c1c))
-##[v1.4.0](https://github.com/Polymer/polymer/tree/v1.4.0) (2016-03-18)
+## [v1.4.0](https://github.com/Polymer/polymer/tree/v1.4.0) (2016-03-18)
- Fast check in createdCallback to see if registration has finished. ([commit](https://github.com/Polymer/polymer/commit/a3fce19))
- even more lazy: defer template lookup and style collection until finish register time. ([commit](https://github.com/Polymer/polymer/commit/103f790))
@@ -448,7 +448,7 @@
- [ci skip] update changelog ([commit](https://github.com/Polymer/polymer/commit/58e6713))
-##[v1.3.1](https://github.com/Polymer/polymer/tree/v1.3.1) (2016-03-02)
+## [v1.3.1](https://github.com/Polymer/polymer/tree/v1.3.1) (2016-03-02)
- Fix lint errors. ([commit](https://github.com/Polymer/polymer/commit/44d06f1))
- Add test. ([commit](https://github.com/Polymer/polymer/commit/02660c1))
@@ -471,7 +471,7 @@
- Updated the README.md for a non-technical user to understand ([commit](https://github.com/Polymer/polymer/commit/0729cef))
-##[v1.3.0](https://github.com/Polymer/polymer/tree/v1.3.0) (2016-02-22)
+## [v1.3.0](https://github.com/Polymer/polymer/tree/v1.3.0) (2016-02-22)
- [ci skip] Add instructions to pull request template ([commit](https://github.com/Polymer/polymer/commit/933c920))
- [ci skip] markdown fail ([commit](https://github.com/Polymer/polymer/commit/a8e01e2))
@@ -610,7 +610,7 @@
- parentProps should not override argument based props ([commit](https://github.com/Polymer/polymer/commit/898fe89))
-##[v1.2.4](https://github.com/Polymer/polymer/tree/v1.2.4) (2016-01-27)
+## [v1.2.4](https://github.com/Polymer/polymer/tree/v1.2.4) (2016-01-27)
- Fixes #3337. When a doc fragment is added, only update the invalidation state of the insertion point list of the shadyRoot IFF it is not already invalid. This fixes an issue that was detected when an a doc fragment that did not include an insertion point was added after one that did but before distribution. ([commit](https://github.com/Polymer/polymer/commit/d26b003))
- fix build output with new vulcanize ([commit](https://github.com/Polymer/polymer/commit/c317711))
@@ -817,7 +817,7 @@
- added missing semicolons, removed some unused variables ([commit](https://github.com/Polymer/polymer/commit/338574d))
-##[v1.2.3](https://github.com/Polymer/polymer/tree/v1.2.3) (2015-11-16)
+## [v1.2.3](https://github.com/Polymer/polymer/tree/v1.2.3) (2015-11-16)
- Call decorate instead of bootstrap for template prepping ([commit](https://github.com/Polymer/polymer/commit/e2a2cfd))
- Fix global leak test. Necessary due to changes to test harness. ([commit](https://github.com/Polymer/polymer/commit/134766f))
@@ -836,7 +836,7 @@
- Fix Formatting ([commit](https://github.com/Polymer/polymer/commit/724e1bc))
-##[v1.2.2](https://github.com/Polymer/polymer/tree/v1.2.2) (2015-11-12)
+## [v1.2.2](https://github.com/Polymer/polymer/tree/v1.2.2) (2015-11-12)
- use local reference for wrap. ([commit](https://github.com/Polymer/polymer/commit/b15e5b9))
- Add Polymer.DomApi.wrap ([commit](https://github.com/Polymer/polymer/commit/6cf974a))
@@ -983,7 +983,7 @@
- Add test for parsing multi-line css comments ([commit](https://github.com/Polymer/polymer/commit/6f21ae6))
-##[v1.2.1](https://github.com/Polymer/polymer/tree/v1.2.1) (2015-10-29)
+## [v1.2.1](https://github.com/Polymer/polymer/tree/v1.2.1) (2015-10-29)
- Fix test for SD polyfill ([commit](https://github.com/Polymer/polymer/commit/dd8b3e9))
- Add pre-condition check for completeness. ([commit](https://github.com/Polymer/polymer/commit/89304dc))
@@ -1000,7 +1000,7 @@
- Fix for mixins declaration with space before colon. Allow any space character or even `{` and `}` (before and after capturing pattern correspondingly) as pattern boundaries instead of new lines only. In minified sources there might be no space, semicolon or line start, so we need to account that as well. ([commit](https://github.com/Polymer/polymer/commit/883aa5c))
-##[v1.2.0](https://github.com/Polymer/polymer/tree/v1.2.0) (2015-10-22)
+## [v1.2.0](https://github.com/Polymer/polymer/tree/v1.2.0) (2015-10-22)
- A simpler travis config ([commit](https://github.com/Polymer/polymer/commit/3338b67))
- Fix #2587: When Polymer.dom(el).appendChild(node) is called, cleanup work must be performed on the existing parent of node. This change fixes a missing case in this cleanup work: if the existing parent has a observer via `Polymer.dom(parent).observeNodes`, it needs to be notified that node is being removed even if the node does not have specific logical info. For example, if an observed node has no Shady DOM and has a child that is removed. A test for this case was added. ([commit](https://github.com/Polymer/polymer/commit/0d4f418))
@@ -1089,7 +1089,7 @@
- Adds `getEffectiveChildNodes`, `getEffectiveChildren`, `getEffectiveTextContent` ([commit](https://github.com/Polymer/polymer/commit/f34fb45))
-##[v1.1.5](https://github.com/Polymer/polymer/tree/v1.1.5) (2015-10-08)
+## [v1.1.5](https://github.com/Polymer/polymer/tree/v1.1.5) (2015-10-08)
- Simplify ([commit](https://github.com/Polymer/polymer/commit/79dfe1f))
- Clean up templatizer _pathEffectorImpl. ([commit](https://github.com/Polymer/polymer/commit/1a89bcf))
@@ -1126,7 +1126,7 @@
- update CHANGELOG to 1.1.4 ([commit](https://github.com/Polymer/polymer/commit/c2b7c31))
-##[v1.1.4](https://github.com/Polymer/polymer/tree/v1.1.4) (2015-09-25)
+## [v1.1.4](https://github.com/Polymer/polymer/tree/v1.1.4) (2015-09-25)
- :memo: Update description ([commit](https://github.com/Polymer/polymer/commit/6afb8be))
- :art: Use npm command bin lookup ([commit](https://github.com/Polymer/polymer/commit/84258d4))
@@ -1155,7 +1155,7 @@
- Fix typos in PRIMER.md ([commit](https://github.com/Polymer/polymer/commit/cf793f4))
-##[v1.1.3](https://github.com/Polymer/polymer/tree/v1.1.3) (2015-09-04)
+## [v1.1.3](https://github.com/Polymer/polymer/tree/v1.1.3) (2015-09-04)
- Fixes #2403 ([commit](https://github.com/Polymer/polymer/commit/a6694b7))
- Only try to decrement gesture dependency counter if dependency exists ([commit](https://github.com/Polymer/polymer/commit/8886e8c))
@@ -1164,7 +1164,7 @@
- prepare v1.1.2 ([commit](https://github.com/Polymer/polymer/commit/e78be4f))
-##[v1.1.2](https://github.com/Polymer/polymer/tree/v1.1.2) (2015-08-28)
+## [v1.1.2](https://github.com/Polymer/polymer/tree/v1.1.2) (2015-08-28)
- Improve composed parent tracking. ([commit](https://github.com/Polymer/polymer/commit/4d15789))
- move the mixing-in of behaviors so that it happens before `register` behaviors are invoked ([commit](https://github.com/Polymer/polymer/commit/637367c))
@@ -1199,7 +1199,7 @@
- Update changelog with v1.1.1 release ([commit](https://github.com/Polymer/polymer/commit/12fa867))
-##[v1.1.1](https://github.com/Polymer/polymer/tree/v1.1.1) (2015-08-20)
+## [v1.1.1](https://github.com/Polymer/polymer/tree/v1.1.1) (2015-08-20)
- Fixes #2263: ensure custom-style can parse variable definitions in supported selectors (e.g. /deep/) without exception due to unknown css. ([commit](https://github.com/Polymer/polymer/commit/894492b))
- Fixes #2311, #2323: when elements are removed from their previous position when they are added elsewhere, make sure to remove them from composed, not logical parent. ([commit](https://github.com/Polymer/polymer/commit/3d93116))
@@ -1226,7 +1226,7 @@
- Support for negative numbers in computed bindings ([commit](https://github.com/Polymer/polymer/commit/fc53f50))
-##[v1.1.0](https://github.com/Polymer/polymer/tree/v1.1.0) (2015-08-13)
+## [v1.1.0](https://github.com/Polymer/polymer/tree/v1.1.0) (2015-08-13)
- Add comment. ([commit](https://github.com/Polymer/polymer/commit/337b54a))
- Add tests for key splice fix. ([commit](https://github.com/Polymer/polymer/commit/4bc055b))
@@ -1257,7 +1257,7 @@
- don-module no longer needs to eagerly upgrade custom elements since the web components polyfills do this automatically. ([commit](https://github.com/Polymer/polymer/commit/051e1bf))
-##[v1.0.9](https://github.com/Polymer/polymer/tree/v1.0.9) (2015-08-07)
+## [v1.0.9](https://github.com/Polymer/polymer/tree/v1.0.9) (2015-08-07)
- Remove undocumented return value. ([commit](https://github.com/Polymer/polymer/commit/1764d0c))
- Add default, update docs. ([commit](https://github.com/Polymer/polymer/commit/ca267a5))
@@ -1340,7 +1340,7 @@
- Fix #2107: improve binding expression parser to match valid javascript property names. ([commit](https://github.com/Polymer/polymer/commit/7560130))
-##[v1.0.8](https://github.com/Polymer/polymer/tree/v1.0.8) (2015-07-23)
+## [v1.0.8](https://github.com/Polymer/polymer/tree/v1.0.8) (2015-07-23)
- Disable tracking if scrolling ([commit](https://github.com/Polymer/polymer/commit/ee5177d))
- Fixes #2125: adds a register method to dom-module to support imperative creation. ([commit](https://github.com/Polymer/polymer/commit/861f4aa))
@@ -1383,7 +1383,7 @@
- Update index.html ([commit](https://github.com/Polymer/polymer/commit/119df98))
-##[v1.0.7](https://github.com/Polymer/polymer/tree/v1.0.7) (2015-07-16)
+## [v1.0.7](https://github.com/Polymer/polymer/tree/v1.0.7) (2015-07-16)
- Replace placeholders backwards to simplify. ([commit](https://github.com/Polymer/polymer/commit/5eda235))
- Remove unnecessary keys bookkeeping. ([commit](https://github.com/Polymer/polymer/commit/3e02bfd))
diff --git a/README.md b/README.md
index f1517d1cae..52bb45ab54 100644
--- a/README.md
+++ b/README.md
@@ -367,9 +367,7 @@ Note that `Polymer.Element` provides a cleaner base class void of a lot of sugar
See below for a visual guide on migrating Polymer 1.0's declarative syntax to the ES6 class syntax in Polymer 2.0:
-
-
-
+
## Polyfills
@@ -488,7 +486,7 @@ configure the module name. The only supported declarative way set the module
id is to use `id`.
* `element.getPropertyInfo`: This api returned unexpected information some of the time and was rarely used.
* `element.getNativePrototype`: Removed because it is no longer needed for internal code and was unused by users.
-* `element.beforeRegister`: This was originally added for metadata compatibility with ES6 classes. We now prefer users create ES6 classes by extending `Polymer.Element`, specifying metadata in the static `config` property. For legacy use via `Polymer({...})`, dynamic effects may now be added using the `registered` lifecycle method.
+* `element.beforeRegister`: This was originally added for metadata compatibility with ES6 classes. We now prefer users create ES6 classes by extending `Polymer.Element`, specifying metadata in the static `properties`, `observers`, and `is` properties. For legacy use via `Polymer({...})`, dynamic effects may still be added by using `beforeRegister` but it is now equivalent to the `registered` lifecycle method. An element's `is` property cannot be set in `beforeRegister` as it could in Polymer 1.x.
* `element.attributeFollows`: Removed due to disuse.
* `element.classFollows`: Removed due to disuse.
* `element.copyOwnProperty`: Removed due to disuse.
diff --git a/bower.json b/bower.json
index 434ce7e1f2..dd2e1634a2 100644
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
{
"name": "polymer",
- "version": "2.0.0-rc.3",
+ "version": "2.0.0-rc.5",
"main": [
"polymer.html"
],
diff --git a/lib/elements/array-selector.html b/lib/elements/array-selector.html
index 3857ddf10f..b020b23a00 100644
--- a/lib/elements/array-selector.html
+++ b/lib/elements/array-selector.html
@@ -202,7 +202,6 @@
/**
* Clears the selection state.
*
- * @method clearSelection
*/
clearSelection() {
// Unbind previous selection
@@ -220,7 +219,6 @@
/**
* Returns whether the item is currently selected.
*
- * @method isSelected
* @param {*} item Item from `items` array to test
* @return {boolean} Whether the item is selected
*/
@@ -231,7 +229,6 @@
/**
* Returns whether the item is currently selected.
*
- * @method isSelected
* @param {*} idx Index from `items` array to test
* @return {boolean} Whether the item is selected
*/
@@ -261,7 +258,6 @@
/**
* Deselects the given item if it is already selected.
*
- * @method deselect
* @param {*} item Item from `items` array to deselect
*/
deselect(item) {
@@ -284,7 +280,6 @@
/**
* Deselects the given index if it is already selected.
*
- * @method deselect
* @param {number} idx Index from `items` array to deselect
*/
deselectIndex(idx) {
@@ -295,7 +290,6 @@
* Selects the given item. When `toggle` is true, this will automatically
* deselect the item if already selected.
*
- * @method select
* @param {*} item Item from `items` array to select
*/
select(item) {
@@ -306,7 +300,6 @@
* Selects the given index. When `toggle` is true, this will automatically
* deselect the item if already selected.
*
- * @method select
* @param {number} idx Index from `items` array to select
*/
selectIndex(idx) {
diff --git a/lib/elements/dom-bind.html b/lib/elements/dom-bind.html
index a03379219d..436791d85c 100644
--- a/lib/elements/dom-bind.html
+++ b/lib/elements/dom-bind.html
@@ -10,6 +10,8 @@
+
+
diff --git a/lib/utils/flattened-nodes-observer.html b/lib/utils/flattened-nodes-observer.html
index 0a49b3ab0d..c1f75d038b 100644
--- a/lib/utils/flattened-nodes-observer.html
+++ b/lib/utils/flattened-nodes-observer.html
@@ -57,7 +57,7 @@
* `` elements assigned to it, these are flattened as well.
*
* @param {Node} node The node for which to return the list of flattened nodes.
- * @returns {Array} The list of flattened nodes for the given `node`.
+ * @return {Array} The list of flattened nodes for the given `node`.
*/
static getFlattenedNodes(node) {
if (isSlot(node)) {
diff --git a/lib/utils/gestures.html b/lib/utils/gestures.html
index e4599758c2..4ee65c3b87 100644
--- a/lib/utils/gestures.html
+++ b/lib/utils/gestures.html
@@ -86,7 +86,7 @@
};
/**
- * @param {boolean=} setup
+ * @param {boolean=} setup True to add, false to remove.
*/
function setupTeardownMouseCanceller(setup) {
let events = IS_TOUCH_ONLY ? ['click'] : MOUSE_EVENTS;
@@ -150,6 +150,11 @@
// the bounding box of the target of the event
// Thanks IE 10 >:(
let t = Gestures._findOriginalTarget(ev);
+ // make sure the target of the event is an element so we can use getBoundingClientRect,
+ // if not, just assume it is a synthetic click
+ if (t.nodeType !== Node.ELEMENT_NODE) {
+ return true;
+ }
let bcr = t.getBoundingClientRect();
// use page x/y to account for scrolling
let x = ev.pageX, y = ev.pageY;
@@ -230,6 +235,8 @@
* @memberof Polymer.Gestures
* @param {number} x Horizontal pixel coordinate
* @param {number} y Vertical pixel coordinate
+ * @return {HTMLElement} Returns the deepest shadowRoot inclusive element
+ * found at the screen position given.
*/
deepTargetFind: function(x, y) {
let node = document.elementFromPoint(x, y);
@@ -239,7 +246,12 @@
// if there is not a shadowroot, exit the loop
while (next && next.shadowRoot && !window.ShadyDOM) {
// if there is a node at x/y in the shadowroot, look deeper
+ let oldNext = next;
next = next.shadowRoot.elementFromPoint(x, y);
+ // on Safari, elementFromPoint may return the shadowRoot host
+ if (oldNext === next) {
+ break;
+ }
if (next) {
node = next;
}
@@ -250,6 +262,8 @@
* a cheaper check than ev.composedPath()[0];
*
* @private
+ * @param {Event} ev Event.
+ * @return {HTMLElement} Returns the event target.
*/
_findOriginalTarget: function(ev) {
// shadowdom
@@ -262,6 +276,7 @@
/**
* @private
+ * @param {Event} ev Event.
*/
_handleNative: function(ev) {
let handled;
@@ -322,6 +337,7 @@
/**
* @private
+ * @param {Event} ev Event.
*/
_handleTouchAction: function(ev) {
let t = ev.changedTouches[0];
@@ -363,6 +379,7 @@
* @param {Node} node Node to add listener on
* @param {string} evType Gesture type: `down`, `up`, `track`, or `tap`
* @param {Function} handler Event listener function to call
+ * @return {boolean} Returns true if a gesture event listener was added.
*/
addListener: function(node, evType, handler) {
if (this.gestures[evType]) {
@@ -379,6 +396,7 @@
* @param {string} evType Gesture type: `down`, `up`, `track`, or `tap`
* @param {Function} handler Event listener function previously passed to
* `addListener`.
+ * @return {boolean} Returns true if a gesture event listener was removed.
*/
removeListener: function(node, evType, handler) {
if (this.gestures[evType]) {
@@ -391,6 +409,9 @@
* automate the event listeners for the native events
*
* @private
+ * @param {HTMLElement} node Node on which to add the event.
+ * @param {string} evType Event type to add.
+ * @param {function} handler Event handler function.
*/
_add: function(node, evType, handler) {
let recognizer = this.gestures[evType];
@@ -426,6 +447,9 @@
* automate event listener removal for native events
*
* @private
+ * @param {HTMLElement} node Node on which to remove the event.
+ * @param {string} evType Event type to remove.
+ * @param {function} handler Event handler function.
*/
_remove: function(node, evType, handler) {
let recognizer = this.gestures[evType];
@@ -464,6 +488,8 @@
/**
* @private
+ * @param {string} evName Event name.
+ * @return {Object} Returns the gesture for the given event name.
*/
_findRecognizerByEvent: function(evName) {
for (let i = 0, r; i < this.recognizers.length; i++) {
@@ -496,7 +522,12 @@
},
/**
+ * Dispatches an event on the `target` element of `type` with the given
+ * `detail`.
* @private
+ * @param {HTMLElement} target The element on which to fire an event.
+ * @param {string} type The type of event to fire.
+ * @param {Object=} detail The detail object to populate on the event.
*/
_fire: function(target, type, detail) {
let ev = new Event(type, { bubbles: true, cancelable: true, composed: true });
@@ -515,6 +546,7 @@
* Prevents the dispatch and default action of the given event name.
*
* @memberof Polymer.Gestures
+ * @param {string} evName Event name.
*/
prevent: function(evName) {
let recognizer = this._findRecognizerByEvent(evName);
@@ -530,7 +562,6 @@
* This method should only be called during testing with simulated touch inputs.
* Calling this method in production may cause duplicate taps or other Gestures.
*
- * @method resetMouseCanceller
* @memberof Polymer.Gestures
*/
resetMouseCanceller: function() {
diff --git a/lib/utils/import-href.html b/lib/utils/import-href.html
index 627eae9c9b..77933a4e43 100644
--- a/lib/utils/import-href.html
+++ b/lib/utils/import-href.html
@@ -35,7 +35,6 @@
* element will contain the imported document contents.
*
* @memberof Polymer
- * @method importHref
* @param {string} href URL to document to load.
* @param {Function=} onload Callback to notify when an import successfully
* loaded.
diff --git a/lib/utils/mixin.html b/lib/utils/mixin.html
index 51ac437c52..661de88889 100644
--- a/lib/utils/mixin.html
+++ b/lib/utils/mixin.html
@@ -23,8 +23,9 @@
* Given a mixin producing function, memoize applications of mixin to base
* @private
* @template T
- * @param {T} mixin
- * @return {T}
+ * @param {T} mixin Mixin for which to create a caching mixin.
+ * @return {T} Returns a mixin which when applied multiple times to the
+ * same base will always return the same extended class.
*/
function cachingMixin(mixin) {
return function(base) {
diff --git a/lib/utils/path.html b/lib/utils/path.html
index 869358d36e..2dfe89403c 100644
--- a/lib/utils/path.html
+++ b/lib/utils/path.html
@@ -76,8 +76,9 @@
* ```
*
* @memberof Polymer.Path
- * @param {string} path Path string
- * @return {boolean} True if `path` is an ancestor of `base`
+ * @param {string} base Path string to test against.
+ * @param {string} path Path string to test.
+ * @return {boolean} True if `path` is an ancestor of `base`.
*/
isAncestor: function(base, path) {
// base.startsWith(path + '.');
@@ -96,6 +97,9 @@
* ```
*
* @memberof Polymer.Path
+ * @param {string} base Path string to test against.
+ * @param {string} path Path string to test.
+ * @return {boolean} True if `path` is a descendant of `base`.
*/
isDescendant: function(base, path) {
// path.startsWith(base + '.');
diff --git a/lib/utils/render-status.html b/lib/utils/render-status.html
index 9703356c21..ca7175adce 100644
--- a/lib/utils/render-status.html
+++ b/lib/utils/render-status.html
@@ -26,24 +26,33 @@
flushQueue(beforeRenderQueue);
// after the render
setTimeout(function() {
- flushQueue(afterRenderQueue);
+ runQueue(afterRenderQueue);
});
});
}
function flushQueue(queue) {
while (queue.length) {
- const q = queue.shift();
- const context = q[0];
- const callback = q[1];
- const args = q[2];
- try {
- callback.apply(context, args);
- } catch(e) {
- setTimeout(() => {
- throw e;
- })
- }
+ callMethod(queue.shift());
+ }
+ }
+
+ function runQueue(queue) {
+ for (let i=0, l=queue.length; i < l; i++) {
+ callMethod(queue.shift());
+ }
+ }
+
+ function callMethod(info) {
+ const context = info[0];
+ const callback = info[1];
+ const args = info[2];
+ try {
+ callback.apply(context, args);
+ } catch(e) {
+ setTimeout(() => {
+ throw e;
+ })
}
}
@@ -52,6 +61,7 @@
flushQueue(beforeRenderQueue);
flushQueue(afterRenderQueue);
}
+ scheduled = false;
}
/**
diff --git a/lib/utils/style-gather.html b/lib/utils/style-gather.html
index 1fb045f3bd..e18a347fc2 100644
--- a/lib/utils/style-gather.html
+++ b/lib/utils/style-gather.html
@@ -36,7 +36,8 @@
* Returns CSS text of styles in a space-separated list of `dom-module`s.
*
* @memberof Polymer.StyleGather
- * @param {string} moduleIds
+ * @param {string} moduleIds List of dom-module id's within which to
+ * search for css.
* @return {string} Concatenated CSS content from specified `dom-module`s
*/
cssFromModules(moduleIds) {
diff --git a/lib/utils/templatize.html b/lib/utils/templatize.html
index c2376016d0..25786cfc6e 100644
--- a/lib/utils/templatize.html
+++ b/lib/utils/templatize.html
@@ -67,7 +67,10 @@
}
}
/**
+ * Configure the given `props` by calling `_setPendingProperty`. Also
+ * sets any properties stored in `__hostProps`.
* @private
+ * @param {Object} props Object of property name-value pairs to set.
*/
_configureProperties(props) {
let options = this.__templatizeOptions;
@@ -118,6 +121,11 @@
}
}
/**
+ * Shows or hides the template instance top level child elements. For
+ * text nodes, `textContent` is removed while "hidden" and replaced when
+ * "shown."
+ * @param {boolean} hide Set to true to hide the children;
+ * set to false to show them.
* @protected
*/
_showHideChildren(hide) {
@@ -198,7 +206,7 @@
return templateHost && templateHost._methodHost || templateHost;
}
- function createTemplatizerClass(template, options) {
+ function createTemplatizerClass(template, templateInfo, options) {
// Anonymous class created by the templatize
/**
* @unrestricted
@@ -208,22 +216,22 @@
let klass = class extends base { }
klass.prototype.__templatizeOptions = options;
klass.prototype._bindTemplate(template);
- addNotifyEffects(klass, template, options);
+ addNotifyEffects(klass, template, templateInfo, options);
return klass;
}
- function addPropagateEffects(template, options) {
+ function addPropagateEffects(template, templateInfo, options) {
let userForwardHostProp = options.forwardHostProp;
if (userForwardHostProp) {
// Provide data API and property effects on memoized template class
- let klass = template._content.__templatizeTemplateClass;
+ let klass = templateInfo.templatizeTemplateClass;
if (!klass) {
let base = options.mutableData ? MutableDataTemplate : DataTemplate;
- klass = template._content.__templatizeTemplateClass =
+ klass = templateInfo.templatizeTemplateClass =
class TemplatizedTemplate extends base {}
// Add template - >instances effects
// and host <- template effects
- let hostProps = template._content._hostProps;
+ let hostProps = templateInfo.hostProps;
for (let prop in hostProps) {
klass.prototype._addPropertyEffect('_host_' + prop,
klass.prototype.PROPERTY_EFFECT_TYPES.PROPAGATE,
@@ -254,8 +262,8 @@
}
}
- function addNotifyEffects(klass, template, options) {
- let hostProps = template._content._hostProps || {};
+ function addNotifyEffects(klass, template, templateInfo, options) {
+ let hostProps = templateInfo.hostProps || {};
for (let iprop in options.instanceProps) {
delete hostProps[iprop];
let userNotifyInstanceProp = options.notifyInstanceProp;
@@ -296,7 +304,7 @@
* // Get a template from somewhere, e.g. light DOM
* let template = this.querySelector('template');
* // Prepare the template
- * let TemplateClass = Polymer.Tempaltize.templatize(template);
+ * let TemplateClass = Polymer.Templatize.templatize(template);
* // Instance the template with an initial data model
* let instance = new TemplateClass({myProp: 'initial'});
* // Insert the instance's DOM somewhere, e.g. element's shadow DOM
@@ -358,11 +366,11 @@
* - `instanceProps`: Dictionary of property names that will be added
* to the instance by the templatize owner. These properties shadow any
* host properties, and changes within the template to these properties
- * will result in `notifyInstanceProperties` to be called.
+ * will result in `notifyInstanceProp` being called.
* - `mutableData`: When `true`, the generated class will skip strict
* dirty-checking for objects and arrays (always consider them to be
* "dirty").
- * - `notifyInstanceProperties(instance, property, value)`: Called when
+ * - `notifyInstanceProp(instance, property, value)`: Called when
* an instance property changes. Users may choose to call `notifyPath`
* on e.g. the owner to notify the change.
* - `parentModel`: When `true`, events handled by declarative event listeners
@@ -384,40 +392,41 @@
* @param {HTMLTemplateElement} template Template to templatize
* @param {*} owner Owner of the template instances; any optional callbacks
* will be bound to this owner.
- * @param {*} options Options dictionary (see summary for details)
+ * @param {*=} options Options dictionary (see summary for details)
* @return {TemplateInstanceBase} Generated class bound to the template
* provided
*/
templatize(template, owner, options) {
+ options = options || {};
if (template.__templatizeOwner) {
throw new Error('A can only be templatized once');
}
template.__templatizeOwner = owner;
- // Ensure template has _content
- template._content = template._content || template.content;
+ let templateInfo = owner.constructor._parseTemplate(template);
// Get memoized base class for the prototypical template, which
// includes property effects for binding template & forwarding
- let baseClass = template._content.__templatizeInstanceClass;
+ let baseClass = templateInfo.templatizeInstanceClass;
if (!baseClass) {
- baseClass = template._content.__templatizeInstanceClass =
- createTemplatizerClass(template, options);
+ baseClass = createTemplatizerClass(template, templateInfo, options);
+ templateInfo.templatizeInstanceClass = baseClass;
}
// Host property forwarding must be installed onto template instance
- addPropagateEffects(template, options);
+ addPropagateEffects(template, templateInfo, options);
// Subclass base class and add reference for this specific template
let klass = class TemplateInstance extends baseClass {};
klass.prototype._methodHost = findMethodHost(template);
klass.prototype.__dataHost = template;
klass.prototype.__templatizeOwner = owner;
- klass.prototype.__hostProps = template._content._hostProps;
+ klass.prototype.__hostProps = templateInfo.hostProps;
return klass;
},
/**
* Returns the template "model" associated with a given element, which
* serves as the binding scope for the template instance the element is
- * contained in. A template model is an instance of `Polymer.Base`, and
- * should be used to manipulate data associated with this template instance.
+ * contained in. A template model is an instance of
+ * `TemplateInstanceBase`, and should be used to manipulate data
+ * associated with this template instance.
*
* Example:
*
@@ -427,12 +436,13 @@
* }
*
* @memberof Polymer.Templatize
- * @method modelForElement
+ * @param {HTMLTemplateElement} template The model will be returned for
+ * elements stamped from this template
* @param {HTMLElement} el Element for which to return a template model.
* @return {TemplateInstanceBase} Template instance representing the
* binding scope for the element
*/
- modelForElement(host, el) {
+ modelForElement(template, el) {
let model;
while (el) {
// An element with a __templatizeInstance marks the top boundary
@@ -441,7 +451,7 @@
if ((model = el.__templatizeInstance)) {
// Found an element stamped by another template; keep walking up
// from its __dataHost
- if (model.__dataHost != host) {
+ if (model.__dataHost != template) {
el = model.__dataHost;
} else {
return model;
diff --git a/package.json b/package.json
index 7eeb010799..9686cbc1fc 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@polymer/polymer",
- "version": "2.0.0-rc.3",
+ "version": "2.0.0-rc.5",
"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": {
diff --git a/test/runner.html b/test/runner.html
index 6ac8473e86..e15a8de0a5 100644
--- a/test/runner.html
+++ b/test/runner.html
@@ -27,6 +27,7 @@
'unit/globals.html',
'unit/property-accessors.html',
'unit/property-effects.html',
+ 'unit/property-effects-template.html',
'unit/path-effects.html',
'unit/shady.html',
'unit/shady-events.html',
@@ -36,6 +37,7 @@
'unit/styling-cross-scope-var.html',
'unit/styling-cross-scope-apply.html',
'unit/styling-cross-scope-unknown-host.html',
+ 'unit/styling-only-with-template.html',
'unit/custom-style.html',
'unit/custom-style-late.html',
'unit/custom-style-async.html',
@@ -46,6 +48,7 @@
'unit/case-map.html',
'unit/configure.html',
'unit/ready-attached-order.html',
+ 'unit/ready-attached-order-class.html',
'unit/attributes.html',
'unit/async.html',
'unit/behaviors.html',
@@ -68,7 +71,8 @@
'unit/logging.html',
'unit/mixin-utils.html',
'unit/mixin-behaviors.html',
- 'unit/render-status.html'
+ 'unit/render-status.html',
+ 'unit/disable-upgrade.html'
];
// http://eddmann.com/posts/cartesian-product-in-javascript/
diff --git a/test/smoke/disable-upgrade.html b/test/smoke/disable-upgrade.html
new file mode 100644
index 0000000000..0897b46d03
--- /dev/null
+++ b/test/smoke/disable-upgrade.html
@@ -0,0 +1,98 @@
+
+
+
+
+
+
+
+
+
+
+
+
+