nanocomponent
Advanced tools
Comparing version 6.4.6 to 6.5.0
19
index.js
@@ -42,3 +42,3 @@ var document = require('global/document') | ||
Nanocomponent.prototype.render = function () { | ||
var timing = nanotiming(this._name + '.render') | ||
var renderTiming = nanotiming(this._name + '.render') | ||
var self = this | ||
@@ -49,15 +49,22 @@ var args = new Array(arguments.length) | ||
if (!this._hasWindow) { | ||
var createTiming = nanotiming(this._name + '.create') | ||
el = this.createElement.apply(this, args) | ||
timing() | ||
createTiming() | ||
renderTiming() | ||
return el | ||
} else if (this.element) { | ||
el = this.element // retain reference, as the ID might change on render | ||
var updateTiming = nanotiming(this._name + '.update') | ||
var shouldUpdate = this._rerender || this.update.apply(this, args) | ||
updateTiming() | ||
if (this._rerender) this._rerender = false | ||
if (shouldUpdate) { | ||
morph(el, this._handleRender(args)) | ||
var desiredHtml = this._handleRender(args) | ||
var morphTiming = nanotiming(this._name + '.morph') | ||
morph(el, desiredHtml) | ||
morphTiming() | ||
if (this.afterupdate) this.afterupdate(el) | ||
} | ||
if (!this._proxy) { this._proxy = this._createProxy() } | ||
timing() | ||
renderTiming() | ||
return this._proxy | ||
@@ -72,3 +79,3 @@ } else { | ||
} | ||
timing() | ||
renderTiming() | ||
return el | ||
@@ -85,3 +92,5 @@ } | ||
Nanocomponent.prototype._handleRender = function (args) { | ||
var createElementTiming = nanotiming(this._name + '.createElement') | ||
var el = this.createElement.apply(this, args) | ||
createElementTiming() | ||
if (!this._rootNodeName) this._rootNodeName = el.nodeName | ||
@@ -88,0 +97,0 @@ assert(el instanceof window.HTMLElement, 'nanocomponent: createElement should return a DOM node') |
{ | ||
"name": "nanocomponent", | ||
"version": "6.4.6", | ||
"version": "6.5.0", | ||
"description": "Native DOM components that pair nicely with DOM diffing algorithms", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
236893
512