@wordpress/dom 4.56.0 → 5.0.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/README.md +22 -22
- package/build/data-transfer.cjs +1 -1
- package/build/data-transfer.cjs.map +3 -3
- package/build/dom/caret-range-from-point.cjs +1 -1
- package/build/dom/caret-range-from-point.cjs.map +3 -3
- package/build/dom/clean-node-list.cjs +1 -1
- package/build/dom/clean-node-list.cjs.map +3 -3
- package/build/dom/compute-caret-rect.cjs +1 -1
- package/build/dom/compute-caret-rect.cjs.map +3 -3
- package/build/dom/document-has-selection.cjs +1 -1
- package/build/dom/document-has-selection.cjs.map +3 -3
- package/build/dom/document-has-text-selection.cjs +1 -1
- package/build/dom/document-has-text-selection.cjs.map +3 -3
- package/build/dom/document-has-uncollapsed-selection.cjs +1 -1
- package/build/dom/document-has-uncollapsed-selection.cjs.map +3 -3
- package/build/dom/get-computed-style.cjs +1 -1
- package/build/dom/get-computed-style.cjs.map +3 -3
- package/build/dom/get-offset-parent.cjs +7 -15
- package/build/dom/get-offset-parent.cjs.map +4 -4
- package/build/dom/get-range-height.cjs +1 -1
- package/build/dom/get-range-height.cjs.map +3 -3
- package/build/dom/get-rectangle-from-range.cjs +3 -8
- package/build/dom/get-rectangle-from-range.cjs.map +3 -3
- package/build/dom/get-scroll-container.cjs +2 -6
- package/build/dom/get-scroll-container.cjs.map +3 -3
- package/build/dom/hidden-caret-range-from-point.cjs +1 -1
- package/build/dom/hidden-caret-range-from-point.cjs.map +3 -3
- package/build/dom/index.cjs +1 -1
- package/build/dom/index.cjs.map +1 -1
- package/build/dom/input-field-has-uncollapsed-selection.cjs +2 -5
- package/build/dom/input-field-has-uncollapsed-selection.cjs.map +3 -3
- package/build/dom/insert-after.cjs +1 -1
- package/build/dom/insert-after.cjs.map +3 -3
- package/build/dom/is-edge.cjs +1 -1
- package/build/dom/is-edge.cjs.map +3 -3
- package/build/dom/is-element.cjs +1 -1
- package/build/dom/is-element.cjs.map +3 -3
- package/build/dom/is-empty.cjs +2 -5
- package/build/dom/is-empty.cjs.map +3 -3
- package/build/dom/is-entirely-selected.cjs +2 -5
- package/build/dom/is-entirely-selected.cjs.map +3 -3
- package/build/dom/is-form-element.cjs +1 -1
- package/build/dom/is-form-element.cjs.map +3 -3
- package/build/dom/is-horizontal-edge.cjs +1 -1
- package/build/dom/is-horizontal-edge.cjs.map +3 -3
- package/build/dom/is-html-input-element.cjs +1 -1
- package/build/dom/is-html-input-element.cjs.map +3 -3
- package/build/dom/is-input-or-text-area.cjs +1 -1
- package/build/dom/is-input-or-text-area.cjs.map +3 -3
- package/build/dom/is-number-input.cjs +1 -1
- package/build/dom/is-number-input.cjs.map +3 -3
- package/build/dom/is-rtl.cjs +1 -1
- package/build/dom/is-rtl.cjs.map +3 -3
- package/build/dom/is-selection-forward.cjs +1 -1
- package/build/dom/is-selection-forward.cjs.map +3 -3
- package/build/dom/is-text-field.cjs +2 -3
- package/build/dom/is-text-field.cjs.map +3 -3
- package/build/dom/is-vertical-edge.cjs +1 -1
- package/build/dom/is-vertical-edge.cjs.map +3 -3
- package/build/dom/place-caret-at-edge.cjs +1 -1
- package/build/dom/place-caret-at-edge.cjs.map +3 -3
- package/build/dom/place-caret-at-horizontal-edge.cjs +1 -1
- package/build/dom/place-caret-at-horizontal-edge.cjs.map +3 -3
- package/build/dom/place-caret-at-vertical-edge.cjs +1 -1
- package/build/dom/place-caret-at-vertical-edge.cjs.map +3 -3
- package/build/dom/remove-invalid-html.cjs +1 -1
- package/build/dom/remove-invalid-html.cjs.map +3 -3
- package/build/dom/remove.cjs +1 -1
- package/build/dom/remove.cjs.map +3 -3
- package/build/dom/replace-tag.cjs +1 -1
- package/build/dom/replace-tag.cjs.map +3 -3
- package/build/dom/replace.cjs +1 -1
- package/build/dom/replace.cjs.map +3 -3
- package/build/dom/safe-html.cjs +1 -1
- package/build/dom/safe-html.cjs.map +3 -3
- package/build/dom/scroll-if-no-range.cjs +1 -1
- package/build/dom/scroll-if-no-range.cjs.map +3 -3
- package/build/dom/strip-html.cjs +1 -1
- package/build/dom/strip-html.cjs.map +3 -3
- package/build/dom/types.cjs +19 -0
- package/build/dom/types.cjs.map +7 -0
- package/build/dom/unwrap.cjs +1 -1
- package/build/dom/unwrap.cjs.map +3 -3
- package/build/dom/wrap.cjs +1 -1
- package/build/dom/wrap.cjs.map +3 -3
- package/build/focusable.cjs +5 -6
- package/build/focusable.cjs.map +3 -3
- package/build/index.cjs +1 -1
- package/build/index.cjs.map +2 -2
- package/build/phrasing-content.cjs +1 -1
- package/build/phrasing-content.cjs.map +3 -3
- package/build/tabbable.cjs +1 -1
- package/build/tabbable.cjs.map +3 -3
- package/build/types.cjs +19 -0
- package/build/types.cjs.map +7 -0
- package/build-module/data-transfer.mjs +1 -1
- package/build-module/data-transfer.mjs.map +3 -3
- package/build-module/dom/caret-range-from-point.mjs +1 -1
- package/build-module/dom/caret-range-from-point.mjs.map +3 -3
- package/build-module/dom/clean-node-list.mjs +1 -1
- package/build-module/dom/clean-node-list.mjs.map +3 -3
- package/build-module/dom/compute-caret-rect.mjs +1 -1
- package/build-module/dom/compute-caret-rect.mjs.map +3 -3
- package/build-module/dom/document-has-selection.mjs +1 -1
- package/build-module/dom/document-has-selection.mjs.map +3 -3
- package/build-module/dom/document-has-text-selection.mjs +1 -1
- package/build-module/dom/document-has-text-selection.mjs.map +3 -3
- package/build-module/dom/document-has-uncollapsed-selection.mjs +1 -1
- package/build-module/dom/document-has-uncollapsed-selection.mjs.map +3 -3
- package/build-module/dom/get-computed-style.mjs +1 -1
- package/build-module/dom/get-computed-style.mjs.map +3 -3
- package/build-module/dom/get-offset-parent.mjs +7 -15
- package/build-module/dom/get-offset-parent.mjs.map +3 -3
- package/build-module/dom/get-range-height.mjs +1 -1
- package/build-module/dom/get-range-height.mjs.map +3 -3
- package/build-module/dom/get-rectangle-from-range.mjs +3 -8
- package/build-module/dom/get-rectangle-from-range.mjs.map +3 -3
- package/build-module/dom/get-scroll-container.mjs +2 -6
- package/build-module/dom/get-scroll-container.mjs.map +3 -3
- package/build-module/dom/hidden-caret-range-from-point.mjs +1 -1
- package/build-module/dom/hidden-caret-range-from-point.mjs.map +3 -3
- package/build-module/dom/index.mjs +1 -1
- package/build-module/dom/index.mjs.map +1 -1
- package/build-module/dom/input-field-has-uncollapsed-selection.mjs +2 -5
- package/build-module/dom/input-field-has-uncollapsed-selection.mjs.map +3 -3
- package/build-module/dom/insert-after.mjs +1 -1
- package/build-module/dom/insert-after.mjs.map +3 -3
- package/build-module/dom/is-edge.mjs +1 -1
- package/build-module/dom/is-edge.mjs.map +3 -3
- package/build-module/dom/is-element.mjs +1 -1
- package/build-module/dom/is-element.mjs.map +3 -3
- package/build-module/dom/is-empty.mjs +2 -5
- package/build-module/dom/is-empty.mjs.map +3 -3
- package/build-module/dom/is-entirely-selected.mjs +2 -5
- package/build-module/dom/is-entirely-selected.mjs.map +3 -3
- package/build-module/dom/is-form-element.mjs +1 -1
- package/build-module/dom/is-form-element.mjs.map +3 -3
- package/build-module/dom/is-horizontal-edge.mjs +1 -1
- package/build-module/dom/is-horizontal-edge.mjs.map +3 -3
- package/build-module/dom/is-html-input-element.mjs +1 -1
- package/build-module/dom/is-html-input-element.mjs.map +3 -3
- package/build-module/dom/is-input-or-text-area.mjs +1 -1
- package/build-module/dom/is-input-or-text-area.mjs.map +3 -3
- package/build-module/dom/is-number-input.mjs +1 -1
- package/build-module/dom/is-number-input.mjs.map +3 -3
- package/build-module/dom/is-rtl.mjs +1 -1
- package/build-module/dom/is-rtl.mjs.map +3 -3
- package/build-module/dom/is-selection-forward.mjs +1 -1
- package/build-module/dom/is-selection-forward.mjs.map +3 -3
- package/build-module/dom/is-text-field.mjs +2 -3
- package/build-module/dom/is-text-field.mjs.map +3 -3
- package/build-module/dom/is-vertical-edge.mjs +1 -1
- package/build-module/dom/is-vertical-edge.mjs.map +3 -3
- package/build-module/dom/place-caret-at-edge.mjs +1 -1
- package/build-module/dom/place-caret-at-edge.mjs.map +3 -3
- package/build-module/dom/place-caret-at-horizontal-edge.mjs +1 -1
- package/build-module/dom/place-caret-at-horizontal-edge.mjs.map +3 -3
- package/build-module/dom/place-caret-at-vertical-edge.mjs +1 -1
- package/build-module/dom/place-caret-at-vertical-edge.mjs.map +3 -3
- package/build-module/dom/remove-invalid-html.mjs +1 -1
- package/build-module/dom/remove-invalid-html.mjs.map +3 -3
- package/build-module/dom/remove.mjs +1 -1
- package/build-module/dom/remove.mjs.map +3 -3
- package/build-module/dom/replace-tag.mjs +1 -1
- package/build-module/dom/replace-tag.mjs.map +3 -3
- package/build-module/dom/replace.mjs +1 -1
- package/build-module/dom/replace.mjs.map +3 -3
- package/build-module/dom/safe-html.mjs +1 -1
- package/build-module/dom/safe-html.mjs.map +3 -3
- package/build-module/dom/scroll-if-no-range.mjs +1 -1
- package/build-module/dom/scroll-if-no-range.mjs.map +3 -3
- package/build-module/dom/strip-html.mjs +1 -1
- package/build-module/dom/strip-html.mjs.map +3 -3
- package/build-module/dom/types.mjs +1 -0
- package/build-module/dom/types.mjs.map +7 -0
- package/build-module/dom/unwrap.mjs +1 -1
- package/build-module/dom/unwrap.mjs.map +3 -3
- package/build-module/dom/wrap.mjs +1 -1
- package/build-module/dom/wrap.mjs.map +3 -3
- package/build-module/focusable.mjs +5 -6
- package/build-module/focusable.mjs.map +3 -3
- package/build-module/index.mjs +1 -1
- package/build-module/index.mjs.map +2 -2
- package/build-module/phrasing-content.mjs +1 -1
- package/build-module/phrasing-content.mjs.map +3 -3
- package/build-module/tabbable.mjs +1 -1
- package/build-module/tabbable.mjs.map +3 -3
- package/build-module/types.mjs +1 -0
- package/build-module/types.mjs.map +7 -0
- package/build-types/data-transfer.d.ts +2 -2
- package/build-types/data-transfer.d.ts.map +1 -1
- package/build-types/dom/caret-range-from-point.d.ts +4 -4
- package/build-types/dom/caret-range-from-point.d.ts.map +1 -1
- package/build-types/dom/clean-node-list.d.ts +5 -45
- package/build-types/dom/clean-node-list.d.ts.map +1 -1
- package/build-types/dom/compute-caret-rect.d.ts +2 -2
- package/build-types/dom/compute-caret-rect.d.ts.map +1 -1
- package/build-types/dom/document-has-selection.d.ts +2 -2
- package/build-types/dom/document-has-selection.d.ts.map +1 -1
- package/build-types/dom/document-has-text-selection.d.ts +2 -2
- package/build-types/dom/document-has-text-selection.d.ts.map +1 -1
- package/build-types/dom/document-has-uncollapsed-selection.d.ts +2 -2
- package/build-types/dom/document-has-uncollapsed-selection.d.ts.map +1 -1
- package/build-types/dom/get-computed-style.d.ts +3 -3
- package/build-types/dom/get-computed-style.d.ts.map +1 -1
- package/build-types/dom/get-offset-parent.d.ts +2 -2
- package/build-types/dom/get-offset-parent.d.ts.map +1 -1
- package/build-types/dom/get-range-height.d.ts +2 -2
- package/build-types/dom/get-range-height.d.ts.map +1 -1
- package/build-types/dom/get-rectangle-from-range.d.ts +2 -2
- package/build-types/dom/get-rectangle-from-range.d.ts.map +1 -1
- package/build-types/dom/get-scroll-container.d.ts +5 -5
- package/build-types/dom/get-scroll-container.d.ts.map +1 -1
- package/build-types/dom/hidden-caret-range-from-point.d.ts +5 -5
- package/build-types/dom/hidden-caret-range-from-point.d.ts.map +1 -1
- package/build-types/dom/index.d.ts.map +1 -1
- package/build-types/dom/input-field-has-uncollapsed-selection.d.ts +2 -2
- package/build-types/dom/input-field-has-uncollapsed-selection.d.ts.map +1 -1
- package/build-types/dom/insert-after.d.ts +2 -3
- package/build-types/dom/insert-after.d.ts.map +1 -1
- package/build-types/dom/is-edge.d.ts +4 -4
- package/build-types/dom/is-edge.d.ts.map +1 -1
- package/build-types/dom/is-element.d.ts.map +1 -1
- package/build-types/dom/is-empty.d.ts +3 -3
- package/build-types/dom/is-empty.d.ts.map +1 -1
- package/build-types/dom/is-entirely-selected.d.ts +2 -2
- package/build-types/dom/is-entirely-selected.d.ts.map +1 -1
- package/build-types/dom/is-form-element.d.ts +3 -3
- package/build-types/dom/is-form-element.d.ts.map +1 -1
- package/build-types/dom/is-horizontal-edge.d.ts.map +1 -1
- package/build-types/dom/is-html-input-element.d.ts +1 -1
- package/build-types/dom/is-html-input-element.d.ts.map +1 -1
- package/build-types/dom/is-input-or-text-area.d.ts.map +1 -1
- package/build-types/dom/is-number-input.d.ts +2 -2
- package/build-types/dom/is-number-input.d.ts.map +1 -1
- package/build-types/dom/is-rtl.d.ts +2 -2
- package/build-types/dom/is-rtl.d.ts.map +1 -1
- package/build-types/dom/is-selection-forward.d.ts +2 -2
- package/build-types/dom/is-selection-forward.d.ts.map +1 -1
- package/build-types/dom/is-text-field.d.ts +2 -2
- package/build-types/dom/is-text-field.d.ts.map +1 -1
- package/build-types/dom/is-vertical-edge.d.ts.map +1 -1
- package/build-types/dom/place-caret-at-edge.d.ts +3 -3
- package/build-types/dom/place-caret-at-edge.d.ts.map +1 -1
- package/build-types/dom/place-caret-at-horizontal-edge.d.ts.map +1 -1
- package/build-types/dom/place-caret-at-vertical-edge.d.ts.map +1 -1
- package/build-types/dom/remove-invalid-html.d.ts +5 -4
- package/build-types/dom/remove-invalid-html.d.ts.map +1 -1
- package/build-types/dom/remove.d.ts +1 -2
- package/build-types/dom/remove.d.ts.map +1 -1
- package/build-types/dom/replace-tag.d.ts +3 -3
- package/build-types/dom/replace-tag.d.ts.map +1 -1
- package/build-types/dom/replace.d.ts +2 -3
- package/build-types/dom/replace.d.ts.map +1 -1
- package/build-types/dom/safe-html.d.ts +2 -2
- package/build-types/dom/safe-html.d.ts.map +1 -1
- package/build-types/dom/scroll-if-no-range.d.ts +5 -5
- package/build-types/dom/scroll-if-no-range.d.ts.map +1 -1
- package/build-types/dom/strip-html.d.ts +2 -2
- package/build-types/dom/strip-html.d.ts.map +1 -1
- package/build-types/dom/types.d.ts +32 -0
- package/build-types/dom/types.d.ts.map +1 -0
- package/build-types/dom/unwrap.d.ts +1 -3
- package/build-types/dom/unwrap.d.ts.map +1 -1
- package/build-types/dom/wrap.d.ts +2 -2
- package/build-types/dom/wrap.d.ts.map +1 -1
- package/build-types/focusable.d.ts +11 -30
- package/build-types/focusable.d.ts.map +1 -1
- package/build-types/index.d.ts +17 -0
- package/build-types/index.d.ts.map +1 -1
- package/build-types/phrasing-content.d.ts +9 -24
- package/build-types/phrasing-content.d.ts.map +1 -1
- package/build-types/tabbable.d.ts +10 -15
- package/build-types/tabbable.d.ts.map +1 -1
- package/build-types/types.d.ts +29 -0
- package/build-types/types.d.ts.map +1 -0
- package/package.json +6 -7
- package/src/{data-transfer.js → data-transfer.ts} +3 -3
- package/src/dom/{caret-range-from-point.js → caret-range-from-point.ts} +9 -5
- package/src/dom/{clean-node-list.js → clean-node-list.ts} +16 -24
- package/src/dom/{compute-caret-rect.js → compute-caret-rect.ts} +3 -3
- package/src/dom/{document-has-selection.js → document-has-selection.ts} +3 -3
- package/src/dom/{document-has-text-selection.js → document-has-text-selection.ts} +3 -3
- package/src/dom/{document-has-uncollapsed-selection.js → document-has-uncollapsed-selection.ts} +5 -3
- package/src/dom/{get-computed-style.js → get-computed-style.ts} +5 -3
- package/src/dom/{get-offset-parent.js → get-offset-parent.ts} +9 -14
- package/src/dom/{get-range-height.js → get-range-height.ts} +3 -3
- package/src/dom/{get-rectangle-from-range.js → get-rectangle-from-range.ts} +6 -12
- package/src/dom/{get-scroll-container.js → get-scroll-container.ts} +9 -9
- package/src/dom/{hidden-caret-range-from-point.js → hidden-caret-range-from-point.ts} +11 -6
- package/src/dom/{input-field-has-uncollapsed-selection.js → input-field-has-uncollapsed-selection.ts} +7 -5
- package/src/dom/{insert-after.js → insert-after.ts} +6 -4
- package/src/dom/{is-edge.js → is-edge.ts} +9 -5
- package/src/dom/{is-element.js → is-element.ts} +3 -1
- package/src/dom/{is-empty.js → is-empty.ts} +5 -7
- package/src/dom/{is-entirely-selected.js → is-entirely-selected.ts} +14 -11
- package/src/dom/{is-form-element.js → is-form-element.ts} +5 -3
- package/src/dom/{is-horizontal-edge.js → is-horizontal-edge.ts} +4 -1
- package/src/dom/{is-html-input-element.js → is-html-input-element.ts} +3 -1
- package/src/dom/{is-input-or-text-area.js → is-input-or-text-area.ts} +3 -1
- package/src/dom/{is-number-input.js → is-number-input.ts} +3 -3
- package/src/dom/{is-rtl.js → is-rtl.ts} +3 -3
- package/src/dom/{is-selection-forward.js → is-selection-forward.ts} +3 -3
- package/src/dom/{is-text-field.js → is-text-field.ts} +4 -4
- package/src/dom/{is-vertical-edge.js → is-vertical-edge.ts} +4 -1
- package/src/dom/{place-caret-at-edge.js → place-caret-at-edge.ts} +17 -9
- package/src/dom/{place-caret-at-horizontal-edge.js → place-caret-at-horizontal-edge.ts} +4 -1
- package/src/dom/{place-caret-at-vertical-edge.js → place-caret-at-vertical-edge.ts} +5 -1
- package/src/dom/{remove-invalid-html.js → remove-invalid-html.ts} +9 -4
- package/src/dom/{remove.js → remove.ts} +2 -3
- package/src/dom/{replace-tag.js → replace-tag.ts} +4 -4
- package/src/dom/{replace.js → replace.ts} +6 -4
- package/src/dom/{safe-html.js → safe-html.ts} +3 -3
- package/src/dom/{scroll-if-no-range.js → scroll-if-no-range.ts} +9 -5
- package/src/dom/{strip-html.js → strip-html.ts} +3 -3
- package/src/dom/types.ts +28 -0
- package/src/dom/{unwrap.js → unwrap.ts} +2 -4
- package/src/dom/{wrap.js → wrap.ts} +3 -3
- package/src/{focusable.js → focusable.ts} +34 -32
- package/src/index.ts +33 -0
- package/src/{phrasing-content.js → phrasing-content.ts} +15 -30
- package/src/{tabbable.js → tabbable.ts} +48 -39
- package/src/test/dom.jsdom.test.js +21 -0
- package/src/types.ts +32 -0
- package/CHANGELOG.md +0 -315
- package/src/index.js +0 -12
- /package/src/dom/{index.js → index.ts} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/dom/is-empty.
|
|
4
|
-
"sourcesContent": ["/**\n * Recursively checks if an element is empty. An element is not empty if it\n * contains text or contains elements with attributes such as images.\n *\n * @param
|
|
5
|
-
"mappings": ";AAQe,SAAR,QAA0B,
|
|
3
|
+
"sources": ["../../src/dom/is-empty.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Recursively checks if an element is empty. An element is not empty if it\n * contains text or contains elements with attributes such as images.\n *\n * @param element The element to check.\n *\n * @return Whether or not the element is empty.\n */\nexport default function isEmpty( element: Node ): boolean {\n\tswitch ( element.nodeType ) {\n\t\tcase element.TEXT_NODE:\n\t\t\t// We cannot use \\s since it includes special spaces which we want\n\t\t\t// to preserve.\n\t\t\treturn /^[ \\f\\n\\r\\t\\v\\u00a0]*$/.test( element.nodeValue || '' );\n\t\tcase element.ELEMENT_NODE:\n\t\t\tif ( ( element as Element ).hasAttributes() ) {\n\t\t\t\treturn false;\n\t\t\t} else if ( ! element.hasChildNodes() ) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn Array.from( element.childNodes ).every( isEmpty );\n\t\tdefault:\n\t\t\treturn true;\n\t}\n}\n"],
|
|
5
|
+
"mappings": ";AAQe,SAAR,QAA0B,SAAyB;AACzD,UAAS,QAAQ,UAAW;AAAA,IAC3B,KAAK,QAAQ;AAGZ,aAAO,yBAAyB,KAAM,QAAQ,aAAa,EAAG;AAAA,IAC/D,KAAK,QAAQ;AACZ,UAAO,QAAqB,cAAc,GAAI;AAC7C,eAAO;AAAA,MACR,WAAY,CAAE,QAAQ,cAAc,GAAI;AACvC,eAAO;AAAA,MACR;AAEA,aAAO,MAAM,KAAM,QAAQ,UAAW,EAAE,MAAO,OAAQ;AAAA,IACxD;AACC,aAAO;AAAA,EACT;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// packages/dom/src/dom/is-entirely-selected.
|
|
1
|
+
// packages/dom/src/dom/is-entirely-selected.ts
|
|
2
2
|
import { assertIsDefined } from "../utils/assert-is-defined.mjs";
|
|
3
3
|
import isInputOrTextArea from "./is-input-or-text-area.mjs";
|
|
4
4
|
var ZWNBSP = "\uFEFF";
|
|
@@ -28,10 +28,7 @@ function isEntirelySelected(element) {
|
|
|
28
28
|
}
|
|
29
29
|
const lastChild = element.lastChild;
|
|
30
30
|
assertIsDefined(lastChild, "lastChild");
|
|
31
|
-
const endContainerContentLength = endContainer.nodeType === endContainer.TEXT_NODE ?
|
|
32
|
-
/** @type {Text} */
|
|
33
|
-
endContainer.data.length
|
|
34
|
-
) : endContainer.childNodes.length;
|
|
31
|
+
const endContainerContentLength = endContainer.nodeType === endContainer.TEXT_NODE ? endContainer.data.length : endContainer.childNodes.length;
|
|
35
32
|
return isDeepChild(startContainer, element, "firstChild") && isDeepChild(endContainer, element, "lastChild") && startOffset === 0 && endOffset === endContainerContentLength;
|
|
36
33
|
}
|
|
37
34
|
function isDeepChild(query, container, propName) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/dom/is-entirely-selected.
|
|
4
|
-
"sourcesContent": ["import { assertIsDefined } from '../utils/assert-is-defined';\nimport isInputOrTextArea from './is-input-or-text-area';\n\n/**\n * Zero width non-breaking space, used as padding in the editable DOM tree when\n * it is empty otherwise.\n */\nconst ZWNBSP = '\\ufeff';\n\n/**\n * Check whether the contents of the element have been entirely selected.\n * Returns true if there is no possibility of selection.\n *\n * @param
|
|
5
|
-
"mappings": ";AAAA,SAAS,uBAAuB;AAChC,OAAO,uBAAuB;AAM9B,IAAM,SAAS;AAUA,SAAR,mBAAqC,
|
|
3
|
+
"sources": ["../../src/dom/is-entirely-selected.ts"],
|
|
4
|
+
"sourcesContent": ["import { assertIsDefined } from '../utils/assert-is-defined';\nimport isInputOrTextArea from './is-input-or-text-area';\n\n/**\n * Zero width non-breaking space, used as padding in the editable DOM tree when\n * it is empty otherwise.\n */\nconst ZWNBSP = '\\ufeff';\n\n/**\n * Check whether the contents of the element have been entirely selected.\n * Returns true if there is no possibility of selection.\n *\n * @param element The element to check.\n *\n * @return True if entirely selected, false if not.\n */\nexport default function isEntirelySelected( element: HTMLElement ): boolean {\n\tif ( isInputOrTextArea( element ) ) {\n\t\treturn (\n\t\t\telement.selectionStart === 0 &&\n\t\t\telement.value.length === element.selectionEnd\n\t\t);\n\t}\n\n\tif ( ! element.isContentEditable ) {\n\t\treturn true;\n\t}\n\n\t// If the element is effectively empty (contains only the ZWNBSP\n\t// placeholder or nothing), consider it entirely selected since there's\n\t// nothing meaningful to select.\n\tconst text = element.textContent || '';\n\tif ( text === '' || text === ZWNBSP ) {\n\t\treturn true;\n\t}\n\n\tconst { ownerDocument } = element;\n\tconst { defaultView } = ownerDocument;\n\tassertIsDefined( defaultView, 'defaultView' );\n\tconst selection = defaultView.getSelection();\n\tassertIsDefined( selection, 'selection' );\n\tconst range = selection.rangeCount ? selection.getRangeAt( 0 ) : null;\n\n\tif ( ! range ) {\n\t\treturn true;\n\t}\n\n\tconst { startContainer, endContainer, startOffset, endOffset } = range;\n\n\tif (\n\t\tstartContainer === element &&\n\t\tendContainer === element &&\n\t\tstartOffset === 0 &&\n\t\tendOffset === element.childNodes.length\n\t) {\n\t\treturn true;\n\t}\n\n\tconst lastChild = element.lastChild;\n\tassertIsDefined( lastChild, 'lastChild' );\n\tconst endContainerContentLength =\n\t\tendContainer.nodeType === endContainer.TEXT_NODE\n\t\t\t? ( endContainer as Text ).data.length\n\t\t\t: endContainer.childNodes.length;\n\n\treturn (\n\t\tisDeepChild( startContainer, element, 'firstChild' ) &&\n\t\tisDeepChild( endContainer, element, 'lastChild' ) &&\n\t\tstartOffset === 0 &&\n\t\tendOffset === endContainerContentLength\n\t);\n}\n\n/**\n * Check whether the contents of the element have been entirely selected.\n * Returns true if there is no possibility of selection.\n *\n * @param query The element to check.\n * @param container The container that we suspect \"query\" may be a first or last child of.\n * @param propName \"firstChild\" or \"lastChild\"\n *\n * @return True if query is a deep first/last child of container, false otherwise.\n */\nfunction isDeepChild(\n\tquery: HTMLElement | Node,\n\tcontainer: HTMLElement,\n\tpropName: 'firstChild' | 'lastChild'\n): boolean {\n\tlet candidate: HTMLElement | ChildNode | null = container;\n\tdo {\n\t\tif ( query === candidate ) {\n\t\t\treturn true;\n\t\t}\n\t\tcandidate = candidate[ propName ];\n\t\t// There may be empty text nodes between the first/last child, so ignore\n\t\t// them.\n\t\twhile (\n\t\t\tcandidate &&\n\t\t\tcandidate.nodeType === candidate.TEXT_NODE &&\n\t\t\tcandidate.nodeValue === ''\n\t\t) {\n\t\t\tcandidate =\n\t\t\t\tcandidate[\n\t\t\t\t\tpropName === 'lastChild' ? 'previousSibling' : 'nextSibling'\n\t\t\t\t];\n\t\t}\n\t} while ( candidate );\n\treturn false;\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,uBAAuB;AAChC,OAAO,uBAAuB;AAM9B,IAAM,SAAS;AAUA,SAAR,mBAAqC,SAAgC;AAC3E,MAAK,kBAAmB,OAAQ,GAAI;AACnC,WACC,QAAQ,mBAAmB,KAC3B,QAAQ,MAAM,WAAW,QAAQ;AAAA,EAEnC;AAEA,MAAK,CAAE,QAAQ,mBAAoB;AAClC,WAAO;AAAA,EACR;AAKA,QAAM,OAAO,QAAQ,eAAe;AACpC,MAAK,SAAS,MAAM,SAAS,QAAS;AACrC,WAAO;AAAA,EACR;AAEA,QAAM,EAAE,cAAc,IAAI;AAC1B,QAAM,EAAE,YAAY,IAAI;AACxB,kBAAiB,aAAa,aAAc;AAC5C,QAAM,YAAY,YAAY,aAAa;AAC3C,kBAAiB,WAAW,WAAY;AACxC,QAAM,QAAQ,UAAU,aAAa,UAAU,WAAY,CAAE,IAAI;AAEjE,MAAK,CAAE,OAAQ;AACd,WAAO;AAAA,EACR;AAEA,QAAM,EAAE,gBAAgB,cAAc,aAAa,UAAU,IAAI;AAEjE,MACC,mBAAmB,WACnB,iBAAiB,WACjB,gBAAgB,KAChB,cAAc,QAAQ,WAAW,QAChC;AACD,WAAO;AAAA,EACR;AAEA,QAAM,YAAY,QAAQ;AAC1B,kBAAiB,WAAW,WAAY;AACxC,QAAM,4BACL,aAAa,aAAa,aAAa,YAClC,aAAuB,KAAK,SAC9B,aAAa,WAAW;AAE5B,SACC,YAAa,gBAAgB,SAAS,YAAa,KACnD,YAAa,cAAc,SAAS,WAAY,KAChD,gBAAgB,KAChB,cAAc;AAEhB;AAYA,SAAS,YACR,OACA,WACA,UACU;AACV,MAAI,YAA4C;AAChD,KAAG;AACF,QAAK,UAAU,WAAY;AAC1B,aAAO;AAAA,IACR;AACA,gBAAY,UAAW,QAAS;AAGhC,WACC,aACA,UAAU,aAAa,UAAU,aACjC,UAAU,cAAc,IACvB;AACD,kBACC,UACC,aAAa,cAAc,oBAAoB,aAChD;AAAA,IACF;AAAA,EACD,SAAU;AACV,SAAO;AACR;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/dom/is-form-element.
|
|
4
|
-
"sourcesContent": ["import isInputOrTextArea from './is-input-or-text-area';\n\n/**\n *\n * Detects if element is a form element.\n *\n * @param
|
|
5
|
-
"mappings": ";AAAA,OAAO,uBAAuB;AAUf,SAAR,
|
|
3
|
+
"sources": ["../../src/dom/is-form-element.ts"],
|
|
4
|
+
"sourcesContent": ["import isInputOrTextArea from './is-input-or-text-area';\n\n/**\n *\n * Detects if element is a form element.\n *\n * @param element The element to check.\n *\n * @return True if form element and false otherwise.\n */\nexport default function isFormElement(\n\telement: Element | null | undefined\n): boolean {\n\tif ( ! element ) {\n\t\treturn false;\n\t}\n\n\tconst { tagName } = element;\n\tconst checkForInputTextarea = isInputOrTextArea( element );\n\treturn (\n\t\tcheckForInputTextarea || tagName === 'BUTTON' || tagName === 'SELECT'\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,OAAO,uBAAuB;AAUf,SAAR,cACN,SACU;AACV,MAAK,CAAE,SAAU;AAChB,WAAO;AAAA,EACR;AAEA,QAAM,EAAE,QAAQ,IAAI;AACpB,QAAM,wBAAwB,kBAAmB,OAAQ;AACzD,SACC,yBAAyB,YAAY,YAAY,YAAY;AAE/D;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/dom/is-horizontal-edge.
|
|
4
|
-
"sourcesContent": ["import isEdge from './is-edge';\n\n/**\n * Check whether the selection is horizontally at the edge of the container.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse Set to true to check left, false for right.\n *\n * @return {boolean} True if at the horizontal edge, false if not.\n */\nexport default function isHorizontalEdge(
|
|
5
|
-
"mappings": ";AAAA,OAAO,YAAY;AAUJ,SAAR,
|
|
3
|
+
"sources": ["../../src/dom/is-horizontal-edge.ts"],
|
|
4
|
+
"sourcesContent": ["import isEdge from './is-edge';\n\n/**\n * Check whether the selection is horizontally at the edge of the container.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse Set to true to check left, false for right.\n *\n * @return {boolean} True if at the horizontal edge, false if not.\n */\nexport default function isHorizontalEdge(\n\tcontainer: HTMLElement,\n\tisReverse: boolean\n): boolean {\n\treturn isEdge( container, isReverse );\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,OAAO,YAAY;AAUJ,SAAR,iBACN,WACA,WACU;AACV,SAAO,OAAQ,WAAW,SAAU;AACrC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/dom/is-html-input-element.
|
|
4
|
-
"sourcesContent": ["/**\n * @param {Node} node\n * @return {node is HTMLInputElement} Whether the node is an HTMLInputElement.\n */\nexport default function isHTMLInputElement(
|
|
5
|
-
"mappings": ";AAIe,SAAR,
|
|
3
|
+
"sources": ["../../src/dom/is-html-input-element.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * @param {Node} node\n * @return {node is HTMLInputElement} Whether the node is an HTMLInputElement.\n */\nexport default function isHTMLInputElement(\n\tnode: Node | null | undefined\n): node is HTMLInputElement {\n\treturn node?.nodeName === 'INPUT';\n}\n"],
|
|
5
|
+
"mappings": ";AAIe,SAAR,mBACN,MAC2B;AAC3B,SAAO,MAAM,aAAa;AAC3B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/dom/is-input-or-text-area.
|
|
4
|
-
"sourcesContent": ["/**\n * @param {Element} element\n * @return {element is HTMLInputElement | HTMLTextAreaElement} Whether the element is an input or textarea\n */\nexport default function isInputOrTextArea( element
|
|
5
|
-
"mappings": ";AAIe,SAAR,
|
|
3
|
+
"sources": ["../../src/dom/is-input-or-text-area.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * @param {Element} element\n * @return {element is HTMLInputElement | HTMLTextAreaElement} Whether the element is an input or textarea\n */\nexport default function isInputOrTextArea(\n\telement: Element\n): element is HTMLInputElement | HTMLTextAreaElement {\n\treturn element.tagName === 'INPUT' || element.tagName === 'TEXTAREA';\n}\n"],
|
|
5
|
+
"mappings": ";AAIe,SAAR,kBACN,SACoD;AACpD,SAAO,QAAQ,YAAY,WAAW,QAAQ,YAAY;AAC3D;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/dom/is-number-input.
|
|
4
|
-
"sourcesContent": ["import deprecated from '@wordpress/deprecated';\nimport isHTMLInputElement from './is-html-input-element';\n\n/**\n * Check whether the given element is an input field of type number.\n *\n * @param
|
|
5
|
-
"mappings": ";AAAA,OAAO,gBAAgB;AACvB,OAAO,wBAAwB;AAShB,SAAR,cAAgC,
|
|
3
|
+
"sources": ["../../src/dom/is-number-input.ts"],
|
|
4
|
+
"sourcesContent": ["import deprecated from '@wordpress/deprecated';\nimport isHTMLInputElement from './is-html-input-element';\n\n/**\n * Check whether the given element is an input field of type number.\n *\n * @param node The HTML node.\n *\n * @return True if the node is number input.\n */\nexport default function isNumberInput( node: Node ): node is HTMLInputElement {\n\tdeprecated( 'wp.dom.isNumberInput', {\n\t\tsince: '6.1',\n\t\tversion: '6.5',\n\t} );\n\treturn (\n\t\tisHTMLInputElement( node ) &&\n\t\tnode.type === 'number' &&\n\t\t! isNaN( node.valueAsNumber )\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,OAAO,gBAAgB;AACvB,OAAO,wBAAwB;AAShB,SAAR,cAAgC,MAAuC;AAC7E,aAAY,wBAAwB;AAAA,IACnC,OAAO;AAAA,IACP,SAAS;AAAA,EACV,CAAE;AACF,SACC,mBAAoB,IAAK,KACzB,KAAK,SAAS,YACd,CAAE,MAAO,KAAK,aAAc;AAE9B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/dom/is-rtl.
|
|
4
|
-
"sourcesContent": ["import getComputedStyle from './get-computed-style';\n\n/**\n * Whether the element's text direction is right-to-left.\n *\n * @param
|
|
5
|
-
"mappings": ";AAAA,OAAO,sBAAsB;AASd,SAAR,MAAwB,
|
|
3
|
+
"sources": ["../../src/dom/is-rtl.ts"],
|
|
4
|
+
"sourcesContent": ["import getComputedStyle from './get-computed-style';\n\n/**\n * Whether the element's text direction is right-to-left.\n *\n * @param element The element to check.\n *\n * @return True if rtl, false if ltr.\n */\nexport default function isRTL( element: Element ): boolean {\n\treturn getComputedStyle( element ).direction === 'rtl';\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,OAAO,sBAAsB;AASd,SAAR,MAAwB,SAA4B;AAC1D,SAAO,iBAAkB,OAAQ,EAAE,cAAc;AAClD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// packages/dom/src/dom/is-selection-forward.
|
|
1
|
+
// packages/dom/src/dom/is-selection-forward.ts
|
|
2
2
|
import { assertIsDefined } from "../utils/assert-is-defined.mjs";
|
|
3
3
|
function isSelectionForward(selection) {
|
|
4
4
|
const { anchorNode, focusNode, anchorOffset, focusOffset } = selection;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/dom/is-selection-forward.
|
|
4
|
-
"sourcesContent": ["import { 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
|
|
5
|
-
"mappings": ";AAAA,SAAS,uBAAuB;AAYjB,SAAR,mBAAqC,
|
|
3
|
+
"sources": ["../../src/dom/is-selection-forward.ts"],
|
|
4
|
+
"sourcesContent": ["import { 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 object to check.\n *\n * @return Whether the selection is forward.\n */\nexport default function isSelectionForward( selection: Selection ): boolean {\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": ";AAAA,SAAS,uBAAuB;AAYjB,SAAR,mBAAqC,WAAgC;AAC3E,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
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// packages/dom/src/dom/is-text-field.
|
|
1
|
+
// packages/dom/src/dom/is-text-field.ts
|
|
2
2
|
import isHTMLInputElement from "./is-html-input-element.mjs";
|
|
3
3
|
function isTextField(node) {
|
|
4
4
|
const nonTextInputs = [
|
|
@@ -15,8 +15,7 @@ function isTextField(node) {
|
|
|
15
15
|
"email",
|
|
16
16
|
"time"
|
|
17
17
|
];
|
|
18
|
-
return isHTMLInputElement(node) && node.type && !nonTextInputs.includes(node.type) || node.nodeName === "TEXTAREA" ||
|
|
19
|
-
node.contentEditable === "true";
|
|
18
|
+
return isHTMLInputElement(node) && node.type && !nonTextInputs.includes(node.type) || node.nodeName === "TEXTAREA" || node.contentEditable === "true";
|
|
20
19
|
}
|
|
21
20
|
export {
|
|
22
21
|
isTextField as default
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/dom/is-text-field.
|
|
4
|
-
"sourcesContent": ["import isHTMLInputElement from './is-html-input-element';\n\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
|
|
5
|
-
"mappings": ";AAAA,OAAO,wBAAwB;AAWhB,SAAR,YAA8B,
|
|
3
|
+
"sources": ["../../src/dom/is-text-field.ts"],
|
|
4
|
+
"sourcesContent": ["import isHTMLInputElement from './is-html-input-element';\n\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 The HTML element.\n * @return True if the element is an text field, false if not.\n */\nexport default function isTextField( node: Node ): node is HTMLElement {\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( node as HTMLElement ).contentEditable === 'true'\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,OAAO,wBAAwB;AAWhB,SAAR,YAA8B,MAAkC;AACtE,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,cAChB,KAAsB,oBAAoB;AAE9C;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/dom/is-vertical-edge.
|
|
4
|
-
"sourcesContent": ["import 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(
|
|
5
|
-
"mappings": ";AAAA,OAAO,YAAY;AAUJ,SAAR,
|
|
3
|
+
"sources": ["../../src/dom/is-vertical-edge.ts"],
|
|
4
|
+
"sourcesContent": ["import 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(\n\tcontainer: HTMLElement,\n\tisReverse: boolean\n): boolean {\n\treturn isEdge( container, isReverse, true );\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,OAAO,YAAY;AAUJ,SAAR,eACN,WACA,WACU;AACV,SAAO,OAAQ,WAAW,WAAW,IAAK;AAC3C;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// packages/dom/src/dom/place-caret-at-edge.
|
|
1
|
+
// packages/dom/src/dom/place-caret-at-edge.ts
|
|
2
2
|
import hiddenCaretRangeFromPoint from "./hidden-caret-range-from-point.mjs";
|
|
3
3
|
import { assertIsDefined } from "../utils/assert-is-defined.mjs";
|
|
4
4
|
import isInputOrTextArea from "./is-input-or-text-area.mjs";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/dom/place-caret-at-edge.
|
|
4
|
-
"sourcesContent": ["import 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
|
|
5
|
-
"mappings": ";AAAA,OAAO,+BAA+B;AACtC,SAAS,uBAAuB;AAChC,OAAO,uBAAuB;AAC9B,OAAO,WAAW;AAClB,SAAS,uBAAuB;AAWhC,SAAS,
|
|
3
|
+
"sources": ["../../src/dom/place-caret-at-edge.ts"],
|
|
4
|
+
"sourcesContent": ["import 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 container Focusable element.\n * @param isReverse True for end, false for start.\n * @param x X coordinate to vertically position.\n *\n * @return The range to place.\n */\nfunction getRange(\n\tcontainer: HTMLElement,\n\tisReverse: boolean,\n\tx: number | undefined\n): Range | null {\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 container Focusable element.\n * @param isReverse True for end, false for start.\n * @param x X coordinate to vertically position.\n */\nexport default function placeCaretAtEdge(\n\tcontainer: HTMLElement,\n\tisReverse: boolean,\n\tx: number | undefined\n) {\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\t// Only place a caret if the container is itself an editable element.\n\t// It may also be content editable by inheriting it from an editing\n\t// host ancestor (e.g. an editable canvas wrapper), but placing a caret\n\t// for e.g. a focusable block element is then not intended.\n\tif ( container.contentEditable !== 'true' ) {\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": ";AAAA,OAAO,+BAA+B;AACtC,SAAS,uBAAuB;AAChC,OAAO,uBAAuB;AAC9B,OAAO,WAAW;AAClB,SAAS,uBAAuB;AAWhC,SAAS,SACR,WACA,WACA,GACe;AACf,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,iBACN,WACA,WACA,GACC;AACD,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;AAMA,MAAK,UAAU,oBAAoB,QAAS;AAC3C;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
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// packages/dom/src/dom/place-caret-at-horizontal-edge.
|
|
1
|
+
// packages/dom/src/dom/place-caret-at-horizontal-edge.ts
|
|
2
2
|
import placeCaretAtEdge from "./place-caret-at-edge.mjs";
|
|
3
3
|
function placeCaretAtHorizontalEdge(container, isReverse) {
|
|
4
4
|
return placeCaretAtEdge(container, isReverse, void 0);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/dom/place-caret-at-horizontal-edge.
|
|
4
|
-
"sourcesContent": ["import 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(
|
|
5
|
-
"mappings": ";AAAA,OAAO,sBAAsB;AAQd,SAAR,
|
|
3
|
+
"sources": ["../../src/dom/place-caret-at-horizontal-edge.ts"],
|
|
4
|
+
"sourcesContent": ["import 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(\n\tcontainer: HTMLElement,\n\tisReverse: boolean\n) {\n\treturn placeCaretAtEdge( container, isReverse, undefined );\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,OAAO,sBAAsB;AAQd,SAAR,2BACN,WACA,WACC;AACD,SAAO,iBAAkB,WAAW,WAAW,MAAU;AAC1D;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// packages/dom/src/dom/place-caret-at-vertical-edge.
|
|
1
|
+
// packages/dom/src/dom/place-caret-at-vertical-edge.ts
|
|
2
2
|
import placeCaretAtEdge from "./place-caret-at-edge.mjs";
|
|
3
3
|
function placeCaretAtVerticalEdge(container, isReverse, rect) {
|
|
4
4
|
return placeCaretAtEdge(container, isReverse, rect?.left);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/dom/place-caret-at-vertical-edge.
|
|
4
|
-
"sourcesContent": ["import 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(
|
|
5
|
-
"mappings": ";AAAA,OAAO,sBAAsB;AASd,SAAR,
|
|
3
|
+
"sources": ["../../src/dom/place-caret-at-vertical-edge.ts"],
|
|
4
|
+
"sourcesContent": ["import 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(\n\tcontainer: HTMLElement,\n\tisReverse: boolean,\n\trect?: DOMRect\n) {\n\treturn placeCaretAtEdge( container, isReverse, rect?.left );\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,OAAO,sBAAsB;AASd,SAAR,yBACN,WACA,WACA,MACC;AACD,SAAO,iBAAkB,WAAW,WAAW,MAAM,IAAK;AAC3D;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/dom/remove-invalid-html.
|
|
4
|
-
"sourcesContent": ["import cleanNodeList from './clean-node-list';\n\n/**\n * Given a schema, unwraps or removes nodes, attributes and classes on HTML.\n *\n * @param {string}
|
|
5
|
-
"mappings": ";AAAA,OAAO,mBAAmB;
|
|
3
|
+
"sources": ["../../src/dom/remove-invalid-html.ts"],
|
|
4
|
+
"sourcesContent": ["import cleanNodeList from './clean-node-list';\nimport type { Schema } from './types';\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 {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(\n\tHTML: string,\n\tschema: Schema,\n\tinline: boolean\n): string {\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": ";AAAA,OAAO,mBAAmB;AAYX,SAAR,kBACN,MACA,QACA,QACS;AACT,QAAM,MAAM,SAAS,eAAe,mBAAoB,EAAG;AAE3D,MAAI,KAAK,YAAY;AAErB,gBAAe,IAAI,KAAK,YAAY,KAAK,QAAQ,MAAO;AAExD,SAAO,IAAI,KAAK;AACjB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/dom/remove.
|
|
4
|
-
"sourcesContent": ["import { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Given a DOM node, removes it from the DOM.\n *\n * @param
|
|
5
|
-
"mappings": ";AAAA,SAAS,uBAAuB;
|
|
3
|
+
"sources": ["../../src/dom/remove.ts"],
|
|
4
|
+
"sourcesContent": ["import { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Given a DOM node, removes it from the DOM.\n *\n * @param node Node to be removed.\n */\nexport default function remove( node: Node ): void {\n\tassertIsDefined( node.parentNode, 'node.parentNode' );\n\tnode.parentNode.removeChild( node );\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,uBAAuB;AAOjB,SAAR,OAAyB,MAAmB;AAClD,kBAAiB,KAAK,YAAY,iBAAkB;AACpD,OAAK,WAAW,YAAa,IAAK;AACnC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/dom/replace-tag.
|
|
4
|
-
"sourcesContent": ["import { 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
|
|
5
|
-
"mappings": ";AAAA,SAAS,uBAAuB;AAUjB,SAAR,WAA6B,
|
|
3
|
+
"sources": ["../../src/dom/replace-tag.ts"],
|
|
4
|
+
"sourcesContent": ["import { 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 node The node to replace\n * @param tagName The new tag name.\n *\n * @return The new node.\n */\nexport default function replaceTag( node: Element, tagName: string ): Element {\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": ";AAAA,SAAS,uBAAuB;AAUjB,SAAR,WAA6B,MAAe,SAA2B;AAC7E,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
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/dom/replace.
|
|
4
|
-
"sourcesContent": ["import { 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
|
|
5
|
-
"mappings": ";AAAA,SAAS,uBAAuB;AAChC,OAAO,iBAAiB;AACxB,OAAO,YAAY;
|
|
3
|
+
"sources": ["../../src/dom/replace.ts"],
|
|
4
|
+
"sourcesContent": ["import { 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 processedNode Node to be removed.\n * @param newNode Node to be inserted in its place.\n */\nexport default function replace(\n\tprocessedNode: Element,\n\tnewNode: Element\n): void {\n\tassertIsDefined( processedNode.parentNode, 'processedNode.parentNode' );\n\tinsertAfter( newNode, processedNode.parentNode );\n\tremove( processedNode );\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,uBAAuB;AAChC,OAAO,iBAAiB;AACxB,OAAO,YAAY;AAQJ,SAAR,QACN,eACA,SACO;AACP,kBAAiB,cAAc,YAAY,0BAA2B;AACtE,cAAa,SAAS,cAAc,UAAW;AAC/C,SAAQ,aAAc;AACvB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/dom/safe-html.
|
|
4
|
-
"sourcesContent": ["import remove from './remove';\n\n/**\n * Strips scripts and on* attributes from HTML.\n *\n * @param
|
|
5
|
-
"mappings": ";AAAA,OAAO,YAAY;AASJ,SAAR,SAA2B,
|
|
3
|
+
"sources": ["../../src/dom/safe-html.ts"],
|
|
4
|
+
"sourcesContent": ["import remove from './remove';\n\n/**\n * Strips scripts and on* attributes from HTML.\n *\n * @param html HTML to sanitize.\n *\n * @return The sanitized HTML.\n */\nexport default function safeHTML( html: string ): string {\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": ";AAAA,OAAO,YAAY;AASJ,SAAR,SAA2B,MAAuB;AACxD,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
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/dom/scroll-if-no-range.
|
|
4
|
-
"sourcesContent": ["/**\n * If no range range can be created or it is outside the container, the element\n * may be out of view, so scroll it into view and try again.\n *\n * @param
|
|
5
|
-
"mappings": ";AAUO,SAAS,
|
|
3
|
+
"sources": ["../../src/dom/scroll-if-no-range.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * If no range range can be created or it is outside the container, the element\n * may be out of view, so scroll it into view and try again.\n *\n * @param container The container to scroll.\n * @param alignToTop True to align to top, false to bottom.\n * @param callback The callback to create the range.\n *\n * @return The range returned by the callback.\n */\nexport function scrollIfNoRange(\n\tcontainer: HTMLElement,\n\talignToTop: boolean,\n\tcallback: () => Range | null\n): Range | null {\n\tlet range = callback();\n\n\t// If no range range can be created or it is outside the container, the\n\t// element may be out of view.\n\tif (\n\t\t! range ||\n\t\t! range.startContainer ||\n\t\t! container.contains( range.startContainer )\n\t) {\n\t\tcontainer.scrollIntoView( alignToTop );\n\t\trange = callback();\n\n\t\tif (\n\t\t\t! range ||\n\t\t\t! range.startContainer ||\n\t\t\t! container.contains( range.startContainer )\n\t\t) {\n\t\t\treturn null;\n\t\t}\n\t}\n\n\treturn range;\n}\n"],
|
|
5
|
+
"mappings": ";AAUO,SAAS,gBACf,WACA,YACA,UACe;AACf,MAAI,QAAQ,SAAS;AAIrB,MACC,CAAE,SACF,CAAE,MAAM,kBACR,CAAE,UAAU,SAAU,MAAM,cAAe,GAC1C;AACD,cAAU,eAAgB,UAAW;AACrC,YAAQ,SAAS;AAEjB,QACC,CAAE,SACF,CAAE,MAAM,kBACR,CAAE,UAAU,SAAU,MAAM,cAAe,GAC1C;AACD,aAAO;AAAA,IACR;AAAA,EACD;AAEA,SAAO;AACR;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/dom/strip-html.
|
|
4
|
-
"sourcesContent": ["import safeHTML from './safe-html';\n\n/**\n * Removes any HTML tags from the provided string.\n *\n * @param
|
|
5
|
-
"mappings": ";AAAA,OAAO,cAAc;AASN,SAAR,UAA4B,
|
|
3
|
+
"sources": ["../../src/dom/strip-html.ts"],
|
|
4
|
+
"sourcesContent": ["import safeHTML from './safe-html';\n\n/**\n * Removes any HTML tags from the provided string.\n *\n * @param html The string containing html.\n *\n * @return The text content with any html removed.\n */\nexport default function stripHTML( html: string ): string {\n\t// Remove any script tags or on* attributes otherwise their *contents* will be left\n\t// in place following removal of HTML tags.\n\thtml = safeHTML( html );\n\n\tconst doc = document.implementation.createHTMLDocument( '' );\n\tdoc.body.innerHTML = html;\n\treturn doc.body.textContent || '';\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,OAAO,cAAc;AASN,SAAR,UAA4B,MAAuB;AAGzD,SAAO,SAAU,IAAK;AAEtB,QAAM,MAAM,SAAS,eAAe,mBAAoB,EAAG;AAC3D,MAAI,KAAK,YAAY;AACrB,SAAO,IAAI,KAAK,eAAe;AAChC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/dom/unwrap.
|
|
4
|
-
"sourcesContent": ["import { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Unwrap the given node. This means any child nodes are moved to the parent.\n *\n * @param
|
|
5
|
-
"mappings": ";AAAA,SAAS,uBAAuB;
|
|
3
|
+
"sources": ["../../src/dom/unwrap.ts"],
|
|
4
|
+
"sourcesContent": ["import { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Unwrap the given node. This means any child nodes are moved to the parent.\n *\n * @param node The node to unwrap.\n */\nexport default function unwrap( node: Node ): void {\n\tconst parent = node.parentNode;\n\n\tassertIsDefined( parent, 'node.parentNode' );\n\n\twhile ( node.firstChild ) {\n\t\tparent.insertBefore( node.firstChild, node );\n\t}\n\n\tparent.removeChild( node );\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,uBAAuB;AAOjB,SAAR,OAAyB,MAAmB;AAClD,QAAM,SAAS,KAAK;AAEpB,kBAAiB,QAAQ,iBAAkB;AAE3C,SAAQ,KAAK,YAAa;AACzB,WAAO,aAAc,KAAK,YAAY,IAAK;AAAA,EAC5C;AAEA,SAAO,YAAa,IAAK;AAC1B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/dom/wrap.
|
|
4
|
-
"sourcesContent": ["import { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Wraps the given node with a new node with the given tag name.\n *\n * @param
|
|
5
|
-
"mappings": ";AAAA,SAAS,uBAAuB;AAQjB,SAAR,KAAuB,
|
|
3
|
+
"sources": ["../../src/dom/wrap.ts"],
|
|
4
|
+
"sourcesContent": ["import { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Wraps the given node with a new node with the given tag name.\n *\n * @param newNode The node to insert.\n * @param referenceNode The node to wrap.\n */\nexport default function wrap( newNode: Element, referenceNode: Element ) {\n\tassertIsDefined( referenceNode.parentNode, 'referenceNode.parentNode' );\n\treferenceNode.parentNode.insertBefore( newNode, referenceNode );\n\tnewNode.appendChild( referenceNode );\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,uBAAuB;AAQjB,SAAR,KAAuB,SAAkB,eAAyB;AACxE,kBAAiB,cAAc,YAAY,0BAA2B;AACtE,gBAAc,WAAW,aAAc,SAAS,aAAc;AAC9D,UAAQ,YAAa,aAAc;AACpC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|