-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
defer all create-time preparation work if we have no defaultView unle…
…ss forceReady flag is set. Otherwise perform this work at enteredDocument time. This is a stand in for an ownerDocumentChangedCallback.
- Loading branch information
Showing
4 changed files
with
39 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,28 +15,36 @@ | |
// TODO(sorvell): temporary BC | ||
ready: function() { | ||
|
||
}, | ||
// TODO(sjmiles): temporary BC | ||
readyCallback: function() { | ||
this._createdCallback(); | ||
}, | ||
createdCallback: function() { | ||
this._createdCallback(); | ||
if (this.ownerDocument.defaultView || this.forceReady || | ||
Polymer.preparingElements) { | ||
this.prepare(); | ||
} | ||
}, | ||
// system entry point, do not override | ||
_createdCallback: function() { | ||
prepare: function() { | ||
if (this._prepared) { | ||
return; | ||
} | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
sjmiles
Contributor
|
||
this._prepared = true; | ||
//this.style.display = 'inline-block'; | ||
// install property observers | ||
// do this first so we can observe changes during initialization | ||
this.observeProperties(); | ||
// install boilerplate attributes | ||
this.copyInstanceAttributes(); | ||
// process input attributes | ||
this.takeAttributes(); | ||
// do this first so we can observe changes during initialization | ||
//this.observeProperties(); | ||
// add event listeners | ||
this.addHostListeners(); | ||
// forces sub-elements to be prepared | ||
Polymer.preparingElements = true; | ||
// process declarative resources | ||
this.parseElements(this.__proto__); | ||
Polymer.preparingElements = false; | ||
this.observeProperties(); | ||
//Platform.endOfMicrotask(this.initializeProperties.bind(this)); | ||
// unless this element is inserted into the main document | ||
// (or the user otherwise specifically prevents it) | ||
// bindings will self destruct after a short time; this is | ||
|
@@ -45,38 +53,25 @@ | |
//this.asyncUnbindAll(); | ||
// user initialization | ||
// TODO(sorvell): bc | ||
//console.log('created', this); | ||
this.ready(); | ||
this.created(); | ||
}, | ||
insertedCallback: function() { | ||
this._enteredDocumentCallback(); | ||
// TODO(sorvell): refactor so this doesn't depend on properties already | ||
// having been observed | ||
this.initializeProperties(); | ||
}, | ||
enteredDocumentCallback: function() { | ||
this._enteredDocumentCallback(); | ||
}, | ||
_enteredDocumentCallback: function() { | ||
this.cancelUnbindAll(true); | ||
// TODO(sorvell): bc | ||
if (this.inserted) { | ||
this.inserted(); | ||
if (!this.forceReady) { | ||
this.prepare(); | ||
} | ||
this.cancelUnbindAll(true); | ||
// invoke user action | ||
if (this.enteredDocument) { | ||
this.enteredDocument(); | ||
} | ||
}, | ||
removedCallback: function() { | ||
this._leftDocumentCallback(); | ||
}, | ||
leftDocumentCallback: function() { | ||
this._leftDocumentCallback(); | ||
}, | ||
_leftDocumentCallback: function() { | ||
this.asyncUnbindAll(); | ||
// TODO(sorvell): bc | ||
if (this.removed) { | ||
this.removed(); | ||
} | ||
// invoke user action | ||
if (this.leftDocument) { | ||
this.leftDocument(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In later commits this became _elementPrepared, but I'm just curious why this boolean is being set at the beginning of a function called prepareElement? It seems intuitively that setting _elementPrepared would be the last thing that happens before leaving the context of the the prepareElement function.
Not a major deal, my main thing here is that if I had to get to the really nasty root level to debug, the last thing I would want to do is be confused by the base object right off the bat.