Index: third_party/polymer/v0_8/components-chromium/iron-collapse/iron-collapse-extracted.js |
diff --git a/third_party/polymer/v0_8/components-chromium/iron-collapse/iron-collapse-extracted.js b/third_party/polymer/v0_8/components-chromium/iron-collapse/iron-collapse-extracted.js |
index e383953b3789cca3e97bf3bf337904110ec805cb..f85b985568d07eaea9535c61aa7d7f9b3844aca6 100644 |
--- a/third_party/polymer/v0_8/components-chromium/iron-collapse/iron-collapse-extracted.js |
+++ b/third_party/polymer/v0_8/components-chromium/iron-collapse/iron-collapse-extracted.js |
@@ -10,33 +10,35 @@ |
* If true, the orientation is horizontal; otherwise is vertical. |
* |
* @attribute horizontal |
- * @type Boolean |
- * @default false |
*/ |
horizontal: { |
type: Boolean, |
value: false, |
- observer: 'horizontalChanged' |
+ observer: '_horizontalChanged' |
}, |
/** |
* Set opened to true to show the collapse element and to false to hide it. |
* |
* @attribute opened |
- * @type Boolean |
- * @default false |
*/ |
opened: { |
type: Boolean, |
value: false, |
notify: true, |
- observer: 'openedChanged' |
+ observer: '_openedChanged' |
} |
}, |
+ hostAttributes: { |
+ role: 'group', |
+ 'aria-expanded': 'false', |
+ tabindex: 0 |
+ }, |
+ |
listeners: { |
- transitionend: 'transitionEnd' |
+ transitionend: '_transitionEnd' |
}, |
ready: function() { |
@@ -45,15 +47,6 @@ |
this._enableTransition = true; |
}, |
- horizontalChanged: function() { |
- this.dimension = this.horizontal ? 'width' : 'height'; |
- this.style.transitionProperty = this.dimension; |
- }, |
- |
- openedChanged: function() { |
- this[this.opened ? 'show' : 'hide'](); |
- }, |
- |
/** |
* Toggle the opened state. |
* |
@@ -66,7 +59,7 @@ |
show: function() { |
this.toggleClass('iron-collapse-closed', false); |
this.updateSize('auto', false); |
- var s = this.calcSize(); |
+ var s = this._calcSize(); |
this.updateSize('0px', false); |
// force layout to ensure transition will go |
this.offsetHeight; |
@@ -75,7 +68,7 @@ |
hide: function() { |
this.toggleClass('iron-collapse-opened', false); |
- this.updateSize(this.calcSize(), false); |
+ this.updateSize(this._calcSize(), false); |
// force layout to ensure transition will go |
this.offsetHeight; |
this.updateSize('0px', true); |
@@ -87,26 +80,38 @@ |
var nochange = s[this.dimension] === size; |
s[this.dimension] = size; |
if (animated && nochange) { |
- this.transitionEnd(); |
+ this._transitionEnd(); |
} |
}, |
- calcSize: function() { |
- return this.getBoundingClientRect()[this.dimension] + 'px'; |
- }, |
- |
enableTransition: function(enabled) { |
this.style.transitionDuration = (enabled && this._enableTransition) ? '' : '0s'; |
}, |
- transitionEnd: function() { |
+ _horizontalChanged: function() { |
+ this.dimension = this.horizontal ? 'width' : 'height'; |
+ this.style.transitionProperty = this.dimension; |
+ }, |
+ |
+ _openedChanged: function() { |
+ this[this.opened ? 'show' : 'hide'](); |
+ this.setAttribute('aria-expanded', this.opened ? 'true' : 'false'); |
+ |
+ }, |
+ |
+ _transitionEnd: function() { |
if (this.opened) { |
this.updateSize('auto', false); |
} |
this.toggleClass('iron-collapse-closed', !this.opened); |
this.toggleClass('iron-collapse-opened', this.opened); |
this.enableTransition(false); |
- } |
+ }, |
+ |
+ _calcSize: function() { |
+ return this.getBoundingClientRect()[this.dimension] + 'px'; |
+ }, |
+ |
}); |