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

Side by Side Diff: ui/webui/resources/cr_elements/cr_lazy_render/cr_lazy_render.js

Issue 2603443002: Clang format JS: Disallow single line functions, conditionals, loops, and switch statements (Closed)
Patch Set: update c/b/r/ as well Created 3 years, 12 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * cr-lazy-render is a simple variant of dom-if designed for lazy rendering 7 * cr-lazy-render is a simple variant of dom-if designed for lazy rendering
8 * of elements that are accessed imperatively. 8 * of elements that are accessed imperatively.
9 * Usage: 9 * Usage:
10 * <template is="cr-lazy-render" id="menu"> 10 * <template is="cr-lazy-render" id="menu">
(...skipping 19 matching lines...) Expand all
30 get: function() { 30 get: function() {
31 if (!this.child_) 31 if (!this.child_)
32 this.render_(); 32 this.render_();
33 return this.child_; 33 return this.child_;
34 }, 34 },
35 35
36 /** 36 /**
37 * @return {?Element} The element contained in the template, if it has 37 * @return {?Element} The element contained in the template, if it has
38 * already been stamped. 38 * already been stamped.
39 */ 39 */
40 getIfExists: function() { return this.child_; }, 40 getIfExists: function() {
41 return this.child_;
42 },
41 43
42 /** @private */ 44 /** @private */
43 render_: function() { 45 render_: function() {
44 if (!this.ctor) 46 if (!this.ctor)
45 this.templatize(this); 47 this.templatize(this);
46 var parentNode = this.parentNode; 48 var parentNode = this.parentNode;
47 if (parentNode && !this.child_) { 49 if (parentNode && !this.child_) {
48 var instance = this.stamp({}); 50 var instance = this.stamp({});
49 this.child_ = instance.root.firstElementChild; 51 this.child_ = instance.root.firstElementChild;
50 parentNode.insertBefore(instance.root, this); 52 parentNode.insertBefore(instance.root, this);
(...skipping 11 matching lines...) Expand all
62 64
63 /** 65 /**
64 * @param {string} path 66 * @param {string} path
65 * @param {Object} value 67 * @param {Object} value
66 */ 68 */
67 _forwardParentPath: function(path, value) { 69 _forwardParentPath: function(path, value) {
68 if (this.child_) 70 if (this.child_)
69 this.child_._templateInstance.notifyPath(path, value, true); 71 this.child_._templateInstance.notifyPath(path, value, true);
70 } 72 }
71 }); 73 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698