diff --git a/bower.json b/bower.json index 4618f2f93b..542ec73bf8 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "polymer", - "version": "1.0.7", + "version": "1.0.8", "main": [ "polymer.html" ], diff --git a/build.log b/build.log index abccfe925b..e878305417 100644 --- a/build.log +++ b/build.log @@ -1,19 +1,19 @@ BUILD LOG --------- -Build Time: 2015-07-16T14:37:31-0700 +Build Time: 2015-07-23T16:07:08-0700 NODEJS INFORMATION ================== -nodejs: v2.3.4 +nodejs: v2.4.0 del: 1.2.0 gulp: 3.9.0 gulp-audit: 1.0.0 -gulp-bump: 0.3.1 gulp-rename: 1.2.2 gulp-replace: 0.5.3 gulp-vulcanize: 6.0.1 -minimist: 1.1.1 +gulp-bump: 0.3.1 lazypipe: 0.2.4 +minimist: 1.1.1 polyclean: 1.2.0 run-sequence: 1.1.1 semver: 4.3.6 @@ -21,10 +21,10 @@ nodegit: 0.4.1 REPO REVISIONS ============== -polymer: 3d56eb0c97eb1ef90ec6942aca364d279377ff43 +polymer: cb327518d20871c3f072d6f30ca48ce421cc028a BUILD HASHES ============ -polymer-mini.html: 2429dd9d7909014a82cca9f81b8df239fc5a0599 -polymer-micro.html: 924b916bacfafd1a166c10fce29eab24ebd02717 -polymer.html: dbb7a228a8facf071dea38e4db2415a9a6becfc0 \ No newline at end of file +polymer-mini.html: da1187ca5cd371a7a7b192e445c741e5fdc48db4 +polymer-micro.html: 11d4fc24d24b1276645e4043fab589802597d318 +polymer.html: 0f1f393785eb667dee807f12b0e6b55ead1cb8e5 \ No newline at end of file diff --git a/polymer-micro.html b/polymer-micro.html index caad8448e8..87518b9931 100644 --- a/polymer-micro.html +++ b/polymer-micro.html @@ -183,25 +183,30 @@ return document.createElement('dom-module'); }; DomModule.prototype = Object.create(HTMLElement.prototype); -DomModule.prototype.constructor = DomModule; -DomModule.prototype.createdCallback = function () { -var id = this.id || this.getAttribute('name') || this.getAttribute('is'); +Polymer.Base.extend(DomModule.prototype, { +constructor: DomModule, +createdCallback: function () { +this.register(); +}, +register: function (id) { +var id = id || this.id || this.getAttribute('name') || this.getAttribute('is'); if (id) { this.id = id; modules[id] = this; } -}; -DomModule.prototype.import = function (id, slctr) { +}, +import: function (id, selector) { var m = modules[id]; if (!m) { forceDocumentUpgrade(); m = modules[id]; } -if (m && slctr) { -m = m.querySelector(slctr); +if (m && selector) { +m = m.querySelector(selector); } return m; -}; +} +}); var cePolyfill = window.CustomElements && !CustomElements.useNative; if (cePolyfill) { var ready = CustomElements.ready; @@ -497,7 +502,7 @@ this._debouncers = {}; }, debounce: function (jobName, callback, wait) { -this._debouncers[jobName] = Polymer.Debounce.call(this, this._debouncers[jobName], callback, wait); +return this._debouncers[jobName] = Polymer.Debounce.call(this, this._debouncers[jobName], callback, wait); }, isDebouncerActive: function (jobName) { var debouncer = this._debouncers[jobName]; @@ -516,7 +521,7 @@ } } }); -Polymer.version = '1.0.7'; +Polymer.version = '1.0.8'; Polymer.Base._addFeature({ _registerFeatures: function () { this._prepIs(); diff --git a/polymer-mini.html b/polymer-mini.html index de29af0a44..c795a626d3 100644 --- a/polymer-mini.html +++ b/polymer-mini.html @@ -428,7 +428,6 @@ var nativeAppendChild = Element.prototype.appendChild; var nativeCloneNode = Element.prototype.cloneNode; var nativeImportNode = Document.prototype.importNode; -var dirtyRoots = []; var DomApi = function (node) { this.node = node; if (this.patch) { @@ -437,17 +436,12 @@ }; DomApi.prototype = { flush: function () { -for (var i = 0, host; i < dirtyRoots.length; i++) { -host = dirtyRoots[i]; -host.flushDebouncer('_distribute'); -} -dirtyRoots = []; +Polymer.dom.flush(); }, _lazyDistribute: function (host) { if (host.shadyRoot && host.shadyRoot._distributionClean) { host.shadyRoot._distributionClean = false; -host.debounce('_distribute', host._distributeContent); -dirtyRoots.push(host); +Polymer.dom.addDebouncer(host.debounce('_distribute', host._distributeContent)); } }, appendChild: function (node) { @@ -883,32 +877,44 @@ }, textContent: { get: function () { -if (this.node.nodeType === Node.TEXT_NODE) { +var nt = this.node.nodeType; +if (nt === Node.TEXT_NODE || nt === Node.COMMENT_NODE) { return this.node.textContent; } else { -return Array.prototype.map.call(this.childNodes, function (c) { -return c.textContent; -}).join(''); +var tc = []; +for (var i = 0, cn = this.childNodes, c; c = cn[i]; i++) { +if (c.nodeType !== Node.COMMENT_NODE) { +tc.push(c.textContent); +} +} +return tc.join(''); } }, set: function (text) { +var nt = this.node.nodeType; +if (nt === Node.TEXT_NODE || nt === Node.COMMENT_NODE) { +this.node.textContent = text; +} else { this._clear(); if (text) { this.appendChild(document.createTextNode(text)); } +} }, configurable: true }, innerHTML: { get: function () { -if (this.node.nodeType === Node.TEXT_NODE) { +var nt = this.node.nodeType; +if (nt === Node.TEXT_NODE || nt === Node.COMMENT_NODE) { return null; } else { return getInnerHTML(this.node); } }, set: function (text) { -if (this.node.nodeType !== Node.TEXT_NODE) { +var nt = this.node.nodeType; +if (nt !== Node.TEXT_NODE || nt !== Node.COMMENT_NODE) { this._clear(); var d = document.createElement('div'); d.innerHTML = text; @@ -1021,7 +1027,43 @@ return factory(obj, patch); } }; -Polymer.dom.flush = DomApi.prototype.flush; +Polymer.Base.extend(Polymer.dom, { +_flushGuard: 0, +_FLUSH_MAX: 100, +_needsTakeRecords: !Polymer.Settings.useNativeCustomElements, +_debouncers: [], +_finishDebouncer: null, +flush: function () { +for (var i = 0; i < this._debouncers.length; i++) { +this._debouncers[i].complete(); +} +if (this._finishDebouncer) { +this._finishDebouncer.complete(); +} +this._flushPolyfills(); +if (this._debouncers.length && this._flushGuard < this._FLUSH_MAX) { +this._flushGuard++; +this.flush(); +} else { +if (this._flushGuard >= this._FLUSH_MAX) { +console.warn('Polymer.dom.flush aborted. Flush may not be complete.'); +} +this._flushGuard = 0; +} +}, +_flushPolyfills: function () { +if (this._needsTakeRecords) { +CustomElements.takeRecords(); +} +}, +addDebouncer: function (debouncer) { +this._debouncers.push(debouncer); +this._finishDebouncer = Polymer.Debounce(this._finishDebouncer, this._finishFlush); +}, +_finishFlush: function () { +Polymer.dom._debouncers = []; +} +}); function getLightChildren(node) { var children = node._lightChildren; return children ? children : node.childNodes; @@ -1147,6 +1189,7 @@ }, _finishDistribute: function () { if (this._useContent) { +this.shadyRoot._distributionClean = true; if (hasInsertionPoint(this.shadyRoot)) { this._composeTree(); } else { @@ -1160,7 +1203,6 @@ } } this.shadyRoot._hasDistributed = true; -this.shadyRoot._distributionClean = true; } }, elementMatches: function (selector, node) { diff --git a/polymer.html b/polymer.html index 89e28a32df..de1a20bc98 100644 --- a/polymer.html +++ b/polymer.html @@ -546,6 +546,16 @@ for (var i = 0, r; i < recognizers.length; i++) { r = recognizers[i]; if (gs[r.name] && !handled[r.name]) { +if (r.flow && r.flow.start.indexOf(ev.type) > -1) { +if (r.reset) { +r.reset(); +} +} +} +} +for (var i = 0, r; i < recognizers.length; i++) { +r = recognizers[i]; +if (gs[r.name] && !handled[r.name]) { handled[r.name] = true; r[type](ev); } @@ -577,6 +587,8 @@ } if (prevent) { ev.preventDefault(); +} else { +Gestures.prevent('track'); } } }, @@ -718,6 +730,16 @@ 'touchmove', 'touchend' ], +flow: { +start: [ +'mousedown', +'touchstart' +], +end: [ +'mouseup', +'touchend' +] +}, emits: ['track'], info: { x: 0, @@ -733,7 +755,7 @@ }, prevent: false }, -clearInfo: function () { +reset: function () { this.info.state = 'start'; this.info.started = false; this.info.moves = []; @@ -772,7 +794,6 @@ Gestures.prevent('tap'); movefn(e); } -self.clearInfo(); document.removeEventListener('mousemove', movefn); document.removeEventListener('mouseup', upfn); }; @@ -812,7 +833,6 @@ }); this.fire(t, ct); } -this.clearInfo(); }, fire: function (target, touch) { var secondlast = this.info.moves[this.info.moves.length - 2]; @@ -847,6 +867,16 @@ 'touchstart', 'touchend' ], +flow: { +start: [ +'mousedown', +'touchstart' +], +end: [ +'click', +'touchend' +] +}, emits: ['tap'], info: { x: NaN, @@ -887,7 +917,6 @@ }); } } -this.reset(); } }); var DIRECTION_MAP = { @@ -1584,7 +1613,12 @@ }); Polymer.Base._addFeature({ _setupConfigure: function (initialConfig) { -this._config = initialConfig || {}; +this._config = {}; +for (var i in initialConfig) { +if (initialConfig[i] !== undefined) { +this._config[i] = initialConfig[i]; +} +} this._handlers = []; }, _marshalAttributes: function () { @@ -1713,8 +1747,9 @@ var last = parts[parts.length - 1]; if (parts.length > 1) { for (var i = 0; i < parts.length - 1; i++) { -prop = prop[parts[i]]; -if (array) { +var part = parts[i]; +prop = prop[part]; +if (array && parseInt(part) == part) { parts[i] = Polymer.Collection.get(array).getKey(prop); } if (!prop) { @@ -1722,15 +1757,13 @@ } array = Array.isArray(prop) ? prop : null; } -if (array) { +if (array && parseInt(last) == last) { var coll = Polymer.Collection.get(array); var old = prop[last]; var key = coll.getKey(old); -if (key) { parts[i] = key; coll.setItem(key, value); } -} prop[last] = value; if (!root) { this.notifyPath(parts.join('.'), value); @@ -2826,6 +2859,7 @@ _prepStyleProperties: function () { this._ownStylePropertyNames = this._styles ? propertyUtils.decorateStyles(this._styles) : []; }, +customStyle: {}, _setupStyleProperties: function () { this.customStyle = {}; }, @@ -3057,15 +3091,8 @@ }()); Polymer.Templatizer = { properties: { __hideTemplateChildren__: { observer: '_showHideChildren' } }, -_templatizerStatic: { -count: 0, -callbacks: {}, -debouncer: null -}, _instanceProps: Polymer.nob, -created: function () { -this._templatizerId = this._templatizerStatic.count++; -}, +_parentPropPrefix: '_parent_', templatize: function (template) { if (!template._content) { template._content = template.content; @@ -3109,20 +3136,10 @@ } }, _debounceTemplate: function (fn) { -this._templatizerStatic.callbacks[this._templatizerId] = fn.bind(this); -this._templatizerStatic.debouncer = Polymer.Debounce(this._templatizerStatic.debouncer, this._flushTemplates.bind(this, true)); +Polymer.dom.addDebouncer(this.debounce('_debounceTemplate', fn)); }, _flushTemplates: function (debouncerExpired) { -var db = this._templatizerStatic.debouncer; -while (debouncerExpired || db && db.finish) { -db.stop(); -var cbs = this._templatizerStatic.callbacks; -this._templatizerStatic.callbacks = {}; -for (var id in cbs) { -cbs[id](); -} -debouncerExpired = false; -} +Polymer.dom.flush(); }, _customPrepEffects: function (archetype) { var parentProps = archetype._parentProps; @@ -3162,7 +3179,7 @@ Polymer.Bind.prepareModel(proto); } for (prop in parentProps) { -var parentProp = '_parent_' + prop; +var parentProp = this._parentPropPrefix + prop; var effects = [ { kind: 'function', @@ -3186,8 +3203,9 @@ }; }, _createHostPropEffector: function (prop) { +var prefix = this._parentPropPrefix; return function (source, value) { -this.dataHost['_parent_' + prop] = value; +this.dataHost[prefix + prop] = value; }; }, _createInstancePropEffector: function (prop) { @@ -3219,12 +3237,12 @@ var root = dot < 0 ? path : path.slice(0, dot); dataHost._forwardInstancePath.call(dataHost, this, path, value); if (root in dataHost._parentProps) { -dataHost.notifyPath('_parent_' + path, value); +dataHost.notifyPath(dataHost._parentPropPrefix + path, value); } }, _pathEffector: function (path, value, fromAbove) { if (this._forwardParentPath) { -if (path.indexOf('_parent_') === 0) { +if (path.indexOf(this._parentPropPrefix) === 0) { this._forwardParentPath(path.substring(8), value); } } @@ -3272,7 +3290,7 @@ model = model || {}; if (this._parentProps) { for (var prop in this._parentProps) { -model[prop] = this['_parent_' + prop]; +model[prop] = this[this._parentPropPrefix + prop]; } } return new this.ctor(model, this); @@ -3988,7 +4006,16 @@ is: 'dom-bind', extends: 'template', created: function () { -Polymer.ImportStatus.whenLoaded(this._readySelf.bind(this)); +Polymer.ImportStatus.whenLoaded(this._markImportsReady.bind(this)); +}, +_ensureReady: function () { +if (!this._readied) { +this._readySelf(); +} +}, +_markImportsReady: function () { +this._importsReady = true; +this._ensureReady(); }, _registerFeatures: function () { this._prepConstructor(); @@ -4021,6 +4048,15 @@ this._setupConfigure = this._setupConfigure.bind(this, config); }, attached: function () { +if (this._importsReady) { +this.render(); +} +}, +detached: function () { +this._removeChildren(); +}, +render: function () { +this._ensureReady(); if (!this._children) { this._template = this; this._prepAnnotations(); @@ -4033,8 +4069,5 @@ } this._insertChildren(); this.fire('dom-change'); -}, -detached: function () { -this._removeChildren(); } });