[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 /******/ (() => { // webpackBootstrap 2 /******/ "use strict"; 3 /******/ // The require scope 4 /******/ var __webpack_require__ = {}; 5 /******/ 6 /************************************************************************/ 7 /******/ /* webpack/runtime/define property getters */ 8 /******/ (() => { 9 /******/ // define getter functions for harmony exports 10 /******/ __webpack_require__.d = (exports, definition) => { 11 /******/ for(var key in definition) { 12 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 13 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 14 /******/ } 15 /******/ } 16 /******/ }; 17 /******/ })(); 18 /******/ 19 /******/ /* webpack/runtime/hasOwnProperty shorthand */ 20 /******/ (() => { 21 /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) 22 /******/ })(); 23 /******/ 24 /************************************************************************/ 25 var __webpack_exports__ = {}; 26 /* harmony export */ __webpack_require__.d(__webpack_exports__, { 27 /* harmony export */ "default": () => (/* binding */ TokenList) 28 /* harmony export */ }); 29 class TokenList { 30 _currentValue; 31 _valueAsArray; 32 /** 33 * Constructs a new instance of TokenList. 34 * 35 * @param initialValue Initial value to assign. 36 */ 37 constructor(initialValue = "") { 38 this._currentValue = ""; 39 this._valueAsArray = []; 40 this.value = initialValue; 41 } 42 entries(...args) { 43 return this._valueAsArray.entries(...args); 44 } 45 forEach(...args) { 46 return this._valueAsArray.forEach(...args); 47 } 48 keys(...args) { 49 return this._valueAsArray.keys(...args); 50 } 51 values(...args) { 52 return this._valueAsArray.values(...args); 53 } 54 /** 55 * Returns the associated set as string. 56 * 57 * @see https://dom.spec.whatwg.org/#dom-domtokenlist-value 58 * 59 * @return Token set as string. 60 */ 61 get value() { 62 return this._currentValue; 63 } 64 /** 65 * Replaces the associated set with a new string value. 66 * 67 * @see https://dom.spec.whatwg.org/#dom-domtokenlist-value 68 * 69 * @param value New token set as string. 70 */ 71 set value(value) { 72 value = String(value); 73 this._valueAsArray = [ 74 ...new Set(value.split(/\s+/g).filter(Boolean)) 75 ]; 76 this._currentValue = this._valueAsArray.join(" "); 77 } 78 /** 79 * Returns the number of tokens. 80 * 81 * @see https://dom.spec.whatwg.org/#dom-domtokenlist-length 82 * 83 * @return Number of tokens. 84 */ 85 get length() { 86 return this._valueAsArray.length; 87 } 88 /** 89 * Returns the stringified form of the TokenList. 90 * 91 * @see https://dom.spec.whatwg.org/#DOMTokenList-stringification-behavior 92 * @see https://www.ecma-international.org/ecma-262/9.0/index.html#sec-tostring 93 * 94 * @return Token set as string. 95 */ 96 toString() { 97 return this.value; 98 } 99 /** 100 * Returns an iterator for the TokenList, iterating items of the set. 101 * 102 * @see https://dom.spec.whatwg.org/#domtokenlist 103 * 104 * @return TokenList iterator. 105 */ 106 *[Symbol.iterator]() { 107 return yield* this._valueAsArray; 108 } 109 /** 110 * Returns the token with index `index`. 111 * 112 * @see https://dom.spec.whatwg.org/#dom-domtokenlist-item 113 * 114 * @param index Index at which to return token. 115 * 116 * @return Token at index. 117 */ 118 item(index) { 119 return this._valueAsArray[index]; 120 } 121 /** 122 * Returns true if `token` is present, and false otherwise. 123 * 124 * @see https://dom.spec.whatwg.org/#dom-domtokenlist-contains 125 * 126 * @param item Token to test. 127 * 128 * @return Whether token is present. 129 */ 130 contains(item) { 131 return this._valueAsArray.indexOf(item) !== -1; 132 } 133 /** 134 * Adds all arguments passed, except those already present. 135 * 136 * @see https://dom.spec.whatwg.org/#dom-domtokenlist-add 137 * 138 * @param items Items to add. 139 */ 140 add(...items) { 141 this.value += " " + items.join(" "); 142 } 143 /** 144 * Removes arguments passed, if they are present. 145 * 146 * @see https://dom.spec.whatwg.org/#dom-domtokenlist-remove 147 * 148 * @param items Items to remove. 149 */ 150 remove(...items) { 151 this.value = this._valueAsArray.filter((val) => !items.includes(val)).join(" "); 152 } 153 /** 154 * If `force` is not given, "toggles" `token`, removing it if it’s present 155 * and adding it if it’s not present. If `force` is true, adds token (same 156 * as add()). If force is false, removes token (same as remove()). Returns 157 * true if `token` is now present, and false otherwise. 158 * 159 * @see https://dom.spec.whatwg.org/#dom-domtokenlist-toggle 160 * 161 * @param token Token to toggle. 162 * @param [force] Presence to force. 163 * 164 * @return Whether token is present after toggle. 165 */ 166 toggle(token, force) { 167 if (void 0 === force) { 168 force = !this.contains(token); 169 } 170 if (force) { 171 this.add(token); 172 } else { 173 this.remove(token); 174 } 175 return force; 176 } 177 /** 178 * Replaces `token` with `newToken`. Returns true if `token` was replaced 179 * with `newToken`, and false otherwise. 180 * 181 * @see https://dom.spec.whatwg.org/#dom-domtokenlist-replace 182 * 183 * @param token Token to replace with `newToken`. 184 * @param newToken Token to use in place of `token`. 185 * 186 * @return Whether replacement occurred. 187 */ 188 replace(token, newToken) { 189 if (!this.contains(token)) { 190 return false; 191 } 192 this.remove(token); 193 this.add(newToken); 194 return true; 195 } 196 /* eslint-disable @typescript-eslint/no-unused-vars */ 197 /** 198 * Returns true if `token` is in the associated attribute’s supported 199 * tokens. Returns false otherwise. 200 * 201 * Always returns `true` in this implementation. 202 * 203 * @param _token 204 * @see https://dom.spec.whatwg.org/#dom-domtokenlist-supports 205 * 206 * @return Whether token is supported. 207 */ 208 supports(_token) { 209 return true; 210 } 211 /* eslint-enable @typescript-eslint/no-unused-vars */ 212 } 213 214 215 (window.wp = window.wp || {}).tokenList = __webpack_exports__["default"]; 216 /******/ })() 217 ;
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated : Wed Oct 22 08:20:04 2025 | Cross-referenced by PHPXref |