OLD | NEW |
1 (function() { | 1 Polymer({ |
2 | |
3 'use strict'; | |
4 | |
5 function classNames(obj) { | |
6 var classNames = []; | |
7 for (var key in obj) { | |
8 if (obj.hasOwnProperty(key) && obj[key]) { | |
9 classNames.push(key); | |
10 } | |
11 } | |
12 | |
13 return classNames.join(' '); | |
14 } | |
15 | |
16 Polymer({ | |
17 | |
18 is: 'paper-toolbar', | 2 is: 'paper-toolbar', |
19 | 3 |
20 hostAttributes: { | 4 hostAttributes: { |
21 'role': 'toolbar' | 5 'role': 'toolbar' |
22 }, | 6 }, |
23 | 7 |
24 properties: { | 8 properties: { |
25 | |
26 /** | 9 /** |
27 * Controls how the items are aligned horizontally when they are placed | 10 * Controls how the items are aligned horizontally when they are placed |
28 * at the bottom. | 11 * at the bottom. |
29 * Options are `start`, `center`, `end`, `justified` and `around`. | 12 * Options are `start`, `center`, `end`, `justified` and `around`. |
30 * | 13 * |
31 * @attribute bottomJustify | 14 * @attribute bottomJustify |
32 * @type string | 15 * @type string |
33 * @default '' | 16 * @default '' |
34 */ | 17 */ |
35 bottomJustify: { | 18 bottomJustify: { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 labelledBy.push(id); | 86 labelledBy.push(id); |
104 } | 87 } |
105 } | 88 } |
106 } | 89 } |
107 } | 90 } |
108 if (labelledBy.length > 0) { | 91 if (labelledBy.length > 0) { |
109 this.setAttribute('aria-labelledby', labelledBy.join(' ')); | 92 this.setAttribute('aria-labelledby', labelledBy.join(' ')); |
110 } | 93 } |
111 }, | 94 }, |
112 | 95 |
113 _computeBarClassName: function(barJustify) { | 96 _computeBarExtraClasses: function(barJustify) { |
114 var classObj = { | 97 if (!barJustify) return ''; |
115 'center': true, | |
116 'horizontal': true, | |
117 'layout': true, | |
118 'toolbar-tools': true | |
119 }; | |
120 | 98 |
121 // If a blank string or any falsy value is given, no other class name is | 99 return barJustify + (barJustify === 'justified' ? '' : '-justified'); |
122 // added. | |
123 if (barJustify) { | |
124 var justifyClassName = (barJustify === 'justified') ? | |
125 barJustify : | |
126 barJustify + '-justified'; | |
127 | |
128 classObj[justifyClassName] = true; | |
129 } | |
130 | |
131 return classNames(classObj); | |
132 } | 100 } |
133 | 101 }); |
134 }); | |
135 | |
136 }()); | |
OLD | NEW |