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

Side by Side Diff: chrome/browser/resources/print_preview/component.js

Issue 2857983007: Print Preview: Make getChildElement return required HTMLElement (Closed)
Patch Set: Created 3 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 cr.define('print_preview', function() { 5 cr.define('print_preview', function() {
6 'use strict'; 6 'use strict';
7 7
8 /** 8 /**
9 * Class that represents a UI component. 9 * Class that represents a UI component.
10 * @constructor 10 * @constructor
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 removeChildren: function() { 155 removeChildren: function() {
156 while (this.children_.length > 0) { 156 while (this.children_.length > 0) {
157 this.removeChild(this.children_[0]); 157 this.removeChild(this.children_[0]);
158 } 158 }
159 }, 159 },
160 160
161 /** 161 /**
162 * @param {string} query Selector query to select an element starting from 162 * @param {string} query Selector query to select an element starting from
163 * the component's root element using a depth first search for the first 163 * the component's root element using a depth first search for the first
164 * element that matches the query. 164 * element that matches the query.
165 * @return {HTMLElement} Element selected by the given query. 165 * @return {!HTMLElement} Element selected by the given query.
166 * TODO(alekseys): Check all call sites and rename this function to
167 * something like getRequiredChildElement.
168 */ 166 */
169 getChildElement: function(query) { 167 getChildElement: function(query) {
170 return this.element_.querySelector(query); 168 return assert(this.element_.querySelector(query));
171 }, 169 },
172 170
173 /** 171 /**
174 * Sets the component's element. 172 * Sets the component's element.
175 * @param {Element} element HTML element to set as the component's element. 173 * @param {Element} element HTML element to set as the component's element.
176 * @protected 174 * @protected
177 */ 175 */
178 setElementInternal: function(element) { 176 setElementInternal: function(element) {
179 this.element_ = element; 177 this.element_ = element;
180 }, 178 },
(...skipping 22 matching lines...) Expand all
203 setIsVisible(el, true); 201 setIsVisible(el, true);
204 } 202 }
205 return el; 203 return el;
206 } 204 }
207 }; 205 };
208 206
209 return { 207 return {
210 Component: Component 208 Component: Component
211 }; 209 };
212 }); 210 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698