@wordpress/dom 4.32.0 → 4.32.1-next.ff1cebbba.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.
Files changed (185) hide show
  1. package/build/data-transfer.js +30 -18
  2. package/build/data-transfer.js.map +7 -1
  3. package/build/dom/caret-range-from-point.js +22 -25
  4. package/build/dom/caret-range-from-point.js.map +7 -1
  5. package/build/dom/clean-node-list.js +122 -129
  6. package/build/dom/clean-node-list.js.map +7 -1
  7. package/build/dom/compute-caret-rect.js +36 -21
  8. package/build/dom/compute-caret-rect.js.map +7 -1
  9. package/build/dom/document-has-selection.js +36 -22
  10. package/build/dom/document-has-selection.js.map +7 -1
  11. package/build/dom/document-has-text-selection.js +25 -23
  12. package/build/dom/document-has-text-selection.js.map +7 -1
  13. package/build/dom/document-has-uncollapsed-selection.js +35 -22
  14. package/build/dom/document-has-uncollapsed-selection.js.map +7 -1
  15. package/build/dom/get-computed-style.js +27 -17
  16. package/build/dom/get-computed-style.js.map +7 -1
  17. package/build/dom/get-offset-parent.js +43 -32
  18. package/build/dom/get-offset-parent.js.map +7 -1
  19. package/build/dom/get-range-height.js +24 -18
  20. package/build/dom/get-range-height.js.map +7 -1
  21. package/build/dom/get-rectangle-from-range.js +47 -68
  22. package/build/dom/get-rectangle-from-range.js.map +7 -1
  23. package/build/dom/get-scroll-container.js +44 -37
  24. package/build/dom/get-scroll-container.js.map +7 -1
  25. package/build/dom/hidden-caret-range-from-point.js +39 -33
  26. package/build/dom/hidden-caret-range-from-point.js.map +7 -1
  27. package/build/dom/index.js +116 -195
  28. package/build/dom/index.js.map +7 -1
  29. package/build/dom/input-field-has-uncollapsed-selection.js +40 -42
  30. package/build/dom/input-field-has-uncollapsed-selection.js.map +7 -1
  31. package/build/dom/insert-after.js +24 -19
  32. package/build/dom/insert-after.js.map +7 -1
  33. package/build/dom/is-edge.js +57 -67
  34. package/build/dom/is-edge.js.map +7 -1
  35. package/build/dom/is-element.js +22 -11
  36. package/build/dom/is-element.js.map +7 -1
  37. package/build/dom/is-empty.js +27 -17
  38. package/build/dom/is-empty.js.map +7 -1
  39. package/build/dom/is-entirely-selected.js +46 -50
  40. package/build/dom/is-entirely-selected.js.map +7 -1
  41. package/build/dom/is-form-element.js +36 -24
  42. package/build/dom/is-form-element.js.map +7 -1
  43. package/build/dom/is-horizontal-edge.js +34 -20
  44. package/build/dom/is-horizontal-edge.js.map +7 -1
  45. package/build/dom/is-html-input-element.js +23 -12
  46. package/build/dom/is-html-input-element.js.map +7 -1
  47. package/build/dom/is-input-or-text-area.js +23 -12
  48. package/build/dom/is-input-or-text-area.js.map +7 -1
  49. package/build/dom/is-number-input.js +38 -29
  50. package/build/dom/is-number-input.js.map +7 -1
  51. package/build/dom/is-rtl.js +34 -19
  52. package/build/dom/is-rtl.js.map +7 -1
  53. package/build/dom/is-selection-forward.js +26 -40
  54. package/build/dom/is-selection-forward.js.map +7 -1
  55. package/build/dom/is-text-field.js +49 -24
  56. package/build/dom/is-text-field.js.map +7 -1
  57. package/build/dom/is-vertical-edge.js +34 -20
  58. package/build/dom/is-vertical-edge.js.map +7 -1
  59. package/build/dom/place-caret-at-edge.js +52 -55
  60. package/build/dom/place-caret-at-edge.js.map +7 -1
  61. package/build/dom/place-caret-at-horizontal-edge.js +34 -18
  62. package/build/dom/place-caret-at-horizontal-edge.js.map +7 -1
  63. package/build/dom/place-caret-at-vertical-edge.js +34 -19
  64. package/build/dom/place-caret-at-vertical-edge.js.map +7 -1
  65. package/build/dom/remove-invalid-html.js +35 -22
  66. package/build/dom/remove-invalid-html.js.map +7 -1
  67. package/build/dom/remove.js +24 -17
  68. package/build/dom/remove.js.map +7 -1
  69. package/build/dom/replace-tag.js +24 -19
  70. package/build/dom/replace-tag.js.map +7 -1
  71. package/build/dom/replace.js +38 -23
  72. package/build/dom/replace.js.map +7 -1
  73. package/build/dom/safe-html.js +39 -28
  74. package/build/dom/safe-html.js.map +7 -1
  75. package/build/dom/scroll-if-no-range.js +26 -18
  76. package/build/dom/scroll-if-no-range.js.map +7 -1
  77. package/build/dom/strip-html.js +36 -23
  78. package/build/dom/strip-html.js.map +7 -1
  79. package/build/dom/unwrap.js +24 -18
  80. package/build/dom/unwrap.js.map +7 -1
  81. package/build/dom/wrap.js +24 -17
  82. package/build/dom/wrap.js.map +7 -1
  83. package/build/focusable.js +52 -85
  84. package/build/focusable.js.map +7 -1
  85. package/build/index.js +44 -58
  86. package/build/index.js.map +7 -1
  87. package/build/phrasing-content.js +88 -128
  88. package/build/phrasing-content.js.map +7 -1
  89. package/build/tabbable.js +52 -137
  90. package/build/tabbable.js.map +7 -1
  91. package/build/utils/assert-is-defined.js +30 -7
  92. package/build/utils/assert-is-defined.js.map +7 -1
  93. package/build-module/data-transfer.js +9 -15
  94. package/build-module/data-transfer.js.map +7 -1
  95. package/build-module/dom/caret-range-from-point.js +5 -22
  96. package/build-module/dom/caret-range-from-point.js.map +7 -1
  97. package/build-module/dom/clean-node-list.js +94 -123
  98. package/build-module/dom/clean-node-list.js.map +7 -1
  99. package/build-module/dom/compute-caret-rect.js +8 -16
  100. package/build-module/dom/compute-caret-rect.js.map +7 -1
  101. package/build-module/dom/document-has-selection.js +8 -17
  102. package/build-module/dom/document-has-selection.js.map +7 -1
  103. package/build-module/dom/document-has-text-selection.js +8 -20
  104. package/build-module/dom/document-has-text-selection.js.map +7 -1
  105. package/build-module/dom/document-has-uncollapsed-selection.js +7 -17
  106. package/build-module/dom/document-has-uncollapsed-selection.js.map +7 -1
  107. package/build-module/dom/get-computed-style.js +10 -14
  108. package/build-module/dom/get-computed-style.js.map +7 -1
  109. package/build-module/dom/get-offset-parent.js +16 -28
  110. package/build-module/dom/get-offset-parent.js.map +7 -1
  111. package/build-module/dom/get-range-height.js +7 -15
  112. package/build-module/dom/get-range-height.js.map +7 -1
  113. package/build-module/dom/get-rectangle-from-range.js +30 -65
  114. package/build-module/dom/get-rectangle-from-range.js.map +7 -1
  115. package/build-module/dom/get-scroll-container.js +16 -32
  116. package/build-module/dom/get-scroll-container.js.map +7 -1
  117. package/build-module/dom/hidden-caret-range-from-point.js +11 -28
  118. package/build-module/dom/hidden-caret-range-from-point.js.map +7 -1
  119. package/build-module/dom/index.js +57 -28
  120. package/build-module/dom/index.js.map +7 -1
  121. package/build-module/dom/input-field-has-uncollapsed-selection.js +12 -37
  122. package/build-module/dom/input-field-has-uncollapsed-selection.js.map +7 -1
  123. package/build-module/dom/insert-after.js +7 -16
  124. package/build-module/dom/insert-after.js.map +7 -1
  125. package/build-module/dom/is-edge.js +24 -57
  126. package/build-module/dom/is-edge.js.map +7 -1
  127. package/build-module/dom/is-element.js +5 -8
  128. package/build-module/dom/is-element.js.map +7 -1
  129. package/build-module/dom/is-empty.js +10 -14
  130. package/build-module/dom/is-empty.js.map +7 -1
  131. package/build-module/dom/is-entirely-selected.js +18 -45
  132. package/build-module/dom/is-entirely-selected.js.map +7 -1
  133. package/build-module/dom/is-form-element.js +8 -19
  134. package/build-module/dom/is-form-element.js.map +7 -1
  135. package/build-module/dom/is-horizontal-edge.js +6 -15
  136. package/build-module/dom/is-horizontal-edge.js.map +7 -1
  137. package/build-module/dom/is-html-input-element.js +6 -9
  138. package/build-module/dom/is-html-input-element.js.map +7 -1
  139. package/build-module/dom/is-input-or-text-area.js +6 -9
  140. package/build-module/dom/is-input-or-text-area.js.map +7 -1
  141. package/build-module/dom/is-number-input.js +11 -25
  142. package/build-module/dom/is-number-input.js.map +7 -1
  143. package/build-module/dom/is-rtl.js +7 -15
  144. package/build-module/dom/is-rtl.js.map +7 -1
  145. package/build-module/dom/is-selection-forward.js +9 -37
  146. package/build-module/dom/is-selection-forward.js.map +7 -1
  147. package/build-module/dom/is-text-field.js +22 -20
  148. package/build-module/dom/is-text-field.js.map +7 -1
  149. package/build-module/dom/is-vertical-edge.js +6 -15
  150. package/build-module/dom/is-vertical-edge.js.map +7 -1
  151. package/build-module/dom/place-caret-at-edge.js +22 -48
  152. package/build-module/dom/place-caret-at-edge.js.map +7 -1
  153. package/build-module/dom/place-caret-at-horizontal-edge.js +7 -14
  154. package/build-module/dom/place-caret-at-horizontal-edge.js.map +7 -1
  155. package/build-module/dom/place-caret-at-vertical-edge.js +6 -14
  156. package/build-module/dom/place-caret-at-vertical-edge.js.map +7 -1
  157. package/build-module/dom/remove-invalid-html.js +7 -17
  158. package/build-module/dom/remove-invalid-html.js.map +7 -1
  159. package/build-module/dom/remove.js +7 -14
  160. package/build-module/dom/remove.js.map +7 -1
  161. package/build-module/dom/replace-tag.js +7 -16
  162. package/build-module/dom/replace-tag.js.map +7 -1
  163. package/build-module/dom/replace.js +9 -17
  164. package/build-module/dom/replace.js.map +7 -1
  165. package/build-module/dom/safe-html.js +11 -23
  166. package/build-module/dom/safe-html.js.map +7 -1
  167. package/build-module/dom/scroll-if-no-range.js +5 -15
  168. package/build-module/dom/scroll-if-no-range.js.map +7 -1
  169. package/build-module/dom/strip-html.js +8 -18
  170. package/build-module/dom/strip-html.js.map +7 -1
  171. package/build-module/dom/unwrap.js +7 -15
  172. package/build-module/dom/unwrap.js.map +7 -1
  173. package/build-module/dom/wrap.js +7 -14
  174. package/build-module/dom/wrap.js.map +7 -1
  175. package/build-module/focusable.js +30 -81
  176. package/build-module/focusable.js.map +7 -1
  177. package/build-module/index.js +9 -17
  178. package/build-module/index.js.map +7 -1
  179. package/build-module/phrasing-content.js +67 -125
  180. package/build-module/phrasing-content.js.map +7 -1
  181. package/build-module/tabbable.js +30 -133
  182. package/build-module/tabbable.js.map +7 -1
  183. package/build-module/utils/assert-is-defined.js +9 -4
  184. package/build-module/utils/assert-is-defined.js.map +7 -1
  185. package/package.json +11 -4
@@ -1,49 +1,21 @@
1
- /**
2
- * Internal dependencies
3
- */
4
- import { assertIsDefined } from '../utils/assert-is-defined';
5
-
6
- /**
7
- * Returns true if the given selection object is in the forward direction, or
8
- * false otherwise.
9
- *
10
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition
11
- *
12
- * @param {Selection} selection Selection object to check.
13
- *
14
- * @return {boolean} Whether the selection is forward.
15
- */
16
- export default function isSelectionForward(selection) {
17
- const {
18
- anchorNode,
19
- focusNode,
20
- anchorOffset,
21
- focusOffset
22
- } = selection;
23
- assertIsDefined(anchorNode, 'anchorNode');
24
- assertIsDefined(focusNode, 'focusNode');
1
+ import { assertIsDefined } from "../utils/assert-is-defined";
2
+ function isSelectionForward(selection) {
3
+ const { anchorNode, focusNode, anchorOffset, focusOffset } = selection;
4
+ assertIsDefined(anchorNode, "anchorNode");
5
+ assertIsDefined(focusNode, "focusNode");
25
6
  const position = anchorNode.compareDocumentPosition(focusNode);
26
-
27
- // Disable reason: `Node#compareDocumentPosition` returns a bitmask value,
28
- // so bitwise operators are intended.
29
- /* eslint-disable no-bitwise */
30
- // Compare whether anchor node precedes focus node. If focus node (where
31
- // end of selection occurs) is after the anchor node, it is forward.
32
7
  if (position & anchorNode.DOCUMENT_POSITION_PRECEDING) {
33
8
  return false;
34
9
  }
35
10
  if (position & anchorNode.DOCUMENT_POSITION_FOLLOWING) {
36
11
  return true;
37
12
  }
38
- /* eslint-enable no-bitwise */
39
-
40
- // `compareDocumentPosition` returns 0 when passed the same node, in which
41
- // case compare offsets.
42
13
  if (position === 0) {
43
14
  return anchorOffset <= focusOffset;
44
15
  }
45
-
46
- // This should never be reached, but return true as default case.
47
16
  return true;
48
17
  }
49
- //# sourceMappingURL=is-selection-forward.js.map
18
+ export {
19
+ isSelectionForward as default
20
+ };
21
+ //# sourceMappingURL=is-selection-forward.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["assertIsDefined","isSelectionForward","selection","anchorNode","focusNode","anchorOffset","focusOffset","position","compareDocumentPosition","DOCUMENT_POSITION_PRECEDING","DOCUMENT_POSITION_FOLLOWING"],"sources":["@wordpress/dom/src/dom/is-selection-forward.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Returns true if the given selection object is in the forward direction, or\n * false otherwise.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition\n *\n * @param {Selection} selection Selection object to check.\n *\n * @return {boolean} Whether the selection is forward.\n */\nexport default function isSelectionForward( selection ) {\n\tconst { anchorNode, focusNode, anchorOffset, focusOffset } = selection;\n\n\tassertIsDefined( anchorNode, 'anchorNode' );\n\tassertIsDefined( focusNode, 'focusNode' );\n\tconst position = anchorNode.compareDocumentPosition( focusNode );\n\n\t// Disable reason: `Node#compareDocumentPosition` returns a bitmask value,\n\t// so bitwise operators are intended.\n\t/* eslint-disable no-bitwise */\n\t// Compare whether anchor node precedes focus node. If focus node (where\n\t// end of selection occurs) is after the anchor node, it is forward.\n\tif ( position & anchorNode.DOCUMENT_POSITION_PRECEDING ) {\n\t\treturn false;\n\t}\n\n\tif ( position & anchorNode.DOCUMENT_POSITION_FOLLOWING ) {\n\t\treturn true;\n\t}\n\t/* eslint-enable no-bitwise */\n\n\t// `compareDocumentPosition` returns 0 when passed the same node, in which\n\t// case compare offsets.\n\tif ( position === 0 ) {\n\t\treturn anchorOffset <= focusOffset;\n\t}\n\n\t// This should never be reached, but return true as default case.\n\treturn true;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,4BAA4B;;AAE5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,kBAAkBA,CAAEC,SAAS,EAAG;EACvD,MAAM;IAAEC,UAAU;IAAEC,SAAS;IAAEC,YAAY;IAAEC;EAAY,CAAC,GAAGJ,SAAS;EAEtEF,eAAe,CAAEG,UAAU,EAAE,YAAa,CAAC;EAC3CH,eAAe,CAAEI,SAAS,EAAE,WAAY,CAAC;EACzC,MAAMG,QAAQ,GAAGJ,UAAU,CAACK,uBAAuB,CAAEJ,SAAU,CAAC;;EAEhE;EACA;EACA;EACA;EACA;EACA,IAAKG,QAAQ,GAAGJ,UAAU,CAACM,2BAA2B,EAAG;IACxD,OAAO,KAAK;EACb;EAEA,IAAKF,QAAQ,GAAGJ,UAAU,CAACO,2BAA2B,EAAG;IACxD,OAAO,IAAI;EACZ;EACA;;EAEA;EACA;EACA,IAAKH,QAAQ,KAAK,CAAC,EAAG;IACrB,OAAOF,YAAY,IAAIC,WAAW;EACnC;;EAEA;EACA,OAAO,IAAI;AACZ","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/dom/is-selection-forward.js"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Returns true if the given selection object is in the forward direction, or\n * false otherwise.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition\n *\n * @param {Selection} selection Selection object to check.\n *\n * @return {boolean} Whether the selection is forward.\n */\nexport default function isSelectionForward( selection ) {\n\tconst { anchorNode, focusNode, anchorOffset, focusOffset } = selection;\n\n\tassertIsDefined( anchorNode, 'anchorNode' );\n\tassertIsDefined( focusNode, 'focusNode' );\n\tconst position = anchorNode.compareDocumentPosition( focusNode );\n\n\t// Disable reason: `Node#compareDocumentPosition` returns a bitmask value,\n\t// so bitwise operators are intended.\n\t/* eslint-disable no-bitwise */\n\t// Compare whether anchor node precedes focus node. If focus node (where\n\t// end of selection occurs) is after the anchor node, it is forward.\n\tif ( position & anchorNode.DOCUMENT_POSITION_PRECEDING ) {\n\t\treturn false;\n\t}\n\n\tif ( position & anchorNode.DOCUMENT_POSITION_FOLLOWING ) {\n\t\treturn true;\n\t}\n\t/* eslint-enable no-bitwise */\n\n\t// `compareDocumentPosition` returns 0 when passed the same node, in which\n\t// case compare offsets.\n\tif ( position === 0 ) {\n\t\treturn anchorOffset <= focusOffset;\n\t}\n\n\t// This should never be reached, but return true as default case.\n\treturn true;\n}\n"],
5
+ "mappings": "AAGA,SAAS,uBAAuB;AAYjB,SAAR,mBAAqC,WAAY;AACvD,QAAM,EAAE,YAAY,WAAW,cAAc,YAAY,IAAI;AAE7D,kBAAiB,YAAY,YAAa;AAC1C,kBAAiB,WAAW,WAAY;AACxC,QAAM,WAAW,WAAW,wBAAyB,SAAU;AAO/D,MAAK,WAAW,WAAW,6BAA8B;AACxD,WAAO;AAAA,EACR;AAEA,MAAK,WAAW,WAAW,6BAA8B;AACxD,WAAO;AAAA,EACR;AAKA,MAAK,aAAa,GAAI;AACrB,WAAO,gBAAgB;AAAA,EACxB;AAGA,SAAO;AACR;",
6
+ "names": []
7
+ }
@@ -1,21 +1,23 @@
1
- /**
2
- * Internal dependencies
3
- */
4
- import isHTMLInputElement from './is-html-input-element';
5
-
6
- /* eslint-disable jsdoc/valid-types */
7
- /**
8
- * Check whether the given element is a text field, where text field is defined
9
- * by the ability to select within the input, or that it is contenteditable.
10
- *
11
- * See: https://html.spec.whatwg.org/#textFieldSelection
12
- *
13
- * @param {Node} node The HTML element.
14
- * @return {node is HTMLElement} True if the element is an text field, false if not.
15
- */
16
- export default function isTextField(node) {
17
- /* eslint-enable jsdoc/valid-types */
18
- const nonTextInputs = ['button', 'checkbox', 'hidden', 'file', 'radio', 'image', 'range', 'reset', 'submit', 'number', 'email', 'time'];
19
- return isHTMLInputElement(node) && node.type && !nonTextInputs.includes(node.type) || node.nodeName === 'TEXTAREA' || /** @type {HTMLElement} */node.contentEditable === 'true';
1
+ import isHTMLInputElement from "./is-html-input-element";
2
+ function isTextField(node) {
3
+ const nonTextInputs = [
4
+ "button",
5
+ "checkbox",
6
+ "hidden",
7
+ "file",
8
+ "radio",
9
+ "image",
10
+ "range",
11
+ "reset",
12
+ "submit",
13
+ "number",
14
+ "email",
15
+ "time"
16
+ ];
17
+ return isHTMLInputElement(node) && node.type && !nonTextInputs.includes(node.type) || node.nodeName === "TEXTAREA" || /** @type {HTMLElement} */
18
+ node.contentEditable === "true";
20
19
  }
21
- //# sourceMappingURL=is-text-field.js.map
20
+ export {
21
+ isTextField as default
22
+ };
23
+ //# sourceMappingURL=is-text-field.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["isHTMLInputElement","isTextField","node","nonTextInputs","type","includes","nodeName","contentEditable"],"sources":["@wordpress/dom/src/dom/is-text-field.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport isHTMLInputElement from './is-html-input-element';\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * Check whether the given element is a text field, where text field is defined\n * by the ability to select within the input, or that it is contenteditable.\n *\n * See: https://html.spec.whatwg.org/#textFieldSelection\n *\n * @param {Node} node The HTML element.\n * @return {node is HTMLElement} True if the element is an text field, false if not.\n */\nexport default function isTextField( node ) {\n\t/* eslint-enable jsdoc/valid-types */\n\tconst nonTextInputs = [\n\t\t'button',\n\t\t'checkbox',\n\t\t'hidden',\n\t\t'file',\n\t\t'radio',\n\t\t'image',\n\t\t'range',\n\t\t'reset',\n\t\t'submit',\n\t\t'number',\n\t\t'email',\n\t\t'time',\n\t];\n\treturn (\n\t\t( isHTMLInputElement( node ) &&\n\t\t\tnode.type &&\n\t\t\t! nonTextInputs.includes( node.type ) ) ||\n\t\tnode.nodeName === 'TEXTAREA' ||\n\t\t/** @type {HTMLElement} */ ( node ).contentEditable === 'true'\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,kBAAkB,MAAM,yBAAyB;;AAExD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,WAAWA,CAAEC,IAAI,EAAG;EAC3C;EACA,MAAMC,aAAa,GAAG,CACrB,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,MAAM,EACN,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,MAAM,CACN;EACD,OACGH,kBAAkB,CAAEE,IAAK,CAAC,IAC3BA,IAAI,CAACE,IAAI,IACT,CAAED,aAAa,CAACE,QAAQ,CAAEH,IAAI,CAACE,IAAK,CAAC,IACtCF,IAAI,CAACI,QAAQ,KAAK,UAAU,IAC5B,0BAA6BJ,IAAI,CAAGK,eAAe,KAAK,MAAM;AAEhE","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/dom/is-text-field.js"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport isHTMLInputElement from './is-html-input-element';\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * Check whether the given element is a text field, where text field is defined\n * by the ability to select within the input, or that it is contenteditable.\n *\n * See: https://html.spec.whatwg.org/#textFieldSelection\n *\n * @param {Node} node The HTML element.\n * @return {node is HTMLElement} True if the element is an text field, false if not.\n */\nexport default function isTextField( node ) {\n\t/* eslint-enable jsdoc/valid-types */\n\tconst nonTextInputs = [\n\t\t'button',\n\t\t'checkbox',\n\t\t'hidden',\n\t\t'file',\n\t\t'radio',\n\t\t'image',\n\t\t'range',\n\t\t'reset',\n\t\t'submit',\n\t\t'number',\n\t\t'email',\n\t\t'time',\n\t];\n\treturn (\n\t\t( isHTMLInputElement( node ) &&\n\t\t\tnode.type &&\n\t\t\t! nonTextInputs.includes( node.type ) ) ||\n\t\tnode.nodeName === 'TEXTAREA' ||\n\t\t/** @type {HTMLElement} */ ( node ).contentEditable === 'true'\n\t);\n}\n"],
5
+ "mappings": "AAGA,OAAO,wBAAwB;AAYhB,SAAR,YAA8B,MAAO;AAE3C,QAAM,gBAAgB;AAAA,IACrB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACA,SACG,mBAAoB,IAAK,KAC1B,KAAK,QACL,CAAE,cAAc,SAAU,KAAK,IAAK,KACrC,KAAK,aAAa;AAAA,EACW,KAAO,oBAAoB;AAE1D;",
6
+ "names": []
7
+ }
@@ -1,17 +1,8 @@
1
- /**
2
- * Internal dependencies
3
- */
4
- import isEdge from './is-edge';
5
-
6
- /**
7
- * Check whether the selection is vertically at the edge of the container.
8
- *
9
- * @param {HTMLElement} container Focusable element.
10
- * @param {boolean} isReverse Set to true to check top, false for bottom.
11
- *
12
- * @return {boolean} True if at the vertical edge, false if not.
13
- */
14
- export default function isVerticalEdge(container, isReverse) {
1
+ import isEdge from "./is-edge";
2
+ function isVerticalEdge(container, isReverse) {
15
3
  return isEdge(container, isReverse, true);
16
4
  }
17
- //# sourceMappingURL=is-vertical-edge.js.map
5
+ export {
6
+ isVerticalEdge as default
7
+ };
8
+ //# sourceMappingURL=is-vertical-edge.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["isEdge","isVerticalEdge","container","isReverse"],"sources":["@wordpress/dom/src/dom/is-vertical-edge.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport isEdge from './is-edge';\n\n/**\n * Check whether the selection is vertically at the edge of the container.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse Set to true to check top, false for bottom.\n *\n * @return {boolean} True if at the vertical edge, false if not.\n */\nexport default function isVerticalEdge( container, isReverse ) {\n\treturn isEdge( container, isReverse, true );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,MAAM,MAAM,WAAW;;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,cAAcA,CAAEC,SAAS,EAAEC,SAAS,EAAG;EAC9D,OAAOH,MAAM,CAAEE,SAAS,EAAEC,SAAS,EAAE,IAAK,CAAC;AAC5C","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/dom/is-vertical-edge.js"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport isEdge from './is-edge';\n\n/**\n * Check whether the selection is vertically at the edge of the container.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse Set to true to check top, false for bottom.\n *\n * @return {boolean} True if at the vertical edge, false if not.\n */\nexport default function isVerticalEdge( container, isReverse ) {\n\treturn isEdge( container, isReverse, true );\n}\n"],
5
+ "mappings": "AAGA,OAAO,YAAY;AAUJ,SAAR,eAAiC,WAAW,WAAY;AAC9D,SAAO,OAAQ,WAAW,WAAW,IAAK;AAC3C;",
6
+ "names": []
7
+ }
@@ -1,33 +1,13 @@
1
- /**
2
- * Internal dependencies
3
- */
4
- import hiddenCaretRangeFromPoint from './hidden-caret-range-from-point';
5
- import { assertIsDefined } from '../utils/assert-is-defined';
6
- import isInputOrTextArea from './is-input-or-text-area';
7
- import isRTL from './is-rtl';
8
- import { scrollIfNoRange } from './scroll-if-no-range';
9
-
10
- /**
11
- * Gets the range to place.
12
- *
13
- * @param {HTMLElement} container Focusable element.
14
- * @param {boolean} isReverse True for end, false for start.
15
- * @param {number|undefined} x X coordinate to vertically position.
16
- *
17
- * @return {Range|null} The range to place.
18
- */
1
+ import hiddenCaretRangeFromPoint from "./hidden-caret-range-from-point";
2
+ import { assertIsDefined } from "../utils/assert-is-defined";
3
+ import isInputOrTextArea from "./is-input-or-text-area";
4
+ import isRTL from "./is-rtl";
5
+ import { scrollIfNoRange } from "./scroll-if-no-range";
19
6
  function getRange(container, isReverse, x) {
20
- const {
21
- ownerDocument
22
- } = container;
23
- // In the case of RTL scripts, the horizontal edge is at the opposite side.
7
+ const { ownerDocument } = container;
24
8
  const isReverseDir = isRTL(container) ? !isReverse : isReverse;
25
9
  const containerRect = container.getBoundingClientRect();
26
- // When placing at the end (isReverse), find the closest range to the bottom
27
- // right corner. When placing at the start, to the top left corner.
28
- // Ensure x is defined and within the container's boundaries. When it's
29
- // exactly at the boundary, it's not considered within the boundaries.
30
- if (x === undefined) {
10
+ if (x === void 0) {
31
11
  x = isReverse ? containerRect.right - 1 : containerRect.left + 1;
32
12
  } else if (x <= containerRect.left) {
33
13
  x = containerRect.left + 1;
@@ -37,22 +17,13 @@ function getRange(container, isReverse, x) {
37
17
  const y = isReverseDir ? containerRect.bottom - 1 : containerRect.top + 1;
38
18
  return hiddenCaretRangeFromPoint(ownerDocument, x, y, container);
39
19
  }
40
-
41
- /**
42
- * Places the caret at start or end of a given element.
43
- *
44
- * @param {HTMLElement} container Focusable element.
45
- * @param {boolean} isReverse True for end, false for start.
46
- * @param {number|undefined} x X coordinate to vertically position.
47
- */
48
- export default function placeCaretAtEdge(container, isReverse, x) {
20
+ function placeCaretAtEdge(container, isReverse, x) {
49
21
  if (!container) {
50
22
  return;
51
23
  }
52
24
  container.focus();
53
25
  if (isInputOrTextArea(container)) {
54
- // The element may not support selection setting.
55
- if (typeof container.selectionStart !== 'number') {
26
+ if (typeof container.selectionStart !== "number") {
56
27
  return;
57
28
  }
58
29
  if (isReverse) {
@@ -67,20 +38,23 @@ export default function placeCaretAtEdge(container, isReverse, x) {
67
38
  if (!container.isContentEditable) {
68
39
  return;
69
40
  }
70
- const range = scrollIfNoRange(container, isReverse, () => getRange(container, isReverse, x));
41
+ const range = scrollIfNoRange(
42
+ container,
43
+ isReverse,
44
+ () => getRange(container, isReverse, x)
45
+ );
71
46
  if (!range) {
72
47
  return;
73
48
  }
74
- const {
75
- ownerDocument
76
- } = container;
77
- const {
78
- defaultView
79
- } = ownerDocument;
80
- assertIsDefined(defaultView, 'defaultView');
49
+ const { ownerDocument } = container;
50
+ const { defaultView } = ownerDocument;
51
+ assertIsDefined(defaultView, "defaultView");
81
52
  const selection = defaultView.getSelection();
82
- assertIsDefined(selection, 'selection');
53
+ assertIsDefined(selection, "selection");
83
54
  selection.removeAllRanges();
84
55
  selection.addRange(range);
85
56
  }
86
- //# sourceMappingURL=place-caret-at-edge.js.map
57
+ export {
58
+ placeCaretAtEdge as default
59
+ };
60
+ //# sourceMappingURL=place-caret-at-edge.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["hiddenCaretRangeFromPoint","assertIsDefined","isInputOrTextArea","isRTL","scrollIfNoRange","getRange","container","isReverse","x","ownerDocument","isReverseDir","containerRect","getBoundingClientRect","undefined","right","left","y","bottom","top","placeCaretAtEdge","focus","selectionStart","value","length","selectionEnd","isContentEditable","range","defaultView","selection","getSelection","removeAllRanges","addRange"],"sources":["@wordpress/dom/src/dom/place-caret-at-edge.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport hiddenCaretRangeFromPoint from './hidden-caret-range-from-point';\nimport { assertIsDefined } from '../utils/assert-is-defined';\nimport isInputOrTextArea from './is-input-or-text-area';\nimport isRTL from './is-rtl';\nimport { scrollIfNoRange } from './scroll-if-no-range';\n\n/**\n * Gets the range to place.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse True for end, false for start.\n * @param {number|undefined} x X coordinate to vertically position.\n *\n * @return {Range|null} The range to place.\n */\nfunction getRange( container, isReverse, x ) {\n\tconst { ownerDocument } = container;\n\t// In the case of RTL scripts, the horizontal edge is at the opposite side.\n\tconst isReverseDir = isRTL( container ) ? ! isReverse : isReverse;\n\tconst containerRect = container.getBoundingClientRect();\n\t// When placing at the end (isReverse), find the closest range to the bottom\n\t// right corner. When placing at the start, to the top left corner.\n\t// Ensure x is defined and within the container's boundaries. When it's\n\t// exactly at the boundary, it's not considered within the boundaries.\n\tif ( x === undefined ) {\n\t\tx = isReverse ? containerRect.right - 1 : containerRect.left + 1;\n\t} else if ( x <= containerRect.left ) {\n\t\tx = containerRect.left + 1;\n\t} else if ( x >= containerRect.right ) {\n\t\tx = containerRect.right - 1;\n\t}\n\tconst y = isReverseDir ? containerRect.bottom - 1 : containerRect.top + 1;\n\treturn hiddenCaretRangeFromPoint( ownerDocument, x, y, container );\n}\n\n/**\n * Places the caret at start or end of a given element.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse True for end, false for start.\n * @param {number|undefined} x X coordinate to vertically position.\n */\nexport default function placeCaretAtEdge( container, isReverse, x ) {\n\tif ( ! container ) {\n\t\treturn;\n\t}\n\n\tcontainer.focus();\n\n\tif ( isInputOrTextArea( container ) ) {\n\t\t// The element may not support selection setting.\n\t\tif ( typeof container.selectionStart !== 'number' ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isReverse ) {\n\t\t\tcontainer.selectionStart = container.value.length;\n\t\t\tcontainer.selectionEnd = container.value.length;\n\t\t} else {\n\t\t\tcontainer.selectionStart = 0;\n\t\t\tcontainer.selectionEnd = 0;\n\t\t}\n\n\t\treturn;\n\t}\n\n\tif ( ! container.isContentEditable ) {\n\t\treturn;\n\t}\n\n\tconst range = scrollIfNoRange( container, isReverse, () =>\n\t\tgetRange( container, isReverse, x )\n\t);\n\n\tif ( ! range ) {\n\t\treturn;\n\t}\n\n\tconst { ownerDocument } = container;\n\tconst { defaultView } = ownerDocument;\n\tassertIsDefined( defaultView, 'defaultView' );\n\tconst selection = defaultView.getSelection();\n\tassertIsDefined( selection, 'selection' );\n\tselection.removeAllRanges();\n\tselection.addRange( range );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,yBAAyB,MAAM,iCAAiC;AACvE,SAASC,eAAe,QAAQ,4BAA4B;AAC5D,OAAOC,iBAAiB,MAAM,yBAAyB;AACvD,OAAOC,KAAK,MAAM,UAAU;AAC5B,SAASC,eAAe,QAAQ,sBAAsB;;AAEtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,QAAQA,CAAEC,SAAS,EAAEC,SAAS,EAAEC,CAAC,EAAG;EAC5C,MAAM;IAAEC;EAAc,CAAC,GAAGH,SAAS;EACnC;EACA,MAAMI,YAAY,GAAGP,KAAK,CAAEG,SAAU,CAAC,GAAG,CAAEC,SAAS,GAAGA,SAAS;EACjE,MAAMI,aAAa,GAAGL,SAAS,CAACM,qBAAqB,CAAC,CAAC;EACvD;EACA;EACA;EACA;EACA,IAAKJ,CAAC,KAAKK,SAAS,EAAG;IACtBL,CAAC,GAAGD,SAAS,GAAGI,aAAa,CAACG,KAAK,GAAG,CAAC,GAAGH,aAAa,CAACI,IAAI,GAAG,CAAC;EACjE,CAAC,MAAM,IAAKP,CAAC,IAAIG,aAAa,CAACI,IAAI,EAAG;IACrCP,CAAC,GAAGG,aAAa,CAACI,IAAI,GAAG,CAAC;EAC3B,CAAC,MAAM,IAAKP,CAAC,IAAIG,aAAa,CAACG,KAAK,EAAG;IACtCN,CAAC,GAAGG,aAAa,CAACG,KAAK,GAAG,CAAC;EAC5B;EACA,MAAME,CAAC,GAAGN,YAAY,GAAGC,aAAa,CAACM,MAAM,GAAG,CAAC,GAAGN,aAAa,CAACO,GAAG,GAAG,CAAC;EACzE,OAAOlB,yBAAyB,CAAES,aAAa,EAAED,CAAC,EAAEQ,CAAC,EAAEV,SAAU,CAAC;AACnE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASa,gBAAgBA,CAAEb,SAAS,EAAEC,SAAS,EAAEC,CAAC,EAAG;EACnE,IAAK,CAAEF,SAAS,EAAG;IAClB;EACD;EAEAA,SAAS,CAACc,KAAK,CAAC,CAAC;EAEjB,IAAKlB,iBAAiB,CAAEI,SAAU,CAAC,EAAG;IACrC;IACA,IAAK,OAAOA,SAAS,CAACe,cAAc,KAAK,QAAQ,EAAG;MACnD;IACD;IAEA,IAAKd,SAAS,EAAG;MAChBD,SAAS,CAACe,cAAc,GAAGf,SAAS,CAACgB,KAAK,CAACC,MAAM;MACjDjB,SAAS,CAACkB,YAAY,GAAGlB,SAAS,CAACgB,KAAK,CAACC,MAAM;IAChD,CAAC,MAAM;MACNjB,SAAS,CAACe,cAAc,GAAG,CAAC;MAC5Bf,SAAS,CAACkB,YAAY,GAAG,CAAC;IAC3B;IAEA;EACD;EAEA,IAAK,CAAElB,SAAS,CAACmB,iBAAiB,EAAG;IACpC;EACD;EAEA,MAAMC,KAAK,GAAGtB,eAAe,CAAEE,SAAS,EAAEC,SAAS,EAAE,MACpDF,QAAQ,CAAEC,SAAS,EAAEC,SAAS,EAAEC,CAAE,CACnC,CAAC;EAED,IAAK,CAAEkB,KAAK,EAAG;IACd;EACD;EAEA,MAAM;IAAEjB;EAAc,CAAC,GAAGH,SAAS;EACnC,MAAM;IAAEqB;EAAY,CAAC,GAAGlB,aAAa;EACrCR,eAAe,CAAE0B,WAAW,EAAE,aAAc,CAAC;EAC7C,MAAMC,SAAS,GAAGD,WAAW,CAACE,YAAY,CAAC,CAAC;EAC5C5B,eAAe,CAAE2B,SAAS,EAAE,WAAY,CAAC;EACzCA,SAAS,CAACE,eAAe,CAAC,CAAC;EAC3BF,SAAS,CAACG,QAAQ,CAAEL,KAAM,CAAC;AAC5B","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/dom/place-caret-at-edge.js"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport hiddenCaretRangeFromPoint from './hidden-caret-range-from-point';\nimport { assertIsDefined } from '../utils/assert-is-defined';\nimport isInputOrTextArea from './is-input-or-text-area';\nimport isRTL from './is-rtl';\nimport { scrollIfNoRange } from './scroll-if-no-range';\n\n/**\n * Gets the range to place.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse True for end, false for start.\n * @param {number|undefined} x X coordinate to vertically position.\n *\n * @return {Range|null} The range to place.\n */\nfunction getRange( container, isReverse, x ) {\n\tconst { ownerDocument } = container;\n\t// In the case of RTL scripts, the horizontal edge is at the opposite side.\n\tconst isReverseDir = isRTL( container ) ? ! isReverse : isReverse;\n\tconst containerRect = container.getBoundingClientRect();\n\t// When placing at the end (isReverse), find the closest range to the bottom\n\t// right corner. When placing at the start, to the top left corner.\n\t// Ensure x is defined and within the container's boundaries. When it's\n\t// exactly at the boundary, it's not considered within the boundaries.\n\tif ( x === undefined ) {\n\t\tx = isReverse ? containerRect.right - 1 : containerRect.left + 1;\n\t} else if ( x <= containerRect.left ) {\n\t\tx = containerRect.left + 1;\n\t} else if ( x >= containerRect.right ) {\n\t\tx = containerRect.right - 1;\n\t}\n\tconst y = isReverseDir ? containerRect.bottom - 1 : containerRect.top + 1;\n\treturn hiddenCaretRangeFromPoint( ownerDocument, x, y, container );\n}\n\n/**\n * Places the caret at start or end of a given element.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse True for end, false for start.\n * @param {number|undefined} x X coordinate to vertically position.\n */\nexport default function placeCaretAtEdge( container, isReverse, x ) {\n\tif ( ! container ) {\n\t\treturn;\n\t}\n\n\tcontainer.focus();\n\n\tif ( isInputOrTextArea( container ) ) {\n\t\t// The element may not support selection setting.\n\t\tif ( typeof container.selectionStart !== 'number' ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isReverse ) {\n\t\t\tcontainer.selectionStart = container.value.length;\n\t\t\tcontainer.selectionEnd = container.value.length;\n\t\t} else {\n\t\t\tcontainer.selectionStart = 0;\n\t\t\tcontainer.selectionEnd = 0;\n\t\t}\n\n\t\treturn;\n\t}\n\n\tif ( ! container.isContentEditable ) {\n\t\treturn;\n\t}\n\n\tconst range = scrollIfNoRange( container, isReverse, () =>\n\t\tgetRange( container, isReverse, x )\n\t);\n\n\tif ( ! range ) {\n\t\treturn;\n\t}\n\n\tconst { ownerDocument } = container;\n\tconst { defaultView } = ownerDocument;\n\tassertIsDefined( defaultView, 'defaultView' );\n\tconst selection = defaultView.getSelection();\n\tassertIsDefined( selection, 'selection' );\n\tselection.removeAllRanges();\n\tselection.addRange( range );\n}\n"],
5
+ "mappings": "AAGA,OAAO,+BAA+B;AACtC,SAAS,uBAAuB;AAChC,OAAO,uBAAuB;AAC9B,OAAO,WAAW;AAClB,SAAS,uBAAuB;AAWhC,SAAS,SAAU,WAAW,WAAW,GAAI;AAC5C,QAAM,EAAE,cAAc,IAAI;AAE1B,QAAM,eAAe,MAAO,SAAU,IAAI,CAAE,YAAY;AACxD,QAAM,gBAAgB,UAAU,sBAAsB;AAKtD,MAAK,MAAM,QAAY;AACtB,QAAI,YAAY,cAAc,QAAQ,IAAI,cAAc,OAAO;AAAA,EAChE,WAAY,KAAK,cAAc,MAAO;AACrC,QAAI,cAAc,OAAO;AAAA,EAC1B,WAAY,KAAK,cAAc,OAAQ;AACtC,QAAI,cAAc,QAAQ;AAAA,EAC3B;AACA,QAAM,IAAI,eAAe,cAAc,SAAS,IAAI,cAAc,MAAM;AACxE,SAAO,0BAA2B,eAAe,GAAG,GAAG,SAAU;AAClE;AASe,SAAR,iBAAmC,WAAW,WAAW,GAAI;AACnE,MAAK,CAAE,WAAY;AAClB;AAAA,EACD;AAEA,YAAU,MAAM;AAEhB,MAAK,kBAAmB,SAAU,GAAI;AAErC,QAAK,OAAO,UAAU,mBAAmB,UAAW;AACnD;AAAA,IACD;AAEA,QAAK,WAAY;AAChB,gBAAU,iBAAiB,UAAU,MAAM;AAC3C,gBAAU,eAAe,UAAU,MAAM;AAAA,IAC1C,OAAO;AACN,gBAAU,iBAAiB;AAC3B,gBAAU,eAAe;AAAA,IAC1B;AAEA;AAAA,EACD;AAEA,MAAK,CAAE,UAAU,mBAAoB;AACpC;AAAA,EACD;AAEA,QAAM,QAAQ;AAAA,IAAiB;AAAA,IAAW;AAAA,IAAW,MACpD,SAAU,WAAW,WAAW,CAAE;AAAA,EACnC;AAEA,MAAK,CAAE,OAAQ;AACd;AAAA,EACD;AAEA,QAAM,EAAE,cAAc,IAAI;AAC1B,QAAM,EAAE,YAAY,IAAI;AACxB,kBAAiB,aAAa,aAAc;AAC5C,QAAM,YAAY,YAAY,aAAa;AAC3C,kBAAiB,WAAW,WAAY;AACxC,YAAU,gBAAgB;AAC1B,YAAU,SAAU,KAAM;AAC3B;",
6
+ "names": []
7
+ }
@@ -1,15 +1,8 @@
1
- /**
2
- * Internal dependencies
3
- */
4
- import placeCaretAtEdge from './place-caret-at-edge';
5
-
6
- /**
7
- * Places the caret at start or end of a given element.
8
- *
9
- * @param {HTMLElement} container Focusable element.
10
- * @param {boolean} isReverse True for end, false for start.
11
- */
12
- export default function placeCaretAtHorizontalEdge(container, isReverse) {
13
- return placeCaretAtEdge(container, isReverse, undefined);
1
+ import placeCaretAtEdge from "./place-caret-at-edge";
2
+ function placeCaretAtHorizontalEdge(container, isReverse) {
3
+ return placeCaretAtEdge(container, isReverse, void 0);
14
4
  }
15
- //# sourceMappingURL=place-caret-at-horizontal-edge.js.map
5
+ export {
6
+ placeCaretAtHorizontalEdge as default
7
+ };
8
+ //# sourceMappingURL=place-caret-at-horizontal-edge.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["placeCaretAtEdge","placeCaretAtHorizontalEdge","container","isReverse","undefined"],"sources":["@wordpress/dom/src/dom/place-caret-at-horizontal-edge.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport placeCaretAtEdge from './place-caret-at-edge';\n\n/**\n * Places the caret at start or end of a given element.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse True for end, false for start.\n */\nexport default function placeCaretAtHorizontalEdge( container, isReverse ) {\n\treturn placeCaretAtEdge( container, isReverse, undefined );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,gBAAgB,MAAM,uBAAuB;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,0BAA0BA,CAAEC,SAAS,EAAEC,SAAS,EAAG;EAC1E,OAAOH,gBAAgB,CAAEE,SAAS,EAAEC,SAAS,EAAEC,SAAU,CAAC;AAC3D","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/dom/place-caret-at-horizontal-edge.js"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport placeCaretAtEdge from './place-caret-at-edge';\n\n/**\n * Places the caret at start or end of a given element.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse True for end, false for start.\n */\nexport default function placeCaretAtHorizontalEdge( container, isReverse ) {\n\treturn placeCaretAtEdge( container, isReverse, undefined );\n}\n"],
5
+ "mappings": "AAGA,OAAO,sBAAsB;AAQd,SAAR,2BAA6C,WAAW,WAAY;AAC1E,SAAO,iBAAkB,WAAW,WAAW,MAAU;AAC1D;",
6
+ "names": []
7
+ }
@@ -1,16 +1,8 @@
1
- /**
2
- * Internal dependencies
3
- */
4
- import placeCaretAtEdge from './place-caret-at-edge';
5
-
6
- /**
7
- * Places the caret at the top or bottom of a given element.
8
- *
9
- * @param {HTMLElement} container Focusable element.
10
- * @param {boolean} isReverse True for bottom, false for top.
11
- * @param {DOMRect} [rect] The rectangle to position the caret with.
12
- */
13
- export default function placeCaretAtVerticalEdge(container, isReverse, rect) {
1
+ import placeCaretAtEdge from "./place-caret-at-edge";
2
+ function placeCaretAtVerticalEdge(container, isReverse, rect) {
14
3
  return placeCaretAtEdge(container, isReverse, rect?.left);
15
4
  }
16
- //# sourceMappingURL=place-caret-at-vertical-edge.js.map
5
+ export {
6
+ placeCaretAtVerticalEdge as default
7
+ };
8
+ //# sourceMappingURL=place-caret-at-vertical-edge.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["placeCaretAtEdge","placeCaretAtVerticalEdge","container","isReverse","rect","left"],"sources":["@wordpress/dom/src/dom/place-caret-at-vertical-edge.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport placeCaretAtEdge from './place-caret-at-edge';\n\n/**\n * Places the caret at the top or bottom of a given element.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse True for bottom, false for top.\n * @param {DOMRect} [rect] The rectangle to position the caret with.\n */\nexport default function placeCaretAtVerticalEdge( container, isReverse, rect ) {\n\treturn placeCaretAtEdge( container, isReverse, rect?.left );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,gBAAgB,MAAM,uBAAuB;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,wBAAwBA,CAAEC,SAAS,EAAEC,SAAS,EAAEC,IAAI,EAAG;EAC9E,OAAOJ,gBAAgB,CAAEE,SAAS,EAAEC,SAAS,EAAEC,IAAI,EAAEC,IAAK,CAAC;AAC5D","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/dom/place-caret-at-vertical-edge.js"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport placeCaretAtEdge from './place-caret-at-edge';\n\n/**\n * Places the caret at the top or bottom of a given element.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse True for bottom, false for top.\n * @param {DOMRect} [rect] The rectangle to position the caret with.\n */\nexport default function placeCaretAtVerticalEdge( container, isReverse, rect ) {\n\treturn placeCaretAtEdge( container, isReverse, rect?.left );\n}\n"],
5
+ "mappings": "AAGA,OAAO,sBAAsB;AASd,SAAR,yBAA2C,WAAW,WAAW,MAAO;AAC9E,SAAO,iBAAkB,WAAW,WAAW,MAAM,IAAK;AAC3D;",
6
+ "names": []
7
+ }
@@ -1,21 +1,11 @@
1
- /**
2
- * Internal dependencies
3
- */
4
- import cleanNodeList from './clean-node-list';
5
-
6
- /**
7
- * Given a schema, unwraps or removes nodes, attributes and classes on HTML.
8
- *
9
- * @param {string} HTML The HTML to clean up.
10
- * @param {import('./clean-node-list').Schema} schema Schema for the HTML.
11
- * @param {boolean} inline Whether to clean for inline mode.
12
- *
13
- * @return {string} The cleaned up HTML.
14
- */
15
- export default function removeInvalidHTML(HTML, schema, inline) {
16
- const doc = document.implementation.createHTMLDocument('');
1
+ import cleanNodeList from "./clean-node-list";
2
+ function removeInvalidHTML(HTML, schema, inline) {
3
+ const doc = document.implementation.createHTMLDocument("");
17
4
  doc.body.innerHTML = HTML;
18
5
  cleanNodeList(doc.body.childNodes, doc, schema, inline);
19
6
  return doc.body.innerHTML;
20
7
  }
21
- //# sourceMappingURL=remove-invalid-html.js.map
8
+ export {
9
+ removeInvalidHTML as default
10
+ };
11
+ //# sourceMappingURL=remove-invalid-html.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["cleanNodeList","removeInvalidHTML","HTML","schema","inline","doc","document","implementation","createHTMLDocument","body","innerHTML","childNodes"],"sources":["@wordpress/dom/src/dom/remove-invalid-html.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport cleanNodeList from './clean-node-list';\n\n/**\n * Given a schema, unwraps or removes nodes, attributes and classes on HTML.\n *\n * @param {string} HTML The HTML to clean up.\n * @param {import('./clean-node-list').Schema} schema Schema for the HTML.\n * @param {boolean} inline Whether to clean for inline mode.\n *\n * @return {string} The cleaned up HTML.\n */\nexport default function removeInvalidHTML( HTML, schema, inline ) {\n\tconst doc = document.implementation.createHTMLDocument( '' );\n\n\tdoc.body.innerHTML = HTML;\n\n\tcleanNodeList( doc.body.childNodes, doc, schema, inline );\n\n\treturn doc.body.innerHTML;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,aAAa,MAAM,mBAAmB;;AAE7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,iBAAiBA,CAAEC,IAAI,EAAEC,MAAM,EAAEC,MAAM,EAAG;EACjE,MAAMC,GAAG,GAAGC,QAAQ,CAACC,cAAc,CAACC,kBAAkB,CAAE,EAAG,CAAC;EAE5DH,GAAG,CAACI,IAAI,CAACC,SAAS,GAAGR,IAAI;EAEzBF,aAAa,CAAEK,GAAG,CAACI,IAAI,CAACE,UAAU,EAAEN,GAAG,EAAEF,MAAM,EAAEC,MAAO,CAAC;EAEzD,OAAOC,GAAG,CAACI,IAAI,CAACC,SAAS;AAC1B","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/dom/remove-invalid-html.js"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport cleanNodeList from './clean-node-list';\n\n/**\n * Given a schema, unwraps or removes nodes, attributes and classes on HTML.\n *\n * @param {string} HTML The HTML to clean up.\n * @param {import('./clean-node-list').Schema} schema Schema for the HTML.\n * @param {boolean} inline Whether to clean for inline mode.\n *\n * @return {string} The cleaned up HTML.\n */\nexport default function removeInvalidHTML( HTML, schema, inline ) {\n\tconst doc = document.implementation.createHTMLDocument( '' );\n\n\tdoc.body.innerHTML = HTML;\n\n\tcleanNodeList( doc.body.childNodes, doc, schema, inline );\n\n\treturn doc.body.innerHTML;\n}\n"],
5
+ "mappings": "AAGA,OAAO,mBAAmB;AAWX,SAAR,kBAAoC,MAAM,QAAQ,QAAS;AACjE,QAAM,MAAM,SAAS,eAAe,mBAAoB,EAAG;AAE3D,MAAI,KAAK,YAAY;AAErB,gBAAe,IAAI,KAAK,YAAY,KAAK,QAAQ,MAAO;AAExD,SAAO,IAAI,KAAK;AACjB;",
6
+ "names": []
7
+ }
@@ -1,16 +1,9 @@
1
- /**
2
- * Internal dependencies
3
- */
4
- import { assertIsDefined } from '../utils/assert-is-defined';
5
-
6
- /**
7
- * Given a DOM node, removes it from the DOM.
8
- *
9
- * @param {Node} node Node to be removed.
10
- * @return {void}
11
- */
12
- export default function remove(node) {
13
- assertIsDefined(node.parentNode, 'node.parentNode');
1
+ import { assertIsDefined } from "../utils/assert-is-defined";
2
+ function remove(node) {
3
+ assertIsDefined(node.parentNode, "node.parentNode");
14
4
  node.parentNode.removeChild(node);
15
5
  }
16
- //# sourceMappingURL=remove.js.map
6
+ export {
7
+ remove as default
8
+ };
9
+ //# sourceMappingURL=remove.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["assertIsDefined","remove","node","parentNode","removeChild"],"sources":["@wordpress/dom/src/dom/remove.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Given a DOM node, removes it from the DOM.\n *\n * @param {Node} node Node to be removed.\n * @return {void}\n */\nexport default function remove( node ) {\n\tassertIsDefined( node.parentNode, 'node.parentNode' );\n\tnode.parentNode.removeChild( node );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,4BAA4B;;AAE5D;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,MAAMA,CAAEC,IAAI,EAAG;EACtCF,eAAe,CAAEE,IAAI,CAACC,UAAU,EAAE,iBAAkB,CAAC;EACrDD,IAAI,CAACC,UAAU,CAACC,WAAW,CAAEF,IAAK,CAAC;AACpC","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/dom/remove.js"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Given a DOM node, removes it from the DOM.\n *\n * @param {Node} node Node to be removed.\n * @return {void}\n */\nexport default function remove( node ) {\n\tassertIsDefined( node.parentNode, 'node.parentNode' );\n\tnode.parentNode.removeChild( node );\n}\n"],
5
+ "mappings": "AAGA,SAAS,uBAAuB;AAQjB,SAAR,OAAyB,MAAO;AACtC,kBAAiB,KAAK,YAAY,iBAAkB;AACpD,OAAK,WAAW,YAAa,IAAK;AACnC;",
6
+ "names": []
7
+ }
@@ -1,23 +1,14 @@
1
- /**
2
- * Internal dependencies
3
- */
4
- import { assertIsDefined } from '../utils/assert-is-defined';
5
-
6
- /**
7
- * Replaces the given node with a new node with the given tag name.
8
- *
9
- * @param {Element} node The node to replace
10
- * @param {string} tagName The new tag name.
11
- *
12
- * @return {Element} The new node.
13
- */
14
- export default function replaceTag(node, tagName) {
1
+ import { assertIsDefined } from "../utils/assert-is-defined";
2
+ function replaceTag(node, tagName) {
15
3
  const newNode = node.ownerDocument.createElement(tagName);
16
4
  while (node.firstChild) {
17
5
  newNode.appendChild(node.firstChild);
18
6
  }
19
- assertIsDefined(node.parentNode, 'node.parentNode');
7
+ assertIsDefined(node.parentNode, "node.parentNode");
20
8
  node.parentNode.replaceChild(newNode, node);
21
9
  return newNode;
22
10
  }
23
- //# sourceMappingURL=replace-tag.js.map
11
+ export {
12
+ replaceTag as default
13
+ };
14
+ //# sourceMappingURL=replace-tag.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["assertIsDefined","replaceTag","node","tagName","newNode","ownerDocument","createElement","firstChild","appendChild","parentNode","replaceChild"],"sources":["@wordpress/dom/src/dom/replace-tag.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Replaces the given node with a new node with the given tag name.\n *\n * @param {Element} node The node to replace\n * @param {string} tagName The new tag name.\n *\n * @return {Element} The new node.\n */\nexport default function replaceTag( node, tagName ) {\n\tconst newNode = node.ownerDocument.createElement( tagName );\n\n\twhile ( node.firstChild ) {\n\t\tnewNode.appendChild( node.firstChild );\n\t}\n\n\tassertIsDefined( node.parentNode, 'node.parentNode' );\n\tnode.parentNode.replaceChild( newNode, node );\n\n\treturn newNode;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,4BAA4B;;AAE5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,UAAUA,CAAEC,IAAI,EAAEC,OAAO,EAAG;EACnD,MAAMC,OAAO,GAAGF,IAAI,CAACG,aAAa,CAACC,aAAa,CAAEH,OAAQ,CAAC;EAE3D,OAAQD,IAAI,CAACK,UAAU,EAAG;IACzBH,OAAO,CAACI,WAAW,CAAEN,IAAI,CAACK,UAAW,CAAC;EACvC;EAEAP,eAAe,CAAEE,IAAI,CAACO,UAAU,EAAE,iBAAkB,CAAC;EACrDP,IAAI,CAACO,UAAU,CAACC,YAAY,CAAEN,OAAO,EAAEF,IAAK,CAAC;EAE7C,OAAOE,OAAO;AACf","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/dom/replace-tag.js"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Replaces the given node with a new node with the given tag name.\n *\n * @param {Element} node The node to replace\n * @param {string} tagName The new tag name.\n *\n * @return {Element} The new node.\n */\nexport default function replaceTag( node, tagName ) {\n\tconst newNode = node.ownerDocument.createElement( tagName );\n\n\twhile ( node.firstChild ) {\n\t\tnewNode.appendChild( node.firstChild );\n\t}\n\n\tassertIsDefined( node.parentNode, 'node.parentNode' );\n\tnode.parentNode.replaceChild( newNode, node );\n\n\treturn newNode;\n}\n"],
5
+ "mappings": "AAGA,SAAS,uBAAuB;AAUjB,SAAR,WAA6B,MAAM,SAAU;AACnD,QAAM,UAAU,KAAK,cAAc,cAAe,OAAQ;AAE1D,SAAQ,KAAK,YAAa;AACzB,YAAQ,YAAa,KAAK,UAAW;AAAA,EACtC;AAEA,kBAAiB,KAAK,YAAY,iBAAkB;AACpD,OAAK,WAAW,aAAc,SAAS,IAAK;AAE5C,SAAO;AACR;",
6
+ "names": []
7
+ }
@@ -1,20 +1,12 @@
1
- /**
2
- * Internal dependencies
3
- */
4
- import { assertIsDefined } from '../utils/assert-is-defined';
5
- import insertAfter from './insert-after';
6
- import remove from './remove';
7
-
8
- /**
9
- * Given two DOM nodes, replaces the former with the latter in the DOM.
10
- *
11
- * @param {Element} processedNode Node to be removed.
12
- * @param {Element} newNode Node to be inserted in its place.
13
- * @return {void}
14
- */
15
- export default function replace(processedNode, newNode) {
16
- assertIsDefined(processedNode.parentNode, 'processedNode.parentNode');
1
+ import { assertIsDefined } from "../utils/assert-is-defined";
2
+ import insertAfter from "./insert-after";
3
+ import remove from "./remove";
4
+ function replace(processedNode, newNode) {
5
+ assertIsDefined(processedNode.parentNode, "processedNode.parentNode");
17
6
  insertAfter(newNode, processedNode.parentNode);
18
7
  remove(processedNode);
19
8
  }
20
- //# sourceMappingURL=replace.js.map
9
+ export {
10
+ replace as default
11
+ };
12
+ //# sourceMappingURL=replace.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["assertIsDefined","insertAfter","remove","replace","processedNode","newNode","parentNode"],"sources":["@wordpress/dom/src/dom/replace.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\nimport insertAfter from './insert-after';\nimport remove from './remove';\n\n/**\n * Given two DOM nodes, replaces the former with the latter in the DOM.\n *\n * @param {Element} processedNode Node to be removed.\n * @param {Element} newNode Node to be inserted in its place.\n * @return {void}\n */\nexport default function replace( processedNode, newNode ) {\n\tassertIsDefined( processedNode.parentNode, 'processedNode.parentNode' );\n\tinsertAfter( newNode, processedNode.parentNode );\n\tremove( processedNode );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,4BAA4B;AAC5D,OAAOC,WAAW,MAAM,gBAAgB;AACxC,OAAOC,MAAM,MAAM,UAAU;;AAE7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,OAAOA,CAAEC,aAAa,EAAEC,OAAO,EAAG;EACzDL,eAAe,CAAEI,aAAa,CAACE,UAAU,EAAE,0BAA2B,CAAC;EACvEL,WAAW,CAAEI,OAAO,EAAED,aAAa,CAACE,UAAW,CAAC;EAChDJ,MAAM,CAAEE,aAAc,CAAC;AACxB","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/dom/replace.js"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\nimport insertAfter from './insert-after';\nimport remove from './remove';\n\n/**\n * Given two DOM nodes, replaces the former with the latter in the DOM.\n *\n * @param {Element} processedNode Node to be removed.\n * @param {Element} newNode Node to be inserted in its place.\n * @return {void}\n */\nexport default function replace( processedNode, newNode ) {\n\tassertIsDefined( processedNode.parentNode, 'processedNode.parentNode' );\n\tinsertAfter( newNode, processedNode.parentNode );\n\tremove( processedNode );\n}\n"],
5
+ "mappings": "AAGA,SAAS,uBAAuB;AAChC,OAAO,iBAAiB;AACxB,OAAO,YAAY;AASJ,SAAR,QAA0B,eAAe,SAAU;AACzD,kBAAiB,cAAc,YAAY,0BAA2B;AACtE,cAAa,SAAS,cAAc,UAAW;AAC/C,SAAQ,aAAc;AACvB;",
6
+ "names": []
7
+ }
@@ -1,33 +1,18 @@
1
- /**
2
- * Internal dependencies
3
- */
4
- import remove from './remove';
5
-
6
- /**
7
- * Strips scripts and on* attributes from HTML.
8
- *
9
- * @param {string} html HTML to sanitize.
10
- *
11
- * @return {string} The sanitized HTML.
12
- */
13
- export default function safeHTML(html) {
14
- const {
15
- body
16
- } = document.implementation.createHTMLDocument('');
1
+ import remove from "./remove";
2
+ function safeHTML(html) {
3
+ const { body } = document.implementation.createHTMLDocument("");
17
4
  body.innerHTML = html;
18
- const elements = body.getElementsByTagName('*');
5
+ const elements = body.getElementsByTagName("*");
19
6
  let elementIndex = elements.length;
20
7
  while (elementIndex--) {
21
8
  const element = elements[elementIndex];
22
- if (element.tagName === 'SCRIPT') {
9
+ if (element.tagName === "SCRIPT") {
23
10
  remove(element);
24
11
  } else {
25
12
  let attributeIndex = element.attributes.length;
26
13
  while (attributeIndex--) {
27
- const {
28
- name: key
29
- } = element.attributes[attributeIndex];
30
- if (key.startsWith('on')) {
14
+ const { name: key } = element.attributes[attributeIndex];
15
+ if (key.startsWith("on")) {
31
16
  element.removeAttribute(key);
32
17
  }
33
18
  }
@@ -35,4 +20,7 @@ export default function safeHTML(html) {
35
20
  }
36
21
  return body.innerHTML;
37
22
  }
38
- //# sourceMappingURL=safe-html.js.map
23
+ export {
24
+ safeHTML as default
25
+ };
26
+ //# sourceMappingURL=safe-html.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["remove","safeHTML","html","body","document","implementation","createHTMLDocument","innerHTML","elements","getElementsByTagName","elementIndex","length","element","tagName","attributeIndex","attributes","name","key","startsWith","removeAttribute"],"sources":["@wordpress/dom/src/dom/safe-html.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport remove from './remove';\n\n/**\n * Strips scripts and on* attributes from HTML.\n *\n * @param {string} html HTML to sanitize.\n *\n * @return {string} The sanitized HTML.\n */\nexport default function safeHTML( html ) {\n\tconst { body } = document.implementation.createHTMLDocument( '' );\n\tbody.innerHTML = html;\n\tconst elements = body.getElementsByTagName( '*' );\n\tlet elementIndex = elements.length;\n\n\twhile ( elementIndex-- ) {\n\t\tconst element = elements[ elementIndex ];\n\n\t\tif ( element.tagName === 'SCRIPT' ) {\n\t\t\tremove( element );\n\t\t} else {\n\t\t\tlet attributeIndex = element.attributes.length;\n\n\t\t\twhile ( attributeIndex-- ) {\n\t\t\t\tconst { name: key } = element.attributes[ attributeIndex ];\n\n\t\t\t\tif ( key.startsWith( 'on' ) ) {\n\t\t\t\t\telement.removeAttribute( key );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn body.innerHTML;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,MAAM,MAAM,UAAU;;AAE7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,QAAQA,CAAEC,IAAI,EAAG;EACxC,MAAM;IAAEC;EAAK,CAAC,GAAGC,QAAQ,CAACC,cAAc,CAACC,kBAAkB,CAAE,EAAG,CAAC;EACjEH,IAAI,CAACI,SAAS,GAAGL,IAAI;EACrB,MAAMM,QAAQ,GAAGL,IAAI,CAACM,oBAAoB,CAAE,GAAI,CAAC;EACjD,IAAIC,YAAY,GAAGF,QAAQ,CAACG,MAAM;EAElC,OAAQD,YAAY,EAAE,EAAG;IACxB,MAAME,OAAO,GAAGJ,QAAQ,CAAEE,YAAY,CAAE;IAExC,IAAKE,OAAO,CAACC,OAAO,KAAK,QAAQ,EAAG;MACnCb,MAAM,CAAEY,OAAQ,CAAC;IAClB,CAAC,MAAM;MACN,IAAIE,cAAc,GAAGF,OAAO,CAACG,UAAU,CAACJ,MAAM;MAE9C,OAAQG,cAAc,EAAE,EAAG;QAC1B,MAAM;UAAEE,IAAI,EAAEC;QAAI,CAAC,GAAGL,OAAO,CAACG,UAAU,CAAED,cAAc,CAAE;QAE1D,IAAKG,GAAG,CAACC,UAAU,CAAE,IAAK,CAAC,EAAG;UAC7BN,OAAO,CAACO,eAAe,CAAEF,GAAI,CAAC;QAC/B;MACD;IACD;EACD;EAEA,OAAOd,IAAI,CAACI,SAAS;AACtB","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/dom/safe-html.js"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport remove from './remove';\n\n/**\n * Strips scripts and on* attributes from HTML.\n *\n * @param {string} html HTML to sanitize.\n *\n * @return {string} The sanitized HTML.\n */\nexport default function safeHTML( html ) {\n\tconst { body } = document.implementation.createHTMLDocument( '' );\n\tbody.innerHTML = html;\n\tconst elements = body.getElementsByTagName( '*' );\n\tlet elementIndex = elements.length;\n\n\twhile ( elementIndex-- ) {\n\t\tconst element = elements[ elementIndex ];\n\n\t\tif ( element.tagName === 'SCRIPT' ) {\n\t\t\tremove( element );\n\t\t} else {\n\t\t\tlet attributeIndex = element.attributes.length;\n\n\t\t\twhile ( attributeIndex-- ) {\n\t\t\t\tconst { name: key } = element.attributes[ attributeIndex ];\n\n\t\t\t\tif ( key.startsWith( 'on' ) ) {\n\t\t\t\t\telement.removeAttribute( key );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn body.innerHTML;\n}\n"],
5
+ "mappings": "AAGA,OAAO,YAAY;AASJ,SAAR,SAA2B,MAAO;AACxC,QAAM,EAAE,KAAK,IAAI,SAAS,eAAe,mBAAoB,EAAG;AAChE,OAAK,YAAY;AACjB,QAAM,WAAW,KAAK,qBAAsB,GAAI;AAChD,MAAI,eAAe,SAAS;AAE5B,SAAQ,gBAAiB;AACxB,UAAM,UAAU,SAAU,YAAa;AAEvC,QAAK,QAAQ,YAAY,UAAW;AACnC,aAAQ,OAAQ;AAAA,IACjB,OAAO;AACN,UAAI,iBAAiB,QAAQ,WAAW;AAExC,aAAQ,kBAAmB;AAC1B,cAAM,EAAE,MAAM,IAAI,IAAI,QAAQ,WAAY,cAAe;AAEzD,YAAK,IAAI,WAAY,IAAK,GAAI;AAC7B,kBAAQ,gBAAiB,GAAI;AAAA,QAC9B;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAEA,SAAO,KAAK;AACb;",
6
+ "names": []
7
+ }