[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/js/dist/ -> a11y.js (source)

   1  this["wp"] = this["wp"] || {}; this["wp"]["a11y"] =
   2  /******/ (function(modules) { // webpackBootstrap
   3  /******/     // The module cache
   4  /******/     var installedModules = {};
   5  /******/
   6  /******/     // The require function
   7  /******/ 	function __webpack_require__(moduleId) {
   8  /******/
   9  /******/         // Check if module is in cache
  10  /******/         if(installedModules[moduleId]) {
  11  /******/             return installedModules[moduleId].exports;
  12  /******/         }
  13  /******/         // Create a new module (and put it into the cache)
  14  /******/         var module = installedModules[moduleId] = {
  15  /******/             i: moduleId,
  16  /******/             l: false,
  17  /******/             exports: {}
  18  /******/         };
  19  /******/
  20  /******/         // Execute the module function
  21  /******/         modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  22  /******/
  23  /******/         // Flag the module as loaded
  24  /******/         module.l = true;
  25  /******/
  26  /******/         // Return the exports of the module
  27  /******/         return module.exports;
  28  /******/     }
  29  /******/
  30  /******/
  31  /******/     // expose the modules object (__webpack_modules__)
  32  /******/     __webpack_require__.m = modules;
  33  /******/
  34  /******/     // expose the module cache
  35  /******/     __webpack_require__.c = installedModules;
  36  /******/
  37  /******/     // define getter function for harmony exports
  38  /******/     __webpack_require__.d = function(exports, name, getter) {
  39  /******/         if(!__webpack_require__.o(exports, name)) {
  40  /******/             Object.defineProperty(exports, name, { enumerable: true, get: getter });
  41  /******/         }
  42  /******/     };
  43  /******/
  44  /******/     // define __esModule on exports
  45  /******/     __webpack_require__.r = function(exports) {
  46  /******/         if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  47  /******/             Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  48  /******/         }
  49  /******/         Object.defineProperty(exports, '__esModule', { value: true });
  50  /******/     };
  51  /******/
  52  /******/     // create a fake namespace object
  53  /******/     // mode & 1: value is a module id, require it
  54  /******/     // mode & 2: merge all properties of value into the ns
  55  /******/     // mode & 4: return value when already ns object
  56  /******/     // mode & 8|1: behave like require
  57  /******/     __webpack_require__.t = function(value, mode) {
  58  /******/         if(mode & 1) value = __webpack_require__(value);
  59  /******/         if(mode & 8) return value;
  60  /******/         if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  61  /******/         var ns = Object.create(null);
  62  /******/         __webpack_require__.r(ns);
  63  /******/         Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  64  /******/         if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  65  /******/         return ns;
  66  /******/     };
  67  /******/
  68  /******/     // getDefaultExport function for compatibility with non-harmony modules
  69  /******/     __webpack_require__.n = function(module) {
  70  /******/         var getter = module && module.__esModule ?
  71  /******/ 			function getDefault() { return module['default']; } :
  72  /******/ 			function getModuleExports() { return module; };
  73  /******/         __webpack_require__.d(getter, 'a', getter);
  74  /******/         return getter;
  75  /******/     };
  76  /******/
  77  /******/     // Object.prototype.hasOwnProperty.call
  78  /******/     __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  79  /******/
  80  /******/     // __webpack_public_path__
  81  /******/     __webpack_require__.p = "";
  82  /******/
  83  /******/
  84  /******/     // Load entry module and return exports
  85  /******/     return __webpack_require__(__webpack_require__.s = "./node_modules/@wordpress/a11y/build-module/index.js");
  86  /******/ })
  87  /************************************************************************/
  88  /******/ ({
  89  
  90  /***/ "./node_modules/@wordpress/a11y/build-module/addContainer.js":
  91  /*!*******************************************************************!*\
  92    !*** ./node_modules/@wordpress/a11y/build-module/addContainer.js ***!
  93    \*******************************************************************/
  94  /*! exports provided: default */
  95  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  96  
  97  "use strict";
  98  __webpack_require__.r(__webpack_exports__);
  99  /**
 100   * Build the live regions markup.
 101   *
 102   * @param {string} ariaLive Optional. Value for the 'aria-live' attribute, default 'polite'.
 103   *
 104   * @return {Object} $container The ARIA live region jQuery object.
 105   */
 106  var addContainer = function addContainer(ariaLive) {
 107    ariaLive = ariaLive || 'polite';
 108    var container = document.createElement('div');
 109    container.id = 'a11y-speak-' + ariaLive;
 110    container.className = 'a11y-speak-region';
 111    container.setAttribute('style', 'position: absolute;' + 'margin: -1px;' + 'padding: 0;' + 'height: 1px;' + 'width: 1px;' + 'overflow: hidden;' + 'clip: rect(1px, 1px, 1px, 1px);' + '-webkit-clip-path: inset(50%);' + 'clip-path: inset(50%);' + 'border: 0;' + 'word-wrap: normal !important;');
 112    container.setAttribute('aria-live', ariaLive);
 113    container.setAttribute('aria-relevant', 'additions text');
 114    container.setAttribute('aria-atomic', 'true');
 115    document.querySelector('body').appendChild(container);
 116    return container;
 117  };
 118  
 119  /* harmony default export */ __webpack_exports__["default"] = (addContainer);
 120  
 121  
 122  /***/ }),
 123  
 124  /***/ "./node_modules/@wordpress/a11y/build-module/clear.js":
 125  /*!************************************************************!*\
 126    !*** ./node_modules/@wordpress/a11y/build-module/clear.js ***!
 127    \************************************************************/
 128  /*! exports provided: default */
 129  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 130  
 131  "use strict";
 132  __webpack_require__.r(__webpack_exports__);
 133  /**
 134   * Clear the a11y-speak-region elements.
 135   */
 136  var clear = function clear() {
 137    var regions = document.querySelectorAll('.a11y-speak-region');
 138  
 139    for (var i = 0; i < regions.length; i++) {
 140      regions[i].textContent = '';
 141    }
 142  };
 143  
 144  /* harmony default export */ __webpack_exports__["default"] = (clear);
 145  
 146  
 147  /***/ }),
 148  
 149  /***/ "./node_modules/@wordpress/a11y/build-module/filterMessage.js":
 150  /*!********************************************************************!*\
 151    !*** ./node_modules/@wordpress/a11y/build-module/filterMessage.js ***!
 152    \********************************************************************/
 153  /*! exports provided: default */
 154  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 155  
 156  "use strict";
 157  __webpack_require__.r(__webpack_exports__);
 158  var previousMessage = '';
 159  /**
 160   * Filter the message to be announced to the screenreader.
 161   *
 162   * @param {string} message The message to be announced.
 163   *
 164   * @return {string} The filtered message.
 165   */
 166  
 167  var filterMessage = function filterMessage(message) {
 168    /*
 169     * Strip HTML tags (if any) from the message string. Ideally, messages should
 170     * be simple strings, carefully crafted for specific use with A11ySpeak.
 171     * When re-using already existing strings this will ensure simple HTML to be
 172     * stripped out and replaced with a space. Browsers will collapse multiple
 173     * spaces natively.
 174     */
 175    message = message.replace(/<[^<>]+>/g, ' ');
 176  
 177    if (previousMessage === message) {
 178      message += "\xA0";
 179    }
 180  
 181    previousMessage = message;
 182    return message;
 183  };
 184  
 185  /* harmony default export */ __webpack_exports__["default"] = (filterMessage);
 186  
 187  
 188  /***/ }),
 189  
 190  /***/ "./node_modules/@wordpress/a11y/build-module/index.js":
 191  /*!************************************************************!*\
 192    !*** ./node_modules/@wordpress/a11y/build-module/index.js ***!
 193    \************************************************************/
 194  /*! exports provided: setup, speak */
 195  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 196  
 197  "use strict";
 198  __webpack_require__.r(__webpack_exports__);
 199  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setup", function() { return setup; });
 200  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "speak", function() { return speak; });
 201  /* harmony import */ var _addContainer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./addContainer */ "./node_modules/@wordpress/a11y/build-module/addContainer.js");
 202  /* harmony import */ var _clear__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./clear */ "./node_modules/@wordpress/a11y/build-module/clear.js");
 203  /* harmony import */ var _wordpress_dom_ready__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/dom-ready */ "@wordpress/dom-ready");
 204  /* harmony import */ var _wordpress_dom_ready__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_dom_ready__WEBPACK_IMPORTED_MODULE_2__);
 205  /* harmony import */ var _filterMessage__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./filterMessage */ "./node_modules/@wordpress/a11y/build-module/filterMessage.js");
 206  
 207  
 208  
 209  
 210  /**
 211   * Create the live regions.
 212   */
 213  
 214  var setup = function setup() {
 215    var containerPolite = document.getElementById('a11y-speak-polite');
 216    var containerAssertive = document.getElementById('a11y-speak-assertive');
 217  
 218    if (containerPolite === null) {
 219      containerPolite = Object(_addContainer__WEBPACK_IMPORTED_MODULE_0__["default"])('polite');
 220    }
 221  
 222    if (containerAssertive === null) {
 223      containerAssertive = Object(_addContainer__WEBPACK_IMPORTED_MODULE_0__["default"])('assertive');
 224    }
 225  };
 226  /**
 227   * Run setup on domReady.
 228   */
 229  
 230  _wordpress_dom_ready__WEBPACK_IMPORTED_MODULE_2___default()(setup);
 231  /**
 232   * Update the ARIA live notification area text node.
 233   *
 234   * @param {string} message  The message to be announced by Assistive Technologies.
 235   * @param {string} ariaLive Optional. The politeness level for aria-live. Possible values:
 236   *                          polite or assertive. Default polite.
 237   */
 238  
 239  var speak = function speak(message, ariaLive) {
 240    // Clear previous messages to allow repeated strings being read out.
 241    Object(_clear__WEBPACK_IMPORTED_MODULE_1__["default"])();
 242    message = Object(_filterMessage__WEBPACK_IMPORTED_MODULE_3__["default"])(message);
 243    var containerPolite = document.getElementById('a11y-speak-polite');
 244    var containerAssertive = document.getElementById('a11y-speak-assertive');
 245  
 246    if (containerAssertive && 'assertive' === ariaLive) {
 247      containerAssertive.textContent = message;
 248    } else if (containerPolite) {
 249      containerPolite.textContent = message;
 250    }
 251  };
 252  
 253  
 254  /***/ }),
 255  
 256  /***/ "@wordpress/dom-ready":
 257  /*!*******************************************!*\
 258    !*** external {"this":["wp","domReady"]} ***!
 259    \*******************************************/
 260  /*! no static exports found */
 261  /***/ (function(module, exports) {
 262  
 263  (function() { module.exports = this["wp"]["domReady"]; }());
 264  
 265  /***/ })
 266  
 267  /******/ });
 268  //# sourceMappingURL=a11y.js.map


Generated: Mon Jan 7 01:00:05 2019 Cross-referenced by PHPXref 0.7.1