author | ymh <ymh.work@gmail.com> |
Mon, 08 Sep 2025 19:44:41 +0200 | |
changeset 23 | 417f20492bf7 |
parent 21 | 48c4eec2b7e6 |
permissions | -rw-r--r-- |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1 |
/******/ (() => { // webpackBootstrap |
19 | 2 |
/******/ "use strict"; |
3 |
/******/ // The require scope |
|
4 |
/******/ var __webpack_require__ = {}; |
|
5 |
/******/ |
|
6 |
/************************************************************************/ |
|
7 |
/******/ /* webpack/runtime/define property getters */ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
8 |
/******/ (() => { |
19 | 9 |
/******/ // define getter functions for harmony exports |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
10 |
/******/ __webpack_require__.d = (exports, definition) => { |
19 | 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 |
/******/ } |
|
9 | 16 |
/******/ }; |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
17 |
/******/ })(); |
19 | 18 |
/******/ |
19 |
/******/ /* webpack/runtime/hasOwnProperty shorthand */ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
20 |
/******/ (() => { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
21 |
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
22 |
/******/ })(); |
19 | 23 |
/******/ |
24 |
/******/ /* webpack/runtime/make namespace object */ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
25 |
/******/ (() => { |
19 | 26 |
/******/ // define __esModule on exports |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
27 |
/******/ __webpack_require__.r = (exports) => { |
19 | 28 |
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
29 |
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
|
30 |
/******/ } |
|
31 |
/******/ Object.defineProperty(exports, '__esModule', { value: true }); |
|
32 |
/******/ }; |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
33 |
/******/ })(); |
19 | 34 |
/******/ |
9 | 35 |
/************************************************************************/ |
19 | 36 |
var __webpack_exports__ = {}; |
9 | 37 |
__webpack_require__.r(__webpack_exports__); |
19 | 38 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
39 |
/* harmony export */ decodeEntities: () => (/* binding */ decodeEntities) |
19 | 40 |
/* harmony export */ }); |
16 | 41 |
/** @type {HTMLTextAreaElement} */ |
18 | 42 |
let _decodeTextArea; |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
43 |
|
9 | 44 |
/** |
45 |
* Decodes the HTML entities from a given string. |
|
46 |
* |
|
47 |
* @param {string} html String that contain HTML entities. |
|
48 |
* |
|
49 |
* @example |
|
50 |
* ```js |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
51 |
* import { decodeEntities } from '@wordpress/html-entities'; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
52 |
* |
9 | 53 |
* const result = decodeEntities( 'á' ); |
54 |
* console.log( result ); // result will be "á" |
|
55 |
* ``` |
|
56 |
* |
|
57 |
* @return {string} The decoded string. |
|
58 |
*/ |
|
59 |
function decodeEntities(html) { |
|
19 | 60 |
// Not a string, or no entities to decode. |
9 | 61 |
if ('string' !== typeof html || -1 === html.indexOf('&')) { |
62 |
return html; |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
63 |
} |
9 | 64 |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
65 |
// Create a textarea for decoding entities, that we can reuse. |
9 | 66 |
if (undefined === _decodeTextArea) { |
67 |
if (document.implementation && document.implementation.createHTMLDocument) { |
|
68 |
_decodeTextArea = document.implementation.createHTMLDocument('').createElement('textarea'); |
|
69 |
} else { |
|
70 |
_decodeTextArea = document.createElement('textarea'); |
|
71 |
} |
|
72 |
} |
|
73 |
_decodeTextArea.innerHTML = html; |
|
18 | 74 |
const decoded = _decodeTextArea.textContent; |
9 | 75 |
_decodeTextArea.innerHTML = ''; |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
76 |
|
16 | 77 |
/** |
78 |
* Cast to string, HTMLTextAreaElement should always have `string` textContent. |
|
79 |
* |
|
80 |
* > The `textContent` property of the `Node` interface represents the text content of the |
|
81 |
* > node and its descendants. |
|
82 |
* > |
|
83 |
* > Value: A string or `null` |
|
84 |
* > |
|
85 |
* > * If the node is a `document` or a Doctype, `textContent` returns `null`. |
|
86 |
* > * If the node is a CDATA section, comment, processing instruction, or text node, |
|
87 |
* > textContent returns the text inside the node, i.e., the `Node.nodeValue`. |
|
88 |
* > * For other node types, `textContent returns the concatenation of the textContent of |
|
89 |
* > every child node, excluding comments and processing instructions. (This is an empty |
|
90 |
* > string if the node has no children.) |
|
91 |
* |
|
92 |
* @see https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent |
|
93 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
94 |
return /** @type {string} */decoded; |
9 | 95 |
} |
96 |
||
19 | 97 |
(window.wp = window.wp || {}).htmlEntities = __webpack_exports__; |
98 |
/******/ })() |
|
99 |
; |