| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 @license | 2 @license |
| 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. | 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. |
| 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt | 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
| 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt | 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
| 7 Code distributed by Google as part of the polymer project is also | 7 Code distributed by Google as part of the polymer project is also |
| 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt | 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
| 9 --> | 9 --> |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 */ | 31 */ |
| 32 | 32 |
| 33 /** | 33 /** |
| 34 * Fired when an item is deselected | 34 * Fired when an item is deselected |
| 35 * | 35 * |
| 36 * @event iron-deselect | 36 * @event iron-deselect |
| 37 */ | 37 */ |
| 38 | 38 |
| 39 /** | 39 /** |
| 40 * Fired when the list of selectable items changes (e.g., items are | 40 * Fired when the list of selectable items changes (e.g., items are |
| 41 * added or removed). The detail of the event is a list of mutation | 41 * added or removed). The detail of the event is a mutation record that |
| 42 * records that describe what changed. | 42 * describes what changed. |
| 43 * | 43 * |
| 44 * @event iron-items-changed | 44 * @event iron-items-changed |
| 45 */ | 45 */ |
| 46 | 46 |
| 47 properties: { | 47 properties: { |
| 48 | 48 |
| 49 /** | 49 /** |
| 50 * If you want to use an attribute value or property of an element for | 50 * If you want to use an attribute value or property of an element for |
| 51 * `selected` instead of the index, set this to the name of the attribute | 51 * `selected` instead of the index, set this to the name of the attribute |
| 52 * or property. Hyphenated values are converted to camel case when used to | 52 * or property. Hyphenated values are converted to camel case when used to |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 this._selectionChange(); | 339 this._selectionChange(); |
| 340 this.fire('iron-' + (isSelected ? 'select' : 'deselect'), {item: item}); | 340 this.fire('iron-' + (isSelected ? 'select' : 'deselect'), {item: item}); |
| 341 }, | 341 }, |
| 342 | 342 |
| 343 _selectionChange: function() { | 343 _selectionChange: function() { |
| 344 this._setSelectedItem(this._selection.get()); | 344 this._setSelectedItem(this._selection.get()); |
| 345 }, | 345 }, |
| 346 | 346 |
| 347 // observe items change under the given node. | 347 // observe items change under the given node. |
| 348 _observeItems: function(node) { | 348 _observeItems: function(node) { |
| 349 return Polymer.dom(node).observeNodes(function(mutations) { | 349 return Polymer.dom(node).observeNodes(function(mutation) { |
| 350 this._updateItems(); | 350 this._updateItems(); |
| 351 | 351 |
| 352 if (this._shouldUpdateSelection) { | 352 if (this._shouldUpdateSelection) { |
| 353 this._updateSelected(); | 353 this._updateSelected(); |
| 354 } | 354 } |
| 355 | 355 |
| 356 // Let other interested parties know about the change so that | 356 // Let other interested parties know about the change so that |
| 357 // we don't have to recreate mutation observers everywhere. | 357 // we don't have to recreate mutation observers everywhere. |
| 358 this.fire('iron-items-changed', mutations, { | 358 this.fire('iron-items-changed', mutation, { |
| 359 bubbles: false, | 359 bubbles: false, |
| 360 cancelable: false | 360 cancelable: false |
| 361 }); | 361 }); |
| 362 }); | 362 }); |
| 363 }, | 363 }, |
| 364 | 364 |
| 365 _activateHandler: function(e) { | 365 _activateHandler: function(e) { |
| 366 var t = e.target; | 366 var t = e.target; |
| 367 var items = this.items; | 367 var items = this.items; |
| 368 while (t && t != this) { | 368 while (t && t != this) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 379 _itemActivate: function(value, item) { | 379 _itemActivate: function(value, item) { |
| 380 if (!this.fire('iron-activate', | 380 if (!this.fire('iron-activate', |
| 381 {selected: value, item: item}, {cancelable: true}).defaultPrevented) { | 381 {selected: value, item: item}, {cancelable: true}).defaultPrevented) { |
| 382 this.select(value); | 382 this.select(value); |
| 383 } | 383 } |
| 384 } | 384 } |
| 385 | 385 |
| 386 }; | 386 }; |
| 387 | 387 |
| 388 </script> | 388 </script> |
| OLD | NEW |