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

Side by Side Diff: third_party/polymer/polymer-selector/polymer-selector.html

Issue 218583004: Uprev to Polymer 0.2.1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@css-shadow
Patch Set: Remove keyboard code from patch. Created 6 years, 8 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 Copyright 2013 The Polymer Authors. All rights reserved. 2 Copyright 2013 The Polymer Authors. All rights reserved.
3 Use of this source code is governed by a BSD-style 3 Use of this source code is governed by a BSD-style
4 license that can be found in the LICENSE file. 4 license that can be found in the LICENSE file.
5 --> 5 -->
6 <!-- 6 <!--
7 /** 7 /**
8 * @module Polymer Elements 8 * @module Polymer Elements
9 */ 9 */
10 /** 10 /**
(...skipping 20 matching lines...) Expand all
31 * } 31 * }
32 * </style> 32 * </style>
33 * ... 33 * ...
34 * <polymer-selector> 34 * <polymer-selector>
35 * <div class="item">Item 1</div> 35 * <div class="item">Item 1</div>
36 * <div class="item">Item 2</div> 36 * <div class="item">Item 2</div>
37 * <div class="item">Item 3</div> 37 * <div class="item">Item 3</div>
38 * </polymer-selector> 38 * </polymer-selector>
39 * 39 *
40 * @class polymer-selector 40 * @class polymer-selector
41 * @status stable
41 */ 42 */
42 /** 43 /**
43 * Fired when an item's selection state is changed. This event is fired both 44 * Fired when an item's selection state is changed. This event is fired both
44 * when an item is selected or deselected. The `isSelected` detail property 45 * when an item is selected or deselected. The `isSelected` detail property
45 * contains the selection state. 46 * contains the selection state.
46 * 47 *
47 * @event polymer-select 48 * @event polymer-select
48 * @param {Object} detail 49 * @param {Object} detail
49 * @param {boolean} detail.isSelected true for selection and false for deselec tion 50 * @param {boolean} detail.isSelected true for selection and false for deselec tion
50 * @param {Object} detail.item the item element 51 * @param {Object} detail.item the item element
51 */ 52 */
52 /** 53 /**
53 * Fired when an item element is tapped. 54 * Fired when an item element is tapped.
54 * 55 *
55 * @event polymer-activate 56 * @event polymer-activate
56 * @param {Object} detail 57 * @param {Object} detail
57 * @param {Object} detail.item the item element 58 * @param {Object} detail.item the item element
58 */ 59 */
59 --> 60 -->
60 <link rel="import" href="../polymer/polymer.html"> 61 <link rel="import" href="../polymer/polymer.html">
61 <link rel="import" href="../polymer-selection/polymer-selection.html"> 62 <link rel="import" href="../polymer-selection/polymer-selection.html">
62 63
63 <polymer-element name="polymer-selector" 64 <polymer-element name="polymer-selector"
64 attributes="selected multi valueattr selectedClass selectedProperty selected Item selectedModel selectedIndex notap target itemsSelector activateEvent"> 65 attributes="selected multi valueattr selectedClass selectedProperty selected Attribute selectedItem selectedModel selectedIndex notap target itemsSelector ac tivateEvent">
65 <template> 66 <template>
66 <polymer-selection id="selection" multi="{{multi}}" on-polymer-select="{{sel ectionSelect}}"></polymer-selection> 67 <polymer-selection id="selection" multi="{{multi}}" on-polymer-select="{{sel ectionSelect}}"></polymer-selection>
67 <content id="items" select="*"></content> 68 <content id="items" select="*"></content>
68 </template> 69 </template>
69 <script> 70 <script>
70 Polymer('polymer-selector', { 71 Polymer('polymer-selector', {
71 /** 72 /**
72 * Gets or sets the selected element. Default to use the index 73 * Gets or sets the selected element. Default to use the index
73 * of the item element. 74 * of the item element.
74 * 75 *
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 * @type string 124 * @type string
124 * @default 'polymer-selected' 125 * @default 'polymer-selected'
125 */ 126 */
126 selectedClass: 'polymer-selected', 127 selectedClass: 'polymer-selected',
127 /** 128 /**
128 * Specifies the property to be used to set on the selected element 129 * Specifies the property to be used to set on the selected element
129 * to indicate its active state. 130 * to indicate its active state.
130 * 131 *
131 * @attribute selectedProperty 132 * @attribute selectedProperty
132 * @type string 133 * @type string
134 * @default ''
135 */
136 selectedProperty: '',
137 /**
138 * Specifies the property to be used to set on the selected element
139 * to indicate its active state.
140 *
141 * @attribute selectedProperty
142 * @type string
133 * @default 'active' 143 * @default 'active'
134 */ 144 */
135 selectedProperty: 'active', 145 selectedAttribute: 'active',
136 /** 146 /**
137 * Returns the currently selected element. In multi-selection this returns 147 * Returns the currently selected element. In multi-selection this returns
138 * an array of selected elements. 148 * an array of selected elements.
139 * 149 *
140 * @attribute selectedItem 150 * @attribute selectedItem
141 * @type Object 151 * @type Object
142 * @default null 152 * @default null
143 */ 153 */
144 selectedItem: null, 154 selectedItem: null,
145 /** 155 /**
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 this.applySelection(detail.item, detail.isSelected); 311 this.applySelection(detail.item, detail.isSelected);
302 } 312 }
303 }, 313 },
304 applySelection: function(item, isSelected) { 314 applySelection: function(item, isSelected) {
305 if (this.selectedClass) { 315 if (this.selectedClass) {
306 item.classList.toggle(this.selectedClass, isSelected); 316 item.classList.toggle(this.selectedClass, isSelected);
307 } 317 }
308 if (this.selectedProperty) { 318 if (this.selectedProperty) {
309 item[this.selectedProperty] = isSelected; 319 item[this.selectedProperty] = isSelected;
310 } 320 }
321 if (this.selectedAttribute && item.setAttribute) {
322 if (isSelected) {
323 item.setAttribute(this.selectedAttribute, '');
324 } else {
325 item.removeAttribute(this.selectedAttribute);
326 }
327 }
311 }, 328 },
312 // event fired from host 329 // event fired from host
313 activateHandler: function(e) { 330 activateHandler: function(e) {
314 if (!this.notap) { 331 if (!this.notap) {
315 var i = this.findDistributedTarget(e.target, this.items); 332 var i = this.findDistributedTarget(e.target, this.items);
316 if (i >= 0) { 333 if (i >= 0) {
317 var item = this.items[i]; 334 var item = this.items[i];
318 var s = this.valueForNode(item) || i; 335 var s = this.valueForNode(item) || i;
319 if (this.multi) { 336 if (this.multi) {
320 if (this.selected) { 337 if (this.selected) {
(...skipping 24 matching lines...) Expand all
345 var i = Array.prototype.indexOf.call(nodes, target); 362 var i = Array.prototype.indexOf.call(nodes, target);
346 if (i >= 0) { 363 if (i >= 0) {
347 return i; 364 return i;
348 } 365 }
349 target = target.parentNode; 366 target = target.parentNode;
350 } 367 }
351 } 368 }
352 }); 369 });
353 </script> 370 </script>
354 </polymer-element> 371 </polymer-element>
OLDNEW
« no previous file with comments | « third_party/polymer/polymer-selector/bower.json ('k') | third_party/polymer/polymer-selector/smoke.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698