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

Side by Side Diff: third_party/polymer/v1_0/components-chromium/iron-selector/iron-selectable-extracted.js

Issue 1363853002: Update Polymer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix resources Created 5 years, 2 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 1
2 2
3 /** @polymerBehavior */ 3 /** @polymerBehavior */
4 Polymer.IronSelectableBehavior = { 4 Polymer.IronSelectableBehavior = {
5 5
6 /** 6 /**
7 * Fired when iron-selector is activated (selected or deselected). 7 * Fired when iron-selector is activated (selected or deselected).
8 * It is fired before the selected items are changed. 8 * It is fired before the selected items are changed.
9 * Cancel the event to abort selection. 9 * Cancel the event to abort selection.
10 * 10 *
11 * @event iron-activate 11 * @event iron-activate
12 * 12 */
13 **/ 13
14 /** 14 /**
15 * Fired when an item is selected 15 * Fired when an item is selected
16 * 16 *
17 * @event iron-select 17 * @event iron-select
18 * 18 */
19 **/ 19
20 /** 20 /**
21 * Fired when an item is deselected 21 * Fired when an item is deselected
22 * 22 *
23 * @event iron-deselect 23 * @event iron-deselect
24 */
25
26 /**
27 * Fired when the list of selectable items changes (e.g., items are
28 * added or removed). The detail of the event is a list of mutation
29 * records that describe what changed.
24 * 30 *
25 **/ 31 * @event iron-items-changed
32 */
26 33
27 properties: { 34 properties: {
28 35
29 /** 36 /**
30 * If you want to use the attribute value of an element for `selected` ins tead of the index, 37 * If you want to use the attribute value of an element for `selected` ins tead of the index,
31 * set this to the name of the attribute. 38 * set this to the name of the attribute.
32 *
33 * @attribute attrForSelected
34 * @type {string}
35 */ 39 */
36 attrForSelected: { 40 attrForSelected: {
37 type: String, 41 type: String,
38 value: null 42 value: null
39 }, 43 },
40 44
41 /** 45 /**
42 * Gets or sets the selected element. The default is to use the index of t he item. 46 * Gets or sets the selected element. The default is to use the index of t he item.
43 *
44 * @attribute selected
45 * @type {string}
46 */ 47 */
47 selected: { 48 selected: {
48 type: String, 49 type: String,
49 notify: true 50 notify: true
50 }, 51 },
51 52
52 /** 53 /**
53 * Returns the currently selected item. 54 * Returns the currently selected item.
54 *
55 * @attribute selectedItem
56 * @type {Object}
57 */ 55 */
58 selectedItem: { 56 selectedItem: {
59 type: Object, 57 type: Object,
60 readOnly: true, 58 readOnly: true,
61 notify: true 59 notify: true
62 }, 60 },
63 61
64 /** 62 /**
65 * The event that fires from items when they are selected. Selectable 63 * The event that fires from items when they are selected. Selectable
66 * will listen for this event from items and update the selection state. 64 * will listen for this event from items and update the selection state.
67 * Set to empty string to listen to no events. 65 * Set to empty string to listen to no events.
68 *
69 * @attribute activateEvent
70 * @type {string}
71 * @default 'tap'
72 */ 66 */
73 activateEvent: { 67 activateEvent: {
74 type: String, 68 type: String,
75 value: 'tap', 69 value: 'tap',
76 observer: '_activateEventChanged' 70 observer: '_activateEventChanged'
77 }, 71 },
78 72
79 /** 73 /**
80 * This is a CSS selector string. If this is set, only items that match t he CSS selector 74 * This is a CSS selector string. If this is set, only items that match t he CSS selector
81 * are selectable. 75 * are selectable.
82 *
83 * @attribute selectable
84 * @type {string}
85 */ 76 */
86 selectable: String, 77 selectable: String,
87 78
88 /** 79 /**
89 * The class to set on elements when selected. 80 * The class to set on elements when selected.
90 *
91 * @attribute selectedClass
92 * @type {string}
93 */ 81 */
94 selectedClass: { 82 selectedClass: {
95 type: String, 83 type: String,
96 value: 'iron-selected' 84 value: 'iron-selected'
97 }, 85 },
98 86
99 /** 87 /**
100 * The attribute to set on elements when selected. 88 * The attribute to set on elements when selected.
101 *
102 * @attribute selectedAttribute
103 * @type {string}
104 */ 89 */
105 selectedAttribute: { 90 selectedAttribute: {
106 type: String, 91 type: String,
107 value: null 92 value: null
108 }, 93 },
109 94
110 /** 95 /**
111 * The set of excluded elements where the key is the `localName` 96 * The set of excluded elements where the key is the `localName`
112 * of the element that will be ignored from the item list. 97 * of the element that will be ignored from the item list.
113 * 98 *
114 * @type {object}
115 * @default {template: 1} 99 * @default {template: 1}
116 */ 100 */
117
118 excludedLocalNames: { 101 excludedLocalNames: {
119 type: Object, 102 type: Object,
120 value: function() { 103 value: function() {
121 return { 104 return {
122 'template': 1 105 'template': 1
123 }; 106 };
124 } 107 }
125 } 108 }
126 }, 109 },
127 110
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 // observe content changes under the given node. 259 // observe content changes under the given node.
277 _observeContent: function(node) { 260 _observeContent: function(node) {
278 var content = node.querySelector('content'); 261 var content = node.querySelector('content');
279 if (content && content.parentElement === node) { 262 if (content && content.parentElement === node) {
280 return this._observeItems(node.domHost); 263 return this._observeItems(node.domHost);
281 } 264 }
282 }, 265 },
283 266
284 // observe items change under the given node. 267 // observe items change under the given node.
285 _observeItems: function(node) { 268 _observeItems: function(node) {
286 var observer = new MutationObserver(function() { 269 // TODO(cdata): Update this when we get distributed children changed.
270 var observer = new MutationObserver(function(mutations) {
271 // Let other interested parties know about the change so that
272 // we don't have to recreate mutation observers everywher.
273 this.fire('iron-items-changed', mutations, {
274 bubbles: false,
275 cancelable: false
276 });
277
287 if (this.selected != null) { 278 if (this.selected != null) {
288 this._updateSelected(); 279 this._updateSelected();
289 } 280 }
290 }.bind(this)); 281 }.bind(this));
291 observer.observe(node, { 282 observer.observe(node, {
292 childList: true, 283 childList: true,
293 subtree: true 284 subtree: true
294 }); 285 });
295 return observer; 286 return observer;
296 }, 287 },
(...skipping 14 matching lines...) Expand all
311 302
312 _itemActivate: function(value, item) { 303 _itemActivate: function(value, item) {
313 if (!this.fire('iron-activate', 304 if (!this.fire('iron-activate',
314 {selected: value, item: item}, {cancelable: true}).defaultPrevented) { 305 {selected: value, item: item}, {cancelable: true}).defaultPrevented) {
315 this.select(value); 306 this.select(value);
316 } 307 }
317 } 308 }
318 309
319 }; 310 };
320 311
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698