Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2324)

Unified Diff: chrome/browser/resources/md_history/app.crisper.js

Issue 2344803002: MD WebUI: Simplify usage of Templatizer in cr-lazy-render (Closed)
Patch Set: _render -> render_ Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/webui/resources/cr_elements/cr_lazy_render/cr_lazy_render.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/md_history/app.crisper.js
diff --git a/chrome/browser/resources/md_history/app.crisper.js b/chrome/browser/resources/md_history/app.crisper.js
index 8d12dc9b2acc3404c50574e36a829109968e579b..d02d330f3779262509a92ef2d5c7b80f761bb391 100644
--- a/chrome/browser/resources/md_history/app.crisper.js
+++ b/chrome/browser/resources/md_history/app.crisper.js
@@ -5388,7 +5388,7 @@ Polymer({
"extends": 'template',
behaviors: [ Polymer.Templatizer ],
_renderPromise: null,
- _instance: null,
+ _child: null,
get: function() {
if (!this._renderPromise) {
this._renderPromise = new Promise(function(resolve) {
@@ -5402,28 +5402,22 @@ Polymer({
return this._renderPromise;
},
getIfExists: function() {
- if (this._instance) {
- var children = this._instance._children;
- for (var i = 0; i < children.length; i++) {
- if (children[i].nodeType == Node.ELEMENT_NODE) return children[i];
- }
- }
- return null;
+ return this._child;
},
_render: function() {
if (!this.ctor) this.templatize(this);
var parentNode = this.parentNode;
- if (parentNode && !this._instance) {
- this._instance = this.stamp({});
- var root = this._instance.root;
- parentNode.insertBefore(root, this);
+ if (parentNode && !this._child) {
+ var instance = this.stamp({});
+ this._child = instance.root.querySelector('*');
+ parentNode.insertBefore(instance.root, this);
}
},
_forwardParentProp: function(prop, value) {
- if (this._instance) this._instance.__setProperty(prop, value, true);
+ if (this._child) this._child._templateInstance[prop] = value;
},
_forwardParentPath: function(path, value) {
- if (this._instance) this._instance._notifyPath(path, value, true);
+ if (this._child) this._child._templateInstance.notifyPath(path, value, true);
}
});
« no previous file with comments | « no previous file | ui/webui/resources/cr_elements/cr_lazy_render/cr_lazy_render.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698