| Index: third_party/polymer/v1_0/components-chromium/iron-a11y-announcer/iron-a11y-announcer-extracted.js
|
| diff --git a/third_party/polymer/v1_0/components-chromium/iron-a11y-announcer/iron-a11y-announcer-extracted.js b/third_party/polymer/v1_0/components-chromium/iron-a11y-announcer/iron-a11y-announcer-extracted.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..679a1c255b2e6a01a9150b48e2e897c04cafe4c9
|
| --- /dev/null
|
| +++ b/third_party/polymer/v1_0/components-chromium/iron-a11y-announcer/iron-a11y-announcer-extracted.js
|
| @@ -0,0 +1,61 @@
|
| +(function() {
|
| + 'use strict';
|
| +
|
| + Polymer.IronA11yAnnouncer = Polymer({
|
| + is: 'iron-a11y-announcer',
|
| +
|
| + properties: {
|
| +
|
| + /**
|
| + * The value of mode is used to set the `aria-live` attribute
|
| + * for the element that will be announced. Valid values are: `off`,
|
| + * `polite` and `assertive`.
|
| + */
|
| + mode: {
|
| + type: String,
|
| + value: 'polite'
|
| + },
|
| +
|
| + _text: {
|
| + type: String,
|
| + value: ''
|
| + }
|
| + },
|
| +
|
| + created: function() {
|
| + if (!Polymer.IronA11yAnnouncer.instance) {
|
| + Polymer.IronA11yAnnouncer.instance = this;
|
| + }
|
| +
|
| + document.body.addEventListener('iron-announce', this._onIronAnnounce.bind(this));
|
| + },
|
| +
|
| + /**
|
| + * Cause a text string to be announced by screen readers.
|
| + *
|
| + * @param {string} text The text that should be announced.
|
| + */
|
| + announce: function(text) {
|
| + this._text = '';
|
| + this.async(function() {
|
| + this._text = text;
|
| + }, 100);
|
| + },
|
| +
|
| + _onIronAnnounce: function(event) {
|
| + if (event.detail && event.detail.text) {
|
| + this.announce(event.detail.text);
|
| + }
|
| + }
|
| + });
|
| +
|
| + Polymer.IronA11yAnnouncer.instance = null;
|
| +
|
| + Polymer.IronA11yAnnouncer.requestAvailability = function() {
|
| + if (!Polymer.IronA11yAnnouncer.instance) {
|
| + Polymer.IronA11yAnnouncer.instance = document.createElement('iron-a11y-announcer');
|
| + }
|
| +
|
| + document.body.appendChild(Polymer.IronA11yAnnouncer.instance);
|
| + };
|
| + })();
|
|
|