| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 "use strict"; 2 var wp; 3 (wp ||= {}).a11y = (() => { 4 var __create = Object.create; 5 var __defProp = Object.defineProperty; 6 var __getOwnPropDesc = Object.getOwnPropertyDescriptor; 7 var __getOwnPropNames = Object.getOwnPropertyNames; 8 var __getProtoOf = Object.getPrototypeOf; 9 var __hasOwnProp = Object.prototype.hasOwnProperty; 10 var __commonJS = (cb, mod) => function __require() { 11 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; 12 }; 13 var __export = (target, all) => { 14 for (var name in all) 15 __defProp(target, name, { get: all[name], enumerable: true }); 16 }; 17 var __copyProps = (to, from, except, desc) => { 18 if (from && typeof from === "object" || typeof from === "function") { 19 for (let key of __getOwnPropNames(from)) 20 if (!__hasOwnProp.call(to, key) && key !== except) 21 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); 22 } 23 return to; 24 }; 25 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( 26 // If the importer is in node compatibility mode or this is not an ESM 27 // file that has been converted to a CommonJS file using a Babel- 28 // compatible transform (i.e. "__esModule" has not been set), then set 29 // "default" to the CommonJS "module.exports" for node compatibility. 30 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, 31 mod 32 )); 33 var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); 34 35 // package-external:@wordpress/dom-ready 36 var require_dom_ready = __commonJS({ 37 "package-external:@wordpress/dom-ready"(exports, module) { 38 module.exports = window.wp.domReady; 39 } 40 }); 41 42 // package-external:@wordpress/i18n 43 var require_i18n = __commonJS({ 44 "package-external:@wordpress/i18n"(exports, module) { 45 module.exports = window.wp.i18n; 46 } 47 }); 48 49 // packages/a11y/build-module/index.js 50 var index_exports = {}; 51 __export(index_exports, { 52 setup: () => setup, 53 speak: () => speak 54 }); 55 var import_dom_ready = __toESM(require_dom_ready()); 56 57 // packages/a11y/build-module/script/add-container.js 58 function addContainer(ariaLive = "polite") { 59 const container = document.createElement("div"); 60 container.id = `a11y-speak-$ariaLive}`; 61 container.className = "a11y-speak-region"; 62 container.setAttribute( 63 "style", 64 "position:absolute;margin:-1px;padding:0;height:1px;width:1px;overflow:hidden;clip-path:inset(50%);border:0;word-wrap:normal !important;" 65 ); 66 container.setAttribute("aria-live", ariaLive); 67 container.setAttribute("aria-relevant", "additions text"); 68 container.setAttribute("aria-atomic", "true"); 69 const { body } = document; 70 if (body) { 71 body.appendChild(container); 72 } 73 return container; 74 } 75 76 // packages/a11y/build-module/script/add-intro-text.js 77 var import_i18n = __toESM(require_i18n()); 78 function addIntroText() { 79 const introText = document.createElement("p"); 80 introText.id = "a11y-speak-intro-text"; 81 introText.className = "a11y-speak-intro-text"; 82 introText.textContent = (0, import_i18n.__)("Notifications"); 83 introText.setAttribute( 84 "style", 85 "position:absolute;margin:-1px;padding:0;height:1px;width:1px;overflow:hidden;clip-path:inset(50%);border:0;word-wrap:normal !important;" 86 ); 87 introText.setAttribute("hidden", ""); 88 const { body } = document; 89 if (body) { 90 body.appendChild(introText); 91 } 92 return introText; 93 } 94 95 // packages/a11y/build-module/shared/clear.js 96 function clear() { 97 const regions = document.getElementsByClassName("a11y-speak-region"); 98 const introText = document.getElementById("a11y-speak-intro-text"); 99 for (let i = 0; i < regions.length; i++) { 100 regions[i].textContent = ""; 101 } 102 if (introText) { 103 introText.setAttribute("hidden", "hidden"); 104 } 105 } 106 107 // packages/a11y/build-module/shared/filter-message.js 108 var previousMessage = ""; 109 function filterMessage(message) { 110 message = message.replace(/<[^<>]+>/g, " "); 111 if (previousMessage === message) { 112 message += "\xA0"; 113 } 114 previousMessage = message; 115 return message; 116 } 117 118 // packages/a11y/build-module/shared/index.js 119 function speak(message, ariaLive) { 120 clear(); 121 message = filterMessage(message); 122 const introText = document.getElementById("a11y-speak-intro-text"); 123 const containerAssertive = document.getElementById( 124 "a11y-speak-assertive" 125 ); 126 const containerPolite = document.getElementById("a11y-speak-polite"); 127 if (containerAssertive && ariaLive === "assertive") { 128 containerAssertive.textContent = message; 129 } else if (containerPolite) { 130 containerPolite.textContent = message; 131 } 132 if (introText) { 133 introText.removeAttribute("hidden"); 134 } 135 } 136 137 // packages/a11y/build-module/index.js 138 function setup() { 139 const introText = document.getElementById("a11y-speak-intro-text"); 140 const containerAssertive = document.getElementById( 141 "a11y-speak-assertive" 142 ); 143 const containerPolite = document.getElementById("a11y-speak-polite"); 144 if (introText === null) { 145 addIntroText(); 146 } 147 if (containerAssertive === null) { 148 addContainer("assertive"); 149 } 150 if (containerPolite === null) { 151 addContainer("polite"); 152 } 153 } 154 (0, import_dom_ready.default)(setup); 155 return __toCommonJS(index_exports); 156 })();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Thu May 7 08:20:02 2026 | Cross-referenced by PHPXref |