@wordpress/escape-html 3.34.0 → 3.34.1-next.2f1c7c01b.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/escape-greater.js +2 -0
- package/build/escape-greater.js.map +1 -1
- package/build/index.js +3 -1
- package/build/index.js.map +1 -1
- package/build-module/escape-greater.js +1 -0
- package/build-module/escape-greater.js.map +1 -1
- package/build-module/index.js +2 -1
- package/build-module/index.js.map +1 -1
- package/package.json +2 -2
package/build/escape-greater.js
CHANGED
|
@@ -16,6 +16,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/escape-html/src/escape-greater.ts
|
|
19
21
|
var escape_greater_exports = {};
|
|
20
22
|
__export(escape_greater_exports, {
|
|
21
23
|
default: () => __unstableEscapeGreaterThan
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/escape-greater.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * Returns a string with greater-than sign replaced.\n *\n * Note that if a resolution for Trac#45387 comes to fruition, it is no longer\n * necessary for `__unstableEscapeGreaterThan` to exist.\n *\n * See: https://core.trac.wordpress.org/ticket/45387\n *\n * @param value Original string.\n *\n * @return Escaped string.\n */\nexport default function __unstableEscapeGreaterThan( value: string ): string {\n\treturn value.replace( />/g, '>' );\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAYe,SAAR,4BAA8C,OAAwB;AAC5E,SAAO,MAAM,QAAS,MAAM,MAAO;AACpC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build/index.js
CHANGED
|
@@ -26,6 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// packages/escape-html/src/index.ts
|
|
29
31
|
var index_exports = {};
|
|
30
32
|
__export(index_exports, {
|
|
31
33
|
escapeAmpersand: () => escapeAmpersand,
|
|
@@ -38,7 +40,7 @@ __export(index_exports, {
|
|
|
38
40
|
});
|
|
39
41
|
module.exports = __toCommonJS(index_exports);
|
|
40
42
|
var import_escape_greater = __toESM(require("./escape-greater"));
|
|
41
|
-
|
|
43
|
+
var REGEXP_INVALID_ATTRIBUTE_NAME = /[\u007F-\u009F "'>/="\uFDD0-\uFDEF]/;
|
|
42
44
|
function escapeAmpersand(value) {
|
|
43
45
|
return value.replace(/&(?!([a-z0-9]+|#[0-9]+|#x[a-f0-9]+);)/gi, "&");
|
|
44
46
|
}
|
package/build/index.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport __unstableEscapeGreaterThan from './escape-greater';\n\n/**\n * Regular expression matching invalid attribute names.\n *\n * \"Attribute names must consist of one or more characters other than controls,\n * U+0020 SPACE, U+0022 (\"), U+0027 ('), U+003E (>), U+002F (/), U+003D (=),\n * and noncharacters.\"\n *\n * @see https://html.spec.whatwg.org/multipage/syntax.html#attributes-2\n */\nconst REGEXP_INVALID_ATTRIBUTE_NAME: RegExp =\n\t/[\\u007F-\\u009F \"'>/=\"\\uFDD0-\\uFDEF]/;\n\n/**\n * Returns a string with ampersands escaped. Note that this is an imperfect\n * implementation, where only ampersands which do not appear as a pattern of\n * named, decimal, or hexadecimal character references are escaped. Invalid\n * named references (i.e. ambiguous ampersand) are still permitted.\n *\n * @see https://w3c.github.io/html/syntax.html#character-references\n * @see https://w3c.github.io/html/syntax.html#ambiguous-ampersand\n * @see https://w3c.github.io/html/syntax.html#named-character-references\n *\n * @param value Original string.\n *\n * @return Escaped string.\n */\nexport function escapeAmpersand( value: string ): string {\n\treturn value.replace( /&(?!([a-z0-9]+|#[0-9]+|#x[a-f0-9]+);)/gi, '&' );\n}\n\n/**\n * Returns a string with quotation marks replaced.\n *\n * @param value Original string.\n *\n * @return Escaped string.\n */\nexport function escapeQuotationMark( value: string ): string {\n\treturn value.replace( /\"/g, '"' );\n}\n\n/**\n * Returns a string with less-than sign replaced.\n *\n * @param value Original string.\n *\n * @return Escaped string.\n */\nexport function escapeLessThan( value: string ): string {\n\treturn value.replace( /</g, '<' );\n}\n\n/**\n * Returns an escaped attribute value.\n *\n * @see https://w3c.github.io/html/syntax.html#elements-attributes\n *\n * \"[...] the text cannot contain an ambiguous ampersand [...] must not contain\n * any literal U+0022 QUOTATION MARK characters (\")\"\n *\n * Note we also escape the greater than symbol, as this is used by wptexturize to\n * split HTML strings. This is a WordPress specific fix\n *\n * Note that if a resolution for Trac#45387 comes to fruition, it is no longer\n * necessary for `__unstableEscapeGreaterThan` to be used.\n *\n * See: https://core.trac.wordpress.org/ticket/45387\n *\n * @param value Attribute value.\n *\n * @return Escaped attribute value.\n */\nexport function escapeAttribute( value: string ): string {\n\treturn __unstableEscapeGreaterThan(\n\t\tescapeQuotationMark( escapeAmpersand( value ) )\n\t);\n}\n\n/**\n * Returns an escaped HTML element value.\n *\n * @see https://w3c.github.io/html/syntax.html#writing-html-documents-elements\n *\n * \"the text must not contain the character U+003C LESS-THAN SIGN (<) or an\n * ambiguous ampersand.\"\n *\n * @param value Element value.\n *\n * @return Escaped HTML element value.\n */\nexport function escapeHTML( value: string ): string {\n\treturn escapeLessThan( escapeAmpersand( value ) );\n}\n\n/**\n * Returns an escaped Editable HTML element value. This is different from\n * `escapeHTML`, because for editable HTML, ALL ampersands must be escaped in\n * order to render the content correctly on the page.\n *\n * @param value Element value.\n *\n * @return Escaped HTML element value.\n */\nexport function escapeEditableHTML( value: string ): string {\n\treturn escapeLessThan( value.replace( /&/g, '&' ) );\n}\n\n/**\n * Returns true if the given attribute name is valid, or false otherwise.\n *\n * @param name Attribute name to test.\n *\n * @return Whether attribute is valid.\n */\nexport function isValidAttributeName( name: string ): boolean {\n\treturn ! REGEXP_INVALID_ATTRIBUTE_NAME.test( name );\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,4BAAwC;AAWxC,IAAM,gCACL;AAgBM,SAAS,gBAAiB,OAAwB;AACxD,SAAO,MAAM,QAAS,2CAA2C,OAAQ;AAC1E;AASO,SAAS,oBAAqB,OAAwB;AAC5D,SAAO,MAAM,QAAS,MAAM,QAAS;AACtC;AASO,SAAS,eAAgB,OAAwB;AACvD,SAAO,MAAM,QAAS,MAAM,MAAO;AACpC;AAsBO,SAAS,gBAAiB,OAAwB;AACxD,aAAO,sBAAAA;AAAA,IACN,oBAAqB,gBAAiB,KAAM,CAAE;AAAA,EAC/C;AACD;AAcO,SAAS,WAAY,OAAwB;AACnD,SAAO,eAAgB,gBAAiB,KAAM,CAAE;AACjD;AAWO,SAAS,mBAAoB,OAAwB;AAC3D,SAAO,eAAgB,MAAM,QAAS,MAAM,OAAQ,CAAE;AACvD;AASO,SAAS,qBAAsB,MAAwB;AAC7D,SAAO,CAAE,8BAA8B,KAAM,IAAK;AACnD;",
|
|
6
6
|
"names": ["__unstableEscapeGreaterThan"]
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/escape-greater.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * Returns a string with greater-than sign replaced.\n *\n * Note that if a resolution for Trac#45387 comes to fruition, it is no longer\n * necessary for `__unstableEscapeGreaterThan` to exist.\n *\n * See: https://core.trac.wordpress.org/ticket/45387\n *\n * @param value Original string.\n *\n * @return Escaped string.\n */\nexport default function __unstableEscapeGreaterThan( value: string ): string {\n\treturn value.replace( />/g, '>' );\n}\n"],
|
|
5
|
-
"mappings": "AAYe,SAAR,4BAA8C,OAAwB;AAC5E,SAAO,MAAM,QAAS,MAAM,MAAO;AACpC;",
|
|
5
|
+
"mappings": ";AAYe,SAAR,4BAA8C,OAAwB;AAC5E,SAAO,MAAM,QAAS,MAAM,MAAO;AACpC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build-module/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
// packages/escape-html/src/index.ts
|
|
1
2
|
import __unstableEscapeGreaterThan from "./escape-greater";
|
|
2
|
-
|
|
3
|
+
var REGEXP_INVALID_ATTRIBUTE_NAME = /[\u007F-\u009F "'>/="\uFDD0-\uFDEF]/;
|
|
3
4
|
function escapeAmpersand(value) {
|
|
4
5
|
return value.replace(/&(?!([a-z0-9]+|#[0-9]+|#x[a-f0-9]+);)/gi, "&");
|
|
5
6
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport __unstableEscapeGreaterThan from './escape-greater';\n\n/**\n * Regular expression matching invalid attribute names.\n *\n * \"Attribute names must consist of one or more characters other than controls,\n * U+0020 SPACE, U+0022 (\"), U+0027 ('), U+003E (>), U+002F (/), U+003D (=),\n * and noncharacters.\"\n *\n * @see https://html.spec.whatwg.org/multipage/syntax.html#attributes-2\n */\nconst REGEXP_INVALID_ATTRIBUTE_NAME: RegExp =\n\t/[\\u007F-\\u009F \"'>/=\"\\uFDD0-\\uFDEF]/;\n\n/**\n * Returns a string with ampersands escaped. Note that this is an imperfect\n * implementation, where only ampersands which do not appear as a pattern of\n * named, decimal, or hexadecimal character references are escaped. Invalid\n * named references (i.e. ambiguous ampersand) are still permitted.\n *\n * @see https://w3c.github.io/html/syntax.html#character-references\n * @see https://w3c.github.io/html/syntax.html#ambiguous-ampersand\n * @see https://w3c.github.io/html/syntax.html#named-character-references\n *\n * @param value Original string.\n *\n * @return Escaped string.\n */\nexport function escapeAmpersand( value: string ): string {\n\treturn value.replace( /&(?!([a-z0-9]+|#[0-9]+|#x[a-f0-9]+);)/gi, '&' );\n}\n\n/**\n * Returns a string with quotation marks replaced.\n *\n * @param value Original string.\n *\n * @return Escaped string.\n */\nexport function escapeQuotationMark( value: string ): string {\n\treturn value.replace( /\"/g, '"' );\n}\n\n/**\n * Returns a string with less-than sign replaced.\n *\n * @param value Original string.\n *\n * @return Escaped string.\n */\nexport function escapeLessThan( value: string ): string {\n\treturn value.replace( /</g, '<' );\n}\n\n/**\n * Returns an escaped attribute value.\n *\n * @see https://w3c.github.io/html/syntax.html#elements-attributes\n *\n * \"[...] the text cannot contain an ambiguous ampersand [...] must not contain\n * any literal U+0022 QUOTATION MARK characters (\")\"\n *\n * Note we also escape the greater than symbol, as this is used by wptexturize to\n * split HTML strings. This is a WordPress specific fix\n *\n * Note that if a resolution for Trac#45387 comes to fruition, it is no longer\n * necessary for `__unstableEscapeGreaterThan` to be used.\n *\n * See: https://core.trac.wordpress.org/ticket/45387\n *\n * @param value Attribute value.\n *\n * @return Escaped attribute value.\n */\nexport function escapeAttribute( value: string ): string {\n\treturn __unstableEscapeGreaterThan(\n\t\tescapeQuotationMark( escapeAmpersand( value ) )\n\t);\n}\n\n/**\n * Returns an escaped HTML element value.\n *\n * @see https://w3c.github.io/html/syntax.html#writing-html-documents-elements\n *\n * \"the text must not contain the character U+003C LESS-THAN SIGN (<) or an\n * ambiguous ampersand.\"\n *\n * @param value Element value.\n *\n * @return Escaped HTML element value.\n */\nexport function escapeHTML( value: string ): string {\n\treturn escapeLessThan( escapeAmpersand( value ) );\n}\n\n/**\n * Returns an escaped Editable HTML element value. This is different from\n * `escapeHTML`, because for editable HTML, ALL ampersands must be escaped in\n * order to render the content correctly on the page.\n *\n * @param value Element value.\n *\n * @return Escaped HTML element value.\n */\nexport function escapeEditableHTML( value: string ): string {\n\treturn escapeLessThan( value.replace( /&/g, '&' ) );\n}\n\n/**\n * Returns true if the given attribute name is valid, or false otherwise.\n *\n * @param name Attribute name to test.\n *\n * @return Whether attribute is valid.\n */\nexport function isValidAttributeName( name: string ): boolean {\n\treturn ! REGEXP_INVALID_ATTRIBUTE_NAME.test( name );\n}\n"],
|
|
5
|
-
"mappings": "AAGA,OAAO,iCAAiC;AAWxC,
|
|
5
|
+
"mappings": ";AAGA,OAAO,iCAAiC;AAWxC,IAAM,gCACL;AAgBM,SAAS,gBAAiB,OAAwB;AACxD,SAAO,MAAM,QAAS,2CAA2C,OAAQ;AAC1E;AASO,SAAS,oBAAqB,OAAwB;AAC5D,SAAO,MAAM,QAAS,MAAM,QAAS;AACtC;AASO,SAAS,eAAgB,OAAwB;AACvD,SAAO,MAAM,QAAS,MAAM,MAAO;AACpC;AAsBO,SAAS,gBAAiB,OAAwB;AACxD,SAAO;AAAA,IACN,oBAAqB,gBAAiB,KAAM,CAAE;AAAA,EAC/C;AACD;AAcO,SAAS,WAAY,OAAwB;AACnD,SAAO,eAAgB,gBAAiB,KAAM,CAAE;AACjD;AAWO,SAAS,mBAAoB,OAAwB;AAC3D,SAAO,eAAgB,MAAM,QAAS,MAAM,OAAQ,CAAE;AACvD;AASO,SAAS,qBAAsB,MAAwB;AAC7D,SAAO,CAAE,8BAA8B,KAAM,IAAK;AACnD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/escape-html",
|
|
3
|
-
"version": "3.34.0",
|
|
3
|
+
"version": "3.34.1-next.2f1c7c01b.0",
|
|
4
4
|
"description": "Escape HTML utils.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "c6ddcdf455bc02567a2c9e03de6862a2061b85e8"
|
|
43
43
|
}
|