Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <link rel="import" href="chrome://resources/html/polymer.html"> | 1 <link rel="import" href="chrome://resources/html/polymer.html"> |
| 2 <link rel="import" href="/controls/pref_control_behavior.html"> | 2 <link rel="import" href="/controls/pref_control_behavior.html"> |
| 3 <link rel="import" href="/i18n_setup.html"> | 3 <link rel="import" href="/i18n_setup.html"> |
| 4 <link rel="import" href="/md_select_css.html"> | 4 <link rel="import" href="/md_select_css.html"> |
| 5 <link rel="import" href="/prefs/pref_util.html"> | 5 <link rel="import" href="/prefs/pref_util.html"> |
| 6 <link rel="import" href="/settings_shared_css.html"> | 6 <link rel="import" href="/settings_shared_css.html"> |
| 7 | 7 |
| 8 <dom-module id="settings-dropdown-menu"> | 8 <dom-module id="settings-dropdown-menu"> |
| 9 <template> | 9 <template> |
| 10 <style include="settings-shared md-select"></style> | 10 <style include="settings-shared md-select"></style> |
| 11 <div class="md-select-wrapper"> | 11 <div class="md-select-wrapper"> |
| 12 <select class="md-select" id="dropdownMenu" on-change="onChange_" | 12 <select class="md-select" id="dropdownMenu" on-change="onChange_" |
| 13 value="[[selected_]]" | |
| 14 disabled="[[shouldDisableMenu_(disabled, menuOptions)]]"> | 13 disabled="[[shouldDisableMenu_(disabled, menuOptions)]]"> |
| 15 <template is="dom-repeat" items="[[menuOptions]]"> | 14 <template is="dom-repeat" items="[[menuOptions]]"> |
| 16 <option value="[[item.value]]">[[item.name]]</option> | 15 <option value="[[item.value]]">[[item.name]]</option> |
| 17 </template> | 16 </template> |
| 18 <option value="[[notFoundValue_]]" | 17 <option value="[[notFoundValue_]]" |
| 19 hidden$="[[!isSelectedNotFound_(selected_)]]"> | 18 hidden$="[[!showNotFoundValue_(menuOptions, pref.value)]]" |
|
dpapad
2016/10/25 01:02:38
showNotFoundValue is performing an O(n) search, fo
dpapad
2016/10/25 01:13:32
Ah, just noticing, this <option> is outside of the
michaelpg
2016/10/25 01:14:37
The search is O(n) and happens:
twice whenever m
| |
| 19 disabled="[[!showNotFoundValue_(menuOptions, pref.value)]]"> | |
|
dpapad
2016/10/25 01:18:09
So to avoid calculating the same boolean twice, ca
michaelpg
2016/10/26 01:23:10
Nice, done.
| |
| 20 $i18n{custom} | 20 $i18n{custom} |
| 21 </option> | 21 </option> |
| 22 </select> | 22 </select> |
| 23 <span class="md-select-underline"></span> | 23 <span class="md-select-underline"></span> |
| 24 </div> | 24 </div> |
| 25 </template> | 25 </template> |
| 26 <script src="settings_dropdown_menu.js"></script> | 26 <script src="settings_dropdown_menu.js"></script> |
| 27 </dom-module> | 27 </dom-module> |
| OLD | NEW |