| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 * Component that renders a destination item in a destination list. | 9 * Component that renders a destination item in a destination list. |
| 10 * @param {!cr.EventTarget} eventTarget Event target to dispatch selection | 10 * @param {!cr.EventTarget} eventTarget Event target to dispatch selection |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 setIsVisible( | 248 setIsVisible( |
| 249 this.getChildElement('.advanced-settings-item-value-select'), true); | 249 this.getChildElement('.advanced-settings-item-value-select'), true); |
| 250 var selectEl = this.select_; | 250 var selectEl = this.select_; |
| 251 var indexToSelect = 0; | 251 var indexToSelect = 0; |
| 252 this.capability_.select_cap.option.forEach(function(option, index) { | 252 this.capability_.select_cap.option.forEach(function(option, index) { |
| 253 var item = document.createElement('option'); | 253 var item = document.createElement('option'); |
| 254 item.text = option.display_name; | 254 item.text = option.display_name; |
| 255 item.value = option.value; | 255 item.value = option.value; |
| 256 if (option.is_default) | 256 if (option.is_default) |
| 257 indexToSelect = index; | 257 indexToSelect = index; |
| 258 selectEl.add(item); | 258 selectEl.appendChild(item); |
| 259 }); | 259 }); |
| 260 for (var i = 0, option; option = selectEl.options[i]; i++) { | 260 for (var i = 0, option; option = selectEl.options[i]; i++) { |
| 261 if (option.value == this.selectedValue_) { | 261 if (option.value == this.selectedValue_) { |
| 262 indexToSelect = i; | 262 indexToSelect = i; |
| 263 break; | 263 break; |
| 264 } | 264 } |
| 265 } | 265 } |
| 266 selectEl.selectedIndex = indexToSelect; | 266 selectEl.selectedIndex = indexToSelect; |
| 267 }, | 267 }, |
| 268 | 268 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 295 } | 295 } |
| 296 }); | 296 }); |
| 297 } | 297 } |
| 298 }; | 298 }; |
| 299 | 299 |
| 300 // Export | 300 // Export |
| 301 return { | 301 return { |
| 302 AdvancedSettingsItem: AdvancedSettingsItem | 302 AdvancedSettingsItem: AdvancedSettingsItem |
| 303 }; | 303 }; |
| 304 }); | 304 }); |
| OLD | NEW |