@wordpress/html-entities
Advanced tools
| // packages/html-entities/src/index.ts | ||
| var _decodeTextArea; | ||
| function decodeEntities(html) { | ||
| if ("string" !== typeof html || -1 === html.indexOf("&")) { | ||
| return html; | ||
| } | ||
| if (void 0 === _decodeTextArea) { | ||
| if (document.implementation && document.implementation.createHTMLDocument) { | ||
| _decodeTextArea = document.implementation.createHTMLDocument("").createElement("textarea"); | ||
| } else { | ||
| _decodeTextArea = document.createElement("textarea"); | ||
| } | ||
| } | ||
| _decodeTextArea.innerHTML = html; | ||
| const decoded = _decodeTextArea.textContent ?? ""; | ||
| _decodeTextArea.innerHTML = ""; | ||
| return decoded; | ||
| } | ||
| export { | ||
| decodeEntities | ||
| }; | ||
| //# sourceMappingURL=index.mjs.map |
| { | ||
| "version": 3, | ||
| "sources": ["../src/index.ts"], | ||
| "sourcesContent": ["let _decodeTextArea: HTMLTextAreaElement | undefined;\n\n/**\n * Decodes the HTML entities from a given string.\n *\n * @param html String that contain HTML entities.\n *\n * @example\n * ```js\n * import { decodeEntities } from '@wordpress/html-entities';\n *\n * const result = decodeEntities( 'á' );\n * console.log( result ); // result will be \"\u00E1\"\n * ```\n *\n * @return The decoded string.\n */\nexport function decodeEntities( html: string ): string {\n\t// Not a string, or no entities to decode.\n\tif ( 'string' !== typeof html || -1 === html.indexOf( '&' ) ) {\n\t\treturn html;\n\t}\n\n\t// Create a textarea for decoding entities, that we can reuse.\n\tif ( undefined === _decodeTextArea ) {\n\t\tif (\n\t\t\tdocument.implementation &&\n\t\t\tdocument.implementation.createHTMLDocument\n\t\t) {\n\t\t\t_decodeTextArea = document.implementation\n\t\t\t\t.createHTMLDocument( '' )\n\t\t\t\t.createElement( 'textarea' );\n\t\t} else {\n\t\t\t_decodeTextArea = document.createElement( 'textarea' );\n\t\t}\n\t}\n\n\t_decodeTextArea.innerHTML = html;\n\tconst decoded = _decodeTextArea.textContent ?? '';\n\t_decodeTextArea.innerHTML = '';\n\n\t/**\n\t * Cast to string, HTMLTextAreaElement should always have `string` textContent.\n\t *\n\t * > The `textContent` property of the `Node` interface represents the text content of the\n\t * > node and its descendants.\n\t * >\n\t * > Value: A string or `null`\n\t * >\n\t * > * If the node is a `document` or a Doctype, `textContent` returns `null`.\n\t * > * If the node is a CDATA section, comment, processing instruction, or text node,\n\t * > textContent returns the text inside the node, i.e., the `Node.nodeValue`.\n\t * > * For other node types, `textContent returns the concatenation of the textContent of\n\t * > every child node, excluding comments and processing instructions. (This is an empty\n\t * > string if the node has no children.)\n\t *\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent\n\t */\n\treturn decoded;\n}\n"], | ||
| "mappings": ";AAAA,IAAI;AAiBG,SAAS,eAAgB,MAAuB;AAEtD,MAAK,aAAa,OAAO,QAAQ,OAAO,KAAK,QAAS,GAAI,GAAI;AAC7D,WAAO;AAAA,EACR;AAGA,MAAK,WAAc,iBAAkB;AACpC,QACC,SAAS,kBACT,SAAS,eAAe,oBACvB;AACD,wBAAkB,SAAS,eACzB,mBAAoB,EAAG,EACvB,cAAe,UAAW;AAAA,IAC7B,OAAO;AACN,wBAAkB,SAAS,cAAe,UAAW;AAAA,IACtD;AAAA,EACD;AAEA,kBAAgB,YAAY;AAC5B,QAAM,UAAU,gBAAgB,eAAe;AAC/C,kBAAgB,YAAY;AAmB5B,SAAO;AACR;", | ||
| "names": [] | ||
| } |
| "use strict"; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // packages/html-entities/src/index.ts | ||
| var index_exports = {}; | ||
| __export(index_exports, { | ||
| decodeEntities: () => decodeEntities | ||
| }); | ||
| module.exports = __toCommonJS(index_exports); | ||
| var _decodeTextArea; | ||
| function decodeEntities(html) { | ||
| if ("string" !== typeof html || -1 === html.indexOf("&")) { | ||
| return html; | ||
| } | ||
| if (void 0 === _decodeTextArea) { | ||
| if (document.implementation && document.implementation.createHTMLDocument) { | ||
| _decodeTextArea = document.implementation.createHTMLDocument("").createElement("textarea"); | ||
| } else { | ||
| _decodeTextArea = document.createElement("textarea"); | ||
| } | ||
| } | ||
| _decodeTextArea.innerHTML = html; | ||
| const decoded = _decodeTextArea.textContent ?? ""; | ||
| _decodeTextArea.innerHTML = ""; | ||
| return decoded; | ||
| } | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| decodeEntities | ||
| }); | ||
| //# sourceMappingURL=index.cjs.map |
| { | ||
| "version": 3, | ||
| "sources": ["../src/index.ts"], | ||
| "sourcesContent": ["let _decodeTextArea: HTMLTextAreaElement | undefined;\n\n/**\n * Decodes the HTML entities from a given string.\n *\n * @param html String that contain HTML entities.\n *\n * @example\n * ```js\n * import { decodeEntities } from '@wordpress/html-entities';\n *\n * const result = decodeEntities( 'á' );\n * console.log( result ); // result will be \"\u00E1\"\n * ```\n *\n * @return The decoded string.\n */\nexport function decodeEntities( html: string ): string {\n\t// Not a string, or no entities to decode.\n\tif ( 'string' !== typeof html || -1 === html.indexOf( '&' ) ) {\n\t\treturn html;\n\t}\n\n\t// Create a textarea for decoding entities, that we can reuse.\n\tif ( undefined === _decodeTextArea ) {\n\t\tif (\n\t\t\tdocument.implementation &&\n\t\t\tdocument.implementation.createHTMLDocument\n\t\t) {\n\t\t\t_decodeTextArea = document.implementation\n\t\t\t\t.createHTMLDocument( '' )\n\t\t\t\t.createElement( 'textarea' );\n\t\t} else {\n\t\t\t_decodeTextArea = document.createElement( 'textarea' );\n\t\t}\n\t}\n\n\t_decodeTextArea.innerHTML = html;\n\tconst decoded = _decodeTextArea.textContent ?? '';\n\t_decodeTextArea.innerHTML = '';\n\n\t/**\n\t * Cast to string, HTMLTextAreaElement should always have `string` textContent.\n\t *\n\t * > The `textContent` property of the `Node` interface represents the text content of the\n\t * > node and its descendants.\n\t * >\n\t * > Value: A string or `null`\n\t * >\n\t * > * If the node is a `document` or a Doctype, `textContent` returns `null`.\n\t * > * If the node is a CDATA section, comment, processing instruction, or text node,\n\t * > textContent returns the text inside the node, i.e., the `Node.nodeValue`.\n\t * > * For other node types, `textContent returns the concatenation of the textContent of\n\t * > every child node, excluding comments and processing instructions. (This is an empty\n\t * > string if the node has no children.)\n\t *\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent\n\t */\n\treturn decoded;\n}\n"], | ||
| "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAI;AAiBG,SAAS,eAAgB,MAAuB;AAEtD,MAAK,aAAa,OAAO,QAAQ,OAAO,KAAK,QAAS,GAAI,GAAI;AAC7D,WAAO;AAAA,EACR;AAGA,MAAK,WAAc,iBAAkB;AACpC,QACC,SAAS,kBACT,SAAS,eAAe,oBACvB;AACD,wBAAkB,SAAS,eACzB,mBAAoB,EAAG,EACvB,cAAe,UAAW;AAAA,IAC7B,OAAO;AACN,wBAAkB,SAAS,cAAe,UAAW;AAAA,IACtD;AAAA,EACD;AAEA,kBAAgB,YAAY;AAC5B,QAAM,UAAU,gBAAgB,eAAe;AAC/C,kBAAgB,YAAY;AAmB5B,SAAO;AACR;", | ||
| "names": [] | ||
| } |
+0
-2
@@ -5,4 +5,2 @@ <!-- Learn how to maintain this file at https://github.com/WordPress/gutenberg/tree/HEAD/packages#maintaining-changelogs. --> | ||
| ## 4.37.0 (2025-12-23) | ||
| ## 4.36.0 (2025-11-26) | ||
@@ -9,0 +7,0 @@ |
+1
-1
| ## Gutenberg | ||
| Copyright 2016-2025 by the contributors | ||
| Copyright 2016-2026 by the contributors | ||
@@ -5,0 +5,0 @@ **License for Contributions (on and after April 15, 2021)** |
+13
-6
| { | ||
| "name": "@wordpress/html-entities", | ||
| "version": "4.37.0", | ||
| "version": "4.37.1-next.06ee73755.0", | ||
| "description": "HTML entity utilities for WordPress.", | ||
@@ -26,9 +26,16 @@ "author": "The WordPress Contributors", | ||
| }, | ||
| "main": "build/index.js", | ||
| "module": "build-module/index.js", | ||
| "files": [ | ||
| "src", | ||
| "build", | ||
| "build-module", | ||
| "build-types", | ||
| "*.md" | ||
| ], | ||
| "main": "build/index.cjs", | ||
| "module": "build-module/index.mjs", | ||
| "exports": { | ||
| ".": { | ||
| "types": "./build-types/index.d.ts", | ||
| "import": "./build-module/index.js", | ||
| "require": "./build/index.js" | ||
| "import": "./build-module/index.mjs", | ||
| "require": "./build/index.cjs" | ||
| }, | ||
@@ -43,3 +50,3 @@ "./package.json": "./package.json" | ||
| }, | ||
| "gitHead": "2cf13ec6cf86153c9b3cf369bf5c59046f5cd950" | ||
| "gitHead": "fd315436f44683a993d5f053789b5279d95b2872" | ||
| } |
| // packages/html-entities/src/index.ts | ||
| var _decodeTextArea; | ||
| function decodeEntities(html) { | ||
| if ("string" !== typeof html || -1 === html.indexOf("&")) { | ||
| return html; | ||
| } | ||
| if (void 0 === _decodeTextArea) { | ||
| if (document.implementation && document.implementation.createHTMLDocument) { | ||
| _decodeTextArea = document.implementation.createHTMLDocument("").createElement("textarea"); | ||
| } else { | ||
| _decodeTextArea = document.createElement("textarea"); | ||
| } | ||
| } | ||
| _decodeTextArea.innerHTML = html; | ||
| const decoded = _decodeTextArea.textContent ?? ""; | ||
| _decodeTextArea.innerHTML = ""; | ||
| return decoded; | ||
| } | ||
| export { | ||
| decodeEntities | ||
| }; | ||
| //# sourceMappingURL=index.js.map |
| { | ||
| "version": 3, | ||
| "sources": ["../src/index.ts"], | ||
| "sourcesContent": ["let _decodeTextArea: HTMLTextAreaElement | undefined;\n\n/**\n * Decodes the HTML entities from a given string.\n *\n * @param html String that contain HTML entities.\n *\n * @example\n * ```js\n * import { decodeEntities } from '@wordpress/html-entities';\n *\n * const result = decodeEntities( 'á' );\n * console.log( result ); // result will be \"\u00E1\"\n * ```\n *\n * @return The decoded string.\n */\nexport function decodeEntities( html: string ): string {\n\t// Not a string, or no entities to decode.\n\tif ( 'string' !== typeof html || -1 === html.indexOf( '&' ) ) {\n\t\treturn html;\n\t}\n\n\t// Create a textarea for decoding entities, that we can reuse.\n\tif ( undefined === _decodeTextArea ) {\n\t\tif (\n\t\t\tdocument.implementation &&\n\t\t\tdocument.implementation.createHTMLDocument\n\t\t) {\n\t\t\t_decodeTextArea = document.implementation\n\t\t\t\t.createHTMLDocument( '' )\n\t\t\t\t.createElement( 'textarea' );\n\t\t} else {\n\t\t\t_decodeTextArea = document.createElement( 'textarea' );\n\t\t}\n\t}\n\n\t_decodeTextArea.innerHTML = html;\n\tconst decoded = _decodeTextArea.textContent ?? '';\n\t_decodeTextArea.innerHTML = '';\n\n\t/**\n\t * Cast to string, HTMLTextAreaElement should always have `string` textContent.\n\t *\n\t * > The `textContent` property of the `Node` interface represents the text content of the\n\t * > node and its descendants.\n\t * >\n\t * > Value: A string or `null`\n\t * >\n\t * > * If the node is a `document` or a Doctype, `textContent` returns `null`.\n\t * > * If the node is a CDATA section, comment, processing instruction, or text node,\n\t * > textContent returns the text inside the node, i.e., the `Node.nodeValue`.\n\t * > * For other node types, `textContent returns the concatenation of the textContent of\n\t * > every child node, excluding comments and processing instructions. (This is an empty\n\t * > string if the node has no children.)\n\t *\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent\n\t */\n\treturn decoded;\n}\n"], | ||
| "mappings": ";AAAA,IAAI;AAiBG,SAAS,eAAgB,MAAuB;AAEtD,MAAK,aAAa,OAAO,QAAQ,OAAO,KAAK,QAAS,GAAI,GAAI;AAC7D,WAAO;AAAA,EACR;AAGA,MAAK,WAAc,iBAAkB;AACpC,QACC,SAAS,kBACT,SAAS,eAAe,oBACvB;AACD,wBAAkB,SAAS,eACzB,mBAAoB,EAAG,EACvB,cAAe,UAAW;AAAA,IAC7B,OAAO;AACN,wBAAkB,SAAS,cAAe,UAAW;AAAA,IACtD;AAAA,EACD;AAEA,kBAAgB,YAAY;AAC5B,QAAM,UAAU,gBAAgB,eAAe;AAC/C,kBAAgB,YAAY;AAmB5B,SAAO;AACR;", | ||
| "names": [] | ||
| } |
| "use strict"; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // packages/html-entities/src/index.ts | ||
| var index_exports = {}; | ||
| __export(index_exports, { | ||
| decodeEntities: () => decodeEntities | ||
| }); | ||
| module.exports = __toCommonJS(index_exports); | ||
| var _decodeTextArea; | ||
| function decodeEntities(html) { | ||
| if ("string" !== typeof html || -1 === html.indexOf("&")) { | ||
| return html; | ||
| } | ||
| if (void 0 === _decodeTextArea) { | ||
| if (document.implementation && document.implementation.createHTMLDocument) { | ||
| _decodeTextArea = document.implementation.createHTMLDocument("").createElement("textarea"); | ||
| } else { | ||
| _decodeTextArea = document.createElement("textarea"); | ||
| } | ||
| } | ||
| _decodeTextArea.innerHTML = html; | ||
| const decoded = _decodeTextArea.textContent ?? ""; | ||
| _decodeTextArea.innerHTML = ""; | ||
| return decoded; | ||
| } | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| decodeEntities | ||
| }); | ||
| //# sourceMappingURL=index.js.map |
| { | ||
| "version": 3, | ||
| "sources": ["../src/index.ts"], | ||
| "sourcesContent": ["let _decodeTextArea: HTMLTextAreaElement | undefined;\n\n/**\n * Decodes the HTML entities from a given string.\n *\n * @param html String that contain HTML entities.\n *\n * @example\n * ```js\n * import { decodeEntities } from '@wordpress/html-entities';\n *\n * const result = decodeEntities( 'á' );\n * console.log( result ); // result will be \"\u00E1\"\n * ```\n *\n * @return The decoded string.\n */\nexport function decodeEntities( html: string ): string {\n\t// Not a string, or no entities to decode.\n\tif ( 'string' !== typeof html || -1 === html.indexOf( '&' ) ) {\n\t\treturn html;\n\t}\n\n\t// Create a textarea for decoding entities, that we can reuse.\n\tif ( undefined === _decodeTextArea ) {\n\t\tif (\n\t\t\tdocument.implementation &&\n\t\t\tdocument.implementation.createHTMLDocument\n\t\t) {\n\t\t\t_decodeTextArea = document.implementation\n\t\t\t\t.createHTMLDocument( '' )\n\t\t\t\t.createElement( 'textarea' );\n\t\t} else {\n\t\t\t_decodeTextArea = document.createElement( 'textarea' );\n\t\t}\n\t}\n\n\t_decodeTextArea.innerHTML = html;\n\tconst decoded = _decodeTextArea.textContent ?? '';\n\t_decodeTextArea.innerHTML = '';\n\n\t/**\n\t * Cast to string, HTMLTextAreaElement should always have `string` textContent.\n\t *\n\t * > The `textContent` property of the `Node` interface represents the text content of the\n\t * > node and its descendants.\n\t * >\n\t * > Value: A string or `null`\n\t * >\n\t * > * If the node is a `document` or a Doctype, `textContent` returns `null`.\n\t * > * If the node is a CDATA section, comment, processing instruction, or text node,\n\t * > textContent returns the text inside the node, i.e., the `Node.nodeValue`.\n\t * > * For other node types, `textContent returns the concatenation of the textContent of\n\t * > every child node, excluding comments and processing instructions. (This is an empty\n\t * > string if the node has no children.)\n\t *\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent\n\t */\n\treturn decoded;\n}\n"], | ||
| "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAI;AAiBG,SAAS,eAAgB,MAAuB;AAEtD,MAAK,aAAa,OAAO,QAAQ,OAAO,KAAK,QAAS,GAAI,GAAI;AAC7D,WAAO;AAAA,EACR;AAGA,MAAK,WAAc,iBAAkB;AACpC,QACC,SAAS,kBACT,SAAS,eAAe,oBACvB;AACD,wBAAkB,SAAS,eACzB,mBAAoB,EAAG,EACvB,cAAe,UAAW;AAAA,IAC7B,OAAO;AACN,wBAAkB,SAAS,cAAe,UAAW;AAAA,IACtD;AAAA,EACD;AAEA,kBAAgB,YAAY;AAC5B,QAAM,UAAU,gBAAgB,eAAe;AAC/C,kBAAgB,YAAY;AAmB5B,SAAO;AACR;", | ||
| "names": [] | ||
| } |
| { | ||
| "$schema": "https://json.schemastore.org/tsconfig.json", | ||
| "extends": "../../tsconfig.base.json" | ||
| } |
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
54013
-22.08%12
-14.29%166
-2.35%1
Infinity%