@wordpress/dom 4.51.0 → 4.53.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/CHANGELOG.md +5 -0
- package/build/dom/clean-node-list.cjs.map +2 -2
- package/build/dom/compute-caret-rect.cjs.map +2 -2
- package/build/dom/document-has-selection.cjs.map +2 -2
- package/build/dom/document-has-text-selection.cjs.map +2 -2
- package/build/dom/document-has-uncollapsed-selection.cjs.map +2 -2
- package/build/dom/get-computed-style.cjs.map +2 -2
- package/build/dom/get-offset-parent.cjs.map +2 -2
- package/build/dom/get-rectangle-from-range.cjs.map +2 -2
- package/build/dom/get-scroll-container.cjs.map +2 -2
- package/build/dom/hidden-caret-range-from-point.cjs.map +2 -2
- package/build/dom/input-field-has-uncollapsed-selection.cjs.map +2 -2
- package/build/dom/insert-after.cjs.map +2 -2
- package/build/dom/is-edge.cjs +5 -0
- package/build/dom/is-edge.cjs.map +2 -2
- package/build/dom/is-entirely-selected.cjs.map +2 -2
- package/build/dom/is-form-element.cjs.map +2 -2
- package/build/dom/is-horizontal-edge.cjs.map +2 -2
- package/build/dom/is-number-input.cjs.map +2 -2
- package/build/dom/is-rtl.cjs.map +2 -2
- package/build/dom/is-selection-forward.cjs.map +2 -2
- package/build/dom/is-text-field.cjs.map +2 -2
- package/build/dom/is-vertical-edge.cjs.map +2 -2
- package/build/dom/place-caret-at-edge.cjs.map +2 -2
- package/build/dom/place-caret-at-horizontal-edge.cjs.map +2 -2
- package/build/dom/place-caret-at-vertical-edge.cjs.map +2 -2
- package/build/dom/remove-invalid-html.cjs.map +2 -2
- package/build/dom/remove.cjs.map +2 -2
- package/build/dom/replace-tag.cjs.map +2 -2
- package/build/dom/replace.cjs.map +2 -2
- package/build/dom/safe-html.cjs.map +2 -2
- package/build/dom/strip-html.cjs.map +2 -2
- package/build/dom/unwrap.cjs.map +2 -2
- package/build/dom/wrap.cjs.map +2 -2
- package/build/index.cjs.map +2 -2
- package/build/tabbable.cjs.map +2 -2
- package/build-module/dom/clean-node-list.mjs.map +2 -2
- package/build-module/dom/compute-caret-rect.mjs.map +2 -2
- package/build-module/dom/document-has-selection.mjs.map +2 -2
- package/build-module/dom/document-has-text-selection.mjs.map +2 -2
- package/build-module/dom/document-has-uncollapsed-selection.mjs.map +2 -2
- package/build-module/dom/get-computed-style.mjs.map +2 -2
- package/build-module/dom/get-offset-parent.mjs.map +2 -2
- package/build-module/dom/get-rectangle-from-range.mjs.map +2 -2
- package/build-module/dom/get-scroll-container.mjs.map +2 -2
- package/build-module/dom/hidden-caret-range-from-point.mjs.map +2 -2
- package/build-module/dom/input-field-has-uncollapsed-selection.mjs.map +2 -2
- package/build-module/dom/insert-after.mjs.map +2 -2
- package/build-module/dom/is-edge.mjs +5 -0
- package/build-module/dom/is-edge.mjs.map +2 -2
- package/build-module/dom/is-entirely-selected.mjs.map +2 -2
- package/build-module/dom/is-form-element.mjs.map +2 -2
- package/build-module/dom/is-horizontal-edge.mjs.map +2 -2
- package/build-module/dom/is-number-input.mjs.map +2 -2
- package/build-module/dom/is-rtl.mjs.map +2 -2
- package/build-module/dom/is-selection-forward.mjs.map +2 -2
- package/build-module/dom/is-text-field.mjs.map +2 -2
- package/build-module/dom/is-vertical-edge.mjs.map +2 -2
- package/build-module/dom/place-caret-at-edge.mjs.map +2 -2
- package/build-module/dom/place-caret-at-horizontal-edge.mjs.map +2 -2
- package/build-module/dom/place-caret-at-vertical-edge.mjs.map +2 -2
- package/build-module/dom/remove-invalid-html.mjs.map +2 -2
- package/build-module/dom/remove.mjs.map +2 -2
- package/build-module/dom/replace-tag.mjs.map +2 -2
- package/build-module/dom/replace.mjs.map +2 -2
- package/build-module/dom/safe-html.mjs.map +2 -2
- package/build-module/dom/strip-html.mjs.map +2 -2
- package/build-module/dom/unwrap.mjs.map +2 -2
- package/build-module/dom/wrap.mjs.map +2 -2
- package/build-module/index.mjs.map +2 -2
- package/build-module/tabbable.mjs.map +2 -2
- package/build-types/dom/clean-node-list.d.ts.map +1 -1
- package/build-types/dom/compute-caret-rect.d.ts.map +1 -1
- package/build-types/dom/document-has-selection.d.ts.map +1 -1
- package/build-types/dom/document-has-text-selection.d.ts.map +1 -1
- package/build-types/dom/document-has-uncollapsed-selection.d.ts.map +1 -1
- package/build-types/dom/get-computed-style.d.ts.map +1 -1
- package/build-types/dom/get-offset-parent.d.ts.map +1 -1
- package/build-types/dom/get-rectangle-from-range.d.ts.map +1 -1
- package/build-types/dom/get-scroll-container.d.ts.map +1 -1
- package/build-types/dom/hidden-caret-range-from-point.d.ts.map +1 -1
- package/build-types/dom/input-field-has-uncollapsed-selection.d.ts.map +1 -1
- package/build-types/dom/insert-after.d.ts.map +1 -1
- package/build-types/dom/is-edge.d.ts.map +1 -1
- package/build-types/dom/is-entirely-selected.d.ts.map +1 -1
- 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-number-input.d.ts.map +1 -1
- package/build-types/dom/is-rtl.d.ts.map +1 -1
- package/build-types/dom/is-selection-forward.d.ts.map +1 -1
- 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.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.map +1 -1
- package/build-types/dom/remove.d.ts.map +1 -1
- package/build-types/dom/replace-tag.d.ts.map +1 -1
- package/build-types/dom/replace.d.ts.map +1 -1
- package/build-types/dom/safe-html.d.ts.map +1 -1
- package/build-types/dom/strip-html.d.ts.map +1 -1
- package/build-types/dom/unwrap.d.ts.map +1 -1
- package/build-types/dom/wrap.d.ts.map +1 -1
- package/build-types/index.d.ts +0 -3
- package/build-types/index.d.ts.map +1 -1
- package/build-types/tabbable.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/dom/clean-node-list.js +0 -3
- package/src/dom/compute-caret-rect.js +0 -3
- package/src/dom/document-has-selection.js +0 -3
- package/src/dom/document-has-text-selection.js +0 -3
- package/src/dom/document-has-uncollapsed-selection.js +0 -3
- package/src/dom/get-computed-style.js +0 -3
- package/src/dom/get-offset-parent.js +0 -3
- package/src/dom/get-rectangle-from-range.js +0 -3
- package/src/dom/get-scroll-container.js +0 -3
- package/src/dom/hidden-caret-range-from-point.js +0 -3
- package/src/dom/input-field-has-uncollapsed-selection.js +0 -3
- package/src/dom/insert-after.js +0 -3
- package/src/dom/is-edge.js +26 -3
- package/src/dom/is-entirely-selected.js +0 -3
- package/src/dom/is-form-element.js +0 -3
- package/src/dom/is-horizontal-edge.js +0 -3
- package/src/dom/is-number-input.js +0 -7
- package/src/dom/is-rtl.js +0 -3
- package/src/dom/is-selection-forward.js +0 -3
- package/src/dom/is-text-field.js +0 -3
- package/src/dom/is-vertical-edge.js +0 -3
- package/src/dom/place-caret-at-edge.js +0 -3
- package/src/dom/place-caret-at-horizontal-edge.js +0 -3
- package/src/dom/place-caret-at-vertical-edge.js +0 -3
- package/src/dom/remove-invalid-html.js +0 -3
- package/src/dom/remove.js +0 -3
- package/src/dom/replace-tag.js +0 -3
- package/src/dom/replace.js +0 -3
- package/src/dom/safe-html.js +0 -3
- package/src/dom/strip-html.js +0 -3
- package/src/dom/test/safe-html.js +0 -3
- package/src/dom/test/strip-html.js +0 -3
- package/src/dom/unwrap.js +0 -3
- package/src/dom/wrap.js +0 -3
- package/src/index.js +0 -3
- package/src/tabbable.js +1 -4
- package/src/test/dom.js +0 -4
- package/src/test/focusable.js +0 -3
- package/src/test/tabbable.js +0 -3
- package/src/test/utils.js +0 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/dom/place-caret-at-edge.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";
|
|
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 {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\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,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;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,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/dom/place-caret-at-horizontal-edge.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";
|
|
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( container, isReverse ) {\n\treturn placeCaretAtEdge( container, isReverse, undefined );\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,OAAO,sBAAsB;AAQd,SAAR,2BAA6C,WAAW,WAAY;AAC1E,SAAO,iBAAkB,WAAW,WAAW,MAAU;AAC1D;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/dom/place-caret-at-vertical-edge.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";
|
|
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( container, isReverse, rect ) {\n\treturn placeCaretAtEdge( container, isReverse, rect?.left );\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,OAAO,sBAAsB;AASd,SAAR,yBAA2C,WAAW,WAAW,MAAO;AAC9E,SAAO,iBAAkB,WAAW,WAAW,MAAM,IAAK;AAC3D;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/dom/remove-invalid-html.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";
|
|
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} 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": ";AAAA,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
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/dom/remove.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";
|
|
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 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": ";AAAA,SAAS,uBAAuB;AAQjB,SAAR,OAAyB,MAAO;AACtC,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
3
|
"sources": ["../../src/dom/replace-tag.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";
|
|
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 {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": ";AAAA,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
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/dom/replace.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";
|
|
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 {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": ";AAAA,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
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/dom/safe-html.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["import 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": ";AAAA,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
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/dom/strip-html.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["import safeHTML from './safe-html';\n\n/**\n * Removes any HTML tags from the provided string.\n *\n * @param {string} html The string containing html.\n *\n * @return {string} The text content with any html removed.\n */\nexport default function stripHTML( html ) {\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,MAAO;AAGzC,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
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/dom/unwrap.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";
|
|
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} node The node to unwrap.\n *\n * @return {void}\n */\nexport default function unwrap( node ) {\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;AASjB,SAAR,OAAyB,MAAO;AACtC,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
3
|
"sources": ["../../src/dom/wrap.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";
|
|
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 {Element} newNode The node to insert.\n * @param {Element} referenceNode The node to wrap.\n */\nexport default function wrap( newNode, referenceNode ) {\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,SAAS,eAAgB;AACtD,kBAAiB,cAAc,YAAY,0BAA2B;AACtE,gBAAc,WAAW,aAAc,SAAS,aAAc;AAC9D,UAAQ,YAAa,aAAc;AACpC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["import * as focusable from './focusable';\nimport * as tabbable from './tabbable';\n\n/**\n * Object grouping `focusable` and `tabbable` utils\n * under the keys with the same name.\n */\nexport const focus = { focusable, tabbable };\n\nexport * from './dom';\nexport * from './phrasing-content';\nexport * from './data-transfer';\n"],
|
|
5
|
+
"mappings": ";AAAA,YAAY,eAAe;AAC3B,YAAY,cAAc;AAQ1B,cAAc;AACd,cAAc;AACd,cAAc;AAJP,IAAM,QAAQ,EAAE,WAAW,SAAS;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/tabbable.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["import { find as findFocusable } from './focusable';\n\n/**\n * Returns the tab index of the given element. In contrast with the tabIndex\n * property, this normalizes the default (0) to avoid browser inconsistencies,\n * operating under the assumption that this function is only ever called with a\n * focusable node.\n *\n * @see https://bugzilla.mozilla.org/show_bug.cgi?id=1190261\n *\n * @param {Element} element Element from which to retrieve.\n *\n * @return {number} Tab index of element (default 0).\n */\nfunction getTabIndex( element ) {\n\tconst tabIndex = element.getAttribute( 'tabindex' );\n\treturn tabIndex === null ? 0 : parseInt( tabIndex, 10 );\n}\n\n/**\n * Returns true if the specified element is tabbable, or false otherwise.\n *\n * @param {Element} element Element to test.\n *\n * @return {boolean} Whether element is tabbable.\n */\nexport function isTabbableIndex( element ) {\n\treturn getTabIndex( element ) !== -1;\n}\n\n/** @typedef {HTMLElement & { type?: string, checked?: boolean, name?: string }} MaybeHTMLInputElement */\n\n/**\n * Returns a stateful reducer function which constructs a filtered array of\n * tabbable elements, where at most one radio input is selected for a given\n * name, giving priority to checked input, falling back to the first\n * encountered.\n *\n * @return {(acc: MaybeHTMLInputElement[], el: MaybeHTMLInputElement) => MaybeHTMLInputElement[]} Radio group collapse reducer.\n */\nfunction createStatefulCollapseRadioGroup() {\n\t/** @type {Record<string, MaybeHTMLInputElement>} */\n\tconst CHOSEN_RADIO_BY_NAME = {};\n\n\treturn function collapseRadioGroup(\n\t\t/** @type {MaybeHTMLInputElement[]} */ result,\n\t\t/** @type {MaybeHTMLInputElement} */ element\n\t) {\n\t\tconst { nodeName, type, checked, name } = element;\n\n\t\t// For all non-radio tabbables, construct to array by concatenating.\n\t\tif ( nodeName !== 'INPUT' || type !== 'radio' || ! name ) {\n\t\t\treturn result.concat( element );\n\t\t}\n\n\t\tconst hasChosen = CHOSEN_RADIO_BY_NAME.hasOwnProperty( name );\n\n\t\t// Omit by skipping concatenation if the radio element is not chosen.\n\t\tconst isChosen = checked || ! hasChosen;\n\t\tif ( ! isChosen ) {\n\t\t\treturn result;\n\t\t}\n\n\t\t// At this point, if there had been a chosen element, the current\n\t\t// element is checked and should take priority. Retroactively remove\n\t\t// the element which had previously been considered the chosen one.\n\t\tif ( hasChosen ) {\n\t\t\tconst hadChosenElement = CHOSEN_RADIO_BY_NAME[ name ];\n\t\t\tresult = result.filter( ( e ) => e !== hadChosenElement );\n\t\t}\n\n\t\tCHOSEN_RADIO_BY_NAME[ name ] = element;\n\n\t\treturn result.concat( element );\n\t};\n}\n\n/**\n * An array map callback, returning an object with the element value and its\n * array index location as properties. This is used to emulate a proper stable\n * sort where equal tabIndex should be left in order of their occurrence in the\n * document.\n *\n * @param {HTMLElement} element Element.\n * @param {number} index Array index of element.\n *\n * @return {{ element: HTMLElement, index: number }} Mapped object with element, index.\n */\nfunction mapElementToObjectTabbable( element, index ) {\n\treturn { element, index };\n}\n\n/**\n * An array map callback, returning an element of the given mapped object's\n * element value.\n *\n * @param {{ element: HTMLElement }} object Mapped object with element.\n *\n * @return {HTMLElement} Mapped object element.\n */\nfunction mapObjectTabbableToElement( object ) {\n\treturn object.element;\n}\n\n/**\n * A sort comparator function used in comparing two objects of mapped elements.\n *\n * @see mapElementToObjectTabbable\n *\n * @param {{ element: HTMLElement, index: number }} a First object to compare.\n * @param {{ element: HTMLElement, index: number }} b Second object to compare.\n *\n * @return {number} Comparator result.\n */\nfunction compareObjectTabbables( a, b ) {\n\tconst aTabIndex = getTabIndex( a.element );\n\tconst bTabIndex = getTabIndex( b.element );\n\n\tif ( aTabIndex === bTabIndex ) {\n\t\treturn a.index - b.index;\n\t}\n\n\treturn aTabIndex - bTabIndex;\n}\n\n/**\n * Given focusable elements, filters out tabbable element.\n *\n * @param {HTMLElement[]} focusables Focusable elements to filter.\n *\n * @return {HTMLElement[]} Tabbable elements.\n */\nfunction filterTabbable( focusables ) {\n\treturn focusables\n\t\t.filter( isTabbableIndex )\n\t\t.map( mapElementToObjectTabbable )\n\t\t.sort( compareObjectTabbables )\n\t\t.map( mapObjectTabbableToElement )\n\t\t.reduce( createStatefulCollapseRadioGroup(), [] );\n}\n\n/**\n * @param {Element} context\n * @return {HTMLElement[]} Tabbable elements within the context.\n */\nexport function find( context ) {\n\treturn filterTabbable( findFocusable( context ) );\n}\n\n/**\n * Given a focusable element, find the preceding tabbable element.\n *\n * @param {Element} element The focusable element before which to look. Defaults\n * to the active element.\n *\n * @return {HTMLElement|undefined} Preceding tabbable element.\n */\nexport function findPrevious( element ) {\n\treturn filterTabbable( findFocusable( element.ownerDocument.body ) )\n\t\t.reverse()\n\t\t.find(\n\t\t\t( focusable ) =>\n\t\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\t\telement.compareDocumentPosition( focusable ) &\n\t\t\t\telement.DOCUMENT_POSITION_PRECEDING\n\t\t);\n}\n\n/**\n * Given a focusable element, find the next tabbable element.\n *\n * @param {Element} element The focusable element after which to look. Defaults\n * to the active element.\n *\n * @return {HTMLElement|undefined} Next tabbable element.\n */\nexport function findNext( element ) {\n\treturn filterTabbable( findFocusable( element.ownerDocument.body ) ).find(\n\t\t( focusable ) =>\n\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\telement.compareDocumentPosition( focusable ) &\n\t\t\telement.DOCUMENT_POSITION_FOLLOWING\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,QAAQ,qBAAqB;AActC,SAAS,YAAa,SAAU;AAC/B,QAAM,WAAW,QAAQ,aAAc,UAAW;AAClD,SAAO,aAAa,OAAO,IAAI,SAAU,UAAU,EAAG;AACvD;AASO,SAAS,gBAAiB,SAAU;AAC1C,SAAO,YAAa,OAAQ,MAAM;AACnC;AAYA,SAAS,mCAAmC;AAE3C,QAAM,uBAAuB,CAAC;AAE9B,SAAO,SAAS,mBACwB,QACF,SACpC;AACD,UAAM,EAAE,UAAU,MAAM,SAAS,KAAK,IAAI;AAG1C,QAAK,aAAa,WAAW,SAAS,WAAW,CAAE,MAAO;AACzD,aAAO,OAAO,OAAQ,OAAQ;AAAA,IAC/B;AAEA,UAAM,YAAY,qBAAqB,eAAgB,IAAK;AAG5D,UAAM,WAAW,WAAW,CAAE;AAC9B,QAAK,CAAE,UAAW;AACjB,aAAO;AAAA,IACR;AAKA,QAAK,WAAY;AAChB,YAAM,mBAAmB,qBAAsB,IAAK;AACpD,eAAS,OAAO,OAAQ,CAAE,MAAO,MAAM,gBAAiB;AAAA,IACzD;AAEA,yBAAsB,IAAK,IAAI;AAE/B,WAAO,OAAO,OAAQ,OAAQ;AAAA,EAC/B;AACD;AAaA,SAAS,2BAA4B,SAAS,OAAQ;AACrD,SAAO,EAAE,SAAS,MAAM;AACzB;AAUA,SAAS,2BAA4B,QAAS;AAC7C,SAAO,OAAO;AACf;AAYA,SAAS,uBAAwB,GAAG,GAAI;AACvC,QAAM,YAAY,YAAa,EAAE,OAAQ;AACzC,QAAM,YAAY,YAAa,EAAE,OAAQ;AAEzC,MAAK,cAAc,WAAY;AAC9B,WAAO,EAAE,QAAQ,EAAE;AAAA,EACpB;AAEA,SAAO,YAAY;AACpB;AASA,SAAS,eAAgB,YAAa;AACrC,SAAO,WACL,OAAQ,eAAgB,EACxB,IAAK,0BAA2B,EAChC,KAAM,sBAAuB,EAC7B,IAAK,0BAA2B,EAChC,OAAQ,iCAAiC,GAAG,CAAC,CAAE;AAClD;AAMO,SAAS,KAAM,SAAU;AAC/B,SAAO,eAAgB,cAAe,OAAQ,CAAE;AACjD;AAUO,SAAS,aAAc,SAAU;AACvC,SAAO,eAAgB,cAAe,QAAQ,cAAc,IAAK,CAAE,EACjE,QAAQ,EACR;AAAA,IACA,CAAE;AAAA;AAAA,MAED,QAAQ,wBAAyB,SAAU,IAC3C,QAAQ;AAAA;AAAA,EACV;AACF;AAUO,SAAS,SAAU,SAAU;AACnC,SAAO,eAAgB,cAAe,QAAQ,cAAc,IAAK,CAAE,EAAE;AAAA,IACpE,CAAE;AAAA;AAAA,MAED,QAAQ,wBAAyB,SAAU,IAC3C,QAAQ;AAAA;AAAA,EACV;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clean-node-list.d.ts","sourceRoot":"","sources":["../../src/dom/clean-node-list.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"clean-node-list.d.ts","sourceRoot":"","sources":["../../src/dom/clean-node-list.js"],"names":[],"mappings":"AAUG,YAAS,UAAU,GACnB;;;;IAAiD,UAAU,AAA3D,CACA,EADW,MAAM,EAAE,CACnB;;;;IAAiD,OAAO,AAAxD,CACA,EADW,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAC9B;;;;IAAiD,QAAQ,AAAzD,CACA,EADW,GAAG,GAAG;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAAA;KAAE,CAC9C;;;;IAAiD,OAAO,AAAxD,CACA,EADW,MAAM,EAAE,CACnB;;;;IAAgD,UAAU,EAA/C,OAAO,CAClB;;;;IAAiD,OAAO,AAAxD,CACF,EADa,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CACpC;CAAA,CAAA;AAEG,YAAyC,MAAM,GAArC;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAAA;CAAE,CAAQ;AAVnD;;;;;;;;GAQG;AAEH,sDAAsD;AAEtD;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAE,QAAQ,EALpC,QAKoC,EAAE,GAAG,EAJzC,QAIyC,EAAE,MAAM,EAHjD,MAGiD,EAAE,MAAM,EAFzD,OAEyD,QAyJnE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compute-caret-rect.d.ts","sourceRoot":"","sources":["../../src/dom/compute-caret-rect.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"compute-caret-rect.d.ts","sourceRoot":"","sources":["../../src/dom/compute-caret-rect.js"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAE,GAAG,EAJlC,MAIkC,GAFjC,OAAO,GAAG,IAAI,CAYzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document-has-selection.d.ts","sourceRoot":"","sources":["../../src/dom/document-has-selection.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"document-has-selection.d.ts","sourceRoot":"","sources":["../../src/dom/document-has-selection.js"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAE,GAAG,EAJtC,QAIsC,GAFrC,OAAO,CASlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document-has-text-selection.d.ts","sourceRoot":"","sources":["../../src/dom/document-has-text-selection.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"document-has-text-selection.d.ts","sourceRoot":"","sources":["../../src/dom/document-has-text-selection.js"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAE,GAAG,EAJ1C,QAI0C,GAFzC,OAAO,CAQlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document-has-uncollapsed-selection.d.ts","sourceRoot":"","sources":["../../src/dom/document-has-uncollapsed-selection.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"document-has-uncollapsed-selection.d.ts","sourceRoot":"","sources":["../../src/dom/document-has-uncollapsed-selection.js"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,+BAA+B,CAAE,GAAG,EAJjD,QAIiD,GAFhD,OAAO,CAQlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-computed-style.d.ts","sourceRoot":"","sources":["../../src/dom/get-computed-style.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-computed-style.d.ts","sourceRoot":"","sources":["../../src/dom/get-computed-style.js"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAE,OAAO,EAHtC,OAGsC,GAFrC,UAAU,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAQjD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-offset-parent.d.ts","sourceRoot":"","sources":["../../src/dom/get-offset-parent.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-offset-parent.d.ts","sourceRoot":"","sources":["../../src/dom/get-offset-parent.js"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAE,IAAI,EAJlC,IAIkC,GAFjC,IAAI,GAAG,IAAI,CA4BtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-rectangle-from-range.d.ts","sourceRoot":"","sources":["../../src/dom/get-rectangle-from-range.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-rectangle-from-range.d.ts","sourceRoot":"","sources":["../../src/dom/get-rectangle-from-range.js"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAE,KAAK,EAJzC,KAIyC,GAFxC,OAAO,OAAC,CAoGnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-scroll-container.d.ts","sourceRoot":"","sources":["../../src/dom/get-scroll-container.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-scroll-container.d.ts","sourceRoot":"","sources":["../../src/dom/get-scroll-container.js"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAE,IAAI,EALrC,OAAO,GAAG,IAK2B,EAAE,SAAS,GAJ/C,MAAM,OAIsD,GAF5D,OAAO,GAAG,SAAS,CAwC9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hidden-caret-range-from-point.d.ts","sourceRoot":"","sources":["../../src/dom/hidden-caret-range-from-point.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hidden-caret-range-from-point.d.ts","sourceRoot":"","sources":["../../src/dom/hidden-caret-range-from-point.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAAE,GAAG,EAP3C,QAO2C,EAAE,CAAC,EAN9C,MAM8C,EAAE,CAAC,EALjD,MAKiD,EAAE,SAAS,EAJ5D,WAI4D,GAF1D,KAAK,OAAA,CA6BjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-field-has-uncollapsed-selection.d.ts","sourceRoot":"","sources":["../../src/dom/input-field-has-uncollapsed-selection.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"input-field-has-uncollapsed-selection.d.ts","sourceRoot":"","sources":["../../src/dom/input-field-has-uncollapsed-selection.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,OAAO,UAAU,iCAAiC,CAAE,OAAO,EAJvD,OAIuD,GAFtD,OAAO,CA0BlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insert-after.d.ts","sourceRoot":"","sources":["../../src/dom/insert-after.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"insert-after.d.ts","sourceRoot":"","sources":["../../src/dom/insert-after.js"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAE,OAAO,EAJjC,IAIiC,EAAE,aAAa,EAHhD,IAGgD,GAF/C,IAAI,CAKf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-edge.d.ts","sourceRoot":"","sources":["../../src/dom/is-edge.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"is-edge.d.ts","sourceRoot":"","sources":["../../src/dom/is-edge.js"],"names":[],"mappings":"AASA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAE,SAAS,EAN9B,WAM8B,EAAE,SAAS,EALzC,OAKyC,EAAE,YAAY,AAJ/D,CAEA,EAFQ,OAI+D,GAF9D,OAAO,CAmIlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-entirely-selected.d.ts","sourceRoot":"","sources":["../../src/dom/is-entirely-selected.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"is-entirely-selected.d.ts","sourceRoot":"","sources":["../../src/dom/is-entirely-selected.js"],"names":[],"mappings":"AASA;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAE,OAAO,EAJxC,WAIwC,GAFvC,OAAO,CAyDlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-form-element.d.ts","sourceRoot":"","sources":["../../src/dom/is-form-element.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"is-form-element.d.ts","sourceRoot":"","sources":["../../src/dom/is-form-element.js"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAE,OAAO,EAJnC,OAImC,GAFlC,OAAO,CAYlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-horizontal-edge.d.ts","sourceRoot":"","sources":["../../src/dom/is-horizontal-edge.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"is-horizontal-edge.d.ts","sourceRoot":"","sources":["../../src/dom/is-horizontal-edge.js"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAE,SAAS,EALxC,WAKwC,EAAE,SAAS,EAJnD,OAImD,GAFlD,OAAO,CAIlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-number-input.d.ts","sourceRoot":"","sources":["../../src/dom/is-number-input.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"is-number-input.d.ts","sourceRoot":"","sources":["../../src/dom/is-number-input.js"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAE,IAAI,EAJhC,IAIgC,GAF/B,IAAI,IAAI,gBAAgB,CAYnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-rtl.d.ts","sourceRoot":"","sources":["../../src/dom/is-rtl.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"is-rtl.d.ts","sourceRoot":"","sources":["../../src/dom/is-rtl.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,KAAK,CAAE,OAAO,EAJ3B,OAI2B,GAF1B,OAAO,CAIlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-selection-forward.d.ts","sourceRoot":"","sources":["../../src/dom/is-selection-forward.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"is-selection-forward.d.ts","sourceRoot":"","sources":["../../src/dom/is-selection-forward.js"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAE,SAAS,EAJ1C,SAI0C,GAFzC,OAAO,CA+BlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-text-field.d.ts","sourceRoot":"","sources":["../../src/dom/is-text-field.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"is-text-field.d.ts","sourceRoot":"","sources":["../../src/dom/is-text-field.js"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAE,IAAI,EAH9B,IAG8B,GAF7B,IAAI,IAAI,WAAW,CAwB9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-vertical-edge.d.ts","sourceRoot":"","sources":["../../src/dom/is-vertical-edge.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"is-vertical-edge.d.ts","sourceRoot":"","sources":["../../src/dom/is-vertical-edge.js"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAE,SAAS,EALtC,WAKsC,EAAE,SAAS,EAJjD,OAIiD,GAFhD,OAAO,CAIlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"place-caret-at-edge.d.ts","sourceRoot":"","sources":["../../src/dom/place-caret-at-edge.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"place-caret-at-edge.d.ts","sourceRoot":"","sources":["../../src/dom/place-caret-at-edge.js"],"names":[],"mappings":"AAmCA;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAE,SAAS,EAJxC,WAIwC,EAAE,SAAS,EAHnD,OAGmD,EAAE,CAAC,EAFtD,MAAM,GAAC,SAE+C,QA+ChE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"place-caret-at-horizontal-edge.d.ts","sourceRoot":"","sources":["../../src/dom/place-caret-at-horizontal-edge.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"place-caret-at-horizontal-edge.d.ts","sourceRoot":"","sources":["../../src/dom/place-caret-at-horizontal-edge.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,0BAA0B,CAAE,SAAS,EAHlD,WAGkD,EAAE,SAAS,EAF7D,OAE6D,QAEvE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"place-caret-at-vertical-edge.d.ts","sourceRoot":"","sources":["../../src/dom/place-caret-at-vertical-edge.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"place-caret-at-vertical-edge.d.ts","sourceRoot":"","sources":["../../src/dom/place-caret-at-vertical-edge.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAE,SAAS,EAJhD,WAIgD,EAAE,SAAS,EAH3D,OAG2D,EAAE,IAAI,AAFzE,CACF,EADU,OAEiE,QAE3E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove-invalid-html.d.ts","sourceRoot":"","sources":["../../src/dom/remove-invalid-html.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"remove-invalid-html.d.ts","sourceRoot":"","sources":["../../src/dom/remove-invalid-html.js"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAE,IAAI,EANpC,MAMoC,EAAE,MAAM,EAL5C,OAAO,mBAAmB,EAAE,MAKgB,EAAE,MAAM,EAJpD,OAIoD,GAFnD,MAAM,CAUjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove.d.ts","sourceRoot":"","sources":["../../src/dom/remove.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"remove.d.ts","sourceRoot":"","sources":["../../src/dom/remove.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAE,IAAI,EAHzB,IAGyB,GAFxB,IAAI,CAKf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replace-tag.d.ts","sourceRoot":"","sources":["../../src/dom/replace-tag.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"replace-tag.d.ts","sourceRoot":"","sources":["../../src/dom/replace-tag.js"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAE,IAAI,EAL7B,OAK6B,EAAE,OAAO,EAJtC,MAIsC,GAFrC,OAAO,CAalB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replace.d.ts","sourceRoot":"","sources":["../../src/dom/replace.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"replace.d.ts","sourceRoot":"","sources":["../../src/dom/replace.js"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO,CAAE,aAAa,EAJnC,OAImC,EAAE,OAAO,EAH5C,OAG4C,GAF3C,IAAI,CAMf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safe-html.d.ts","sourceRoot":"","sources":["../../src/dom/safe-html.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"safe-html.d.ts","sourceRoot":"","sources":["../../src/dom/safe-html.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAE,IAAI,EAJ3B,MAI2B,GAF1B,MAAM,CA2BjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strip-html.d.ts","sourceRoot":"","sources":["../../src/dom/strip-html.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"strip-html.d.ts","sourceRoot":"","sources":["../../src/dom/strip-html.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAE,IAAI,EAJ5B,MAI4B,GAF3B,MAAM,CAUjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unwrap.d.ts","sourceRoot":"","sources":["../../src/dom/unwrap.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"unwrap.d.ts","sourceRoot":"","sources":["../../src/dom/unwrap.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAE,IAAI,EAJzB,IAIyB,GAFxB,IAAI,CAYf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrap.d.ts","sourceRoot":"","sources":["../../src/dom/wrap.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"wrap.d.ts","sourceRoot":"","sources":["../../src/dom/wrap.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,IAAI,CAAE,OAAO,EAH1B,OAG0B,EAAE,aAAa,EAFzC,OAEyC,QAInD"}
|
package/build-types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AAEvC;;;GAGG;AACH,eAAO,MAAM,KAAK;;;CAA0B,CAAC;AAE7C,cAAc,OAAO,CAAC;AACtB,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabbable.d.ts","sourceRoot":"","sources":["../src/tabbable.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tabbable.d.ts","sourceRoot":"","sources":["../src/tabbable.js"],"names":[],"mappings":"AAmBA;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAE,OAAO,EAJ7B,OAI6B,GAF5B,OAAO,CAIlB;AAEG,YAA6E,qBAAqB,GAAxF,WAAW,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAuB;AA+GtG;;;GAGG;AACH,wBAAgB,IAAI,CAAE,OAAO,EAHlB,OAGkB,GAFjB,WAAW,EAAE,CAIxB;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAE,OAAO,EAL1B,OAK0B,GAFzB,WAAW,GAAC,SAAS,CAWhC;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAE,OAAO,EALtB,OAKsB,GAFrB,WAAW,GAAC,SAAS,CAShC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/dom",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.53.0",
|
|
4
4
|
"description": "DOM utilities module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
"types": "build-types",
|
|
45
45
|
"sideEffects": false,
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@wordpress/deprecated": "^4.
|
|
47
|
+
"@wordpress/deprecated": "^4.53.0"
|
|
48
48
|
},
|
|
49
49
|
"publishConfig": {
|
|
50
50
|
"access": "public"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "989764d42ff93e33684aaf0b96a5b7f3d9bbff52"
|
|
53
53
|
}
|
package/src/dom/insert-after.js
CHANGED
package/src/dom/is-edge.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal dependencies
|
|
3
|
-
*/
|
|
4
1
|
import isRTL from './is-rtl';
|
|
5
2
|
import getRangeHeight from './get-range-height';
|
|
6
3
|
import getRectangleFromRange from './get-rectangle-from-range';
|
|
@@ -97,6 +94,32 @@ export default function isEdge( container, isReverse, onlyVertical = false ) {
|
|
|
97
94
|
// pixels. `getComputedStyle` may return a value with different units.
|
|
98
95
|
const x = isReverseDir ? containerRect.left + 1 : containerRect.right - 1;
|
|
99
96
|
const y = isReverse ? containerRect.top + 1 : containerRect.bottom - 1;
|
|
97
|
+
|
|
98
|
+
// The test point can only be hit-tested when it is within the viewport
|
|
99
|
+
// (`caretRangeFromPoint` returns nothing for a point outside it, upon
|
|
100
|
+
// which `scrollIfNoRange` scrolls the container's edge into view to
|
|
101
|
+
// measure, e.g. on every arrow press within a container taller than the
|
|
102
|
+
// viewport). When the edge is outside the viewport and the selection is
|
|
103
|
+
// within it, they are at least a viewport boundary apart along that
|
|
104
|
+
// axis, so the selection cannot be at the edge. Check each axis
|
|
105
|
+
// separately: the vertical check must not be short-circuited by a
|
|
106
|
+
// horizontally overflowing container, and vice versa.
|
|
107
|
+
const isFarFromVerticalEdge =
|
|
108
|
+
( y < 0 || y > defaultView.innerHeight ) &&
|
|
109
|
+
rangeRect.top >= 0 &&
|
|
110
|
+
rangeRect.bottom <= defaultView.innerHeight;
|
|
111
|
+
const isFarFromHorizontalEdge =
|
|
112
|
+
( x < 0 || x > defaultView.innerWidth ) &&
|
|
113
|
+
rangeRect.left >= 0 &&
|
|
114
|
+
rangeRect.right <= defaultView.innerWidth;
|
|
115
|
+
|
|
116
|
+
if (
|
|
117
|
+
isFarFromVerticalEdge ||
|
|
118
|
+
( ! onlyVertical && isFarFromHorizontalEdge )
|
|
119
|
+
) {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
|
|
100
123
|
const testRange = scrollIfNoRange( container, isReverse, () =>
|
|
101
124
|
hiddenCaretRangeFromPoint( ownerDocument, x, y, container )
|
|
102
125
|
);
|