diff -r be944660c56a -r 3d72ae0968f4 wp/wp-includes/js/dist/dom.js --- a/wp/wp-includes/js/dist/dom.js Wed Sep 21 18:19:35 2022 +0200 +++ b/wp/wp-includes/js/dist/dom.js Tue Sep 27 16:37:53 2022 +0200 @@ -1,145 +1,95 @@ -this["wp"] = this["wp"] || {}; this["wp"]["dom"] = -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} +/******/ (function() { // webpackBootstrap +/******/ "use strict"; +/******/ // The require scope +/******/ var __webpack_require__ = {}; +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/define property getters */ +/******/ !function() { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = function(exports, definition) { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } /******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = "2sUP"); -/******/ }) +/******/ }(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ !function() { +/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } +/******/ }(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ !function() { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ }(); +/******/ /************************************************************************/ -/******/ ({ - -/***/ "2sUP": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; +var __webpack_exports__ = {}; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS -__webpack_require__.d(__webpack_exports__, "focus", function() { return /* binding */ build_module_focus; }); -__webpack_require__.d(__webpack_exports__, "computeCaretRect", function() { return /* reexport */ computeCaretRect; }); -__webpack_require__.d(__webpack_exports__, "documentHasTextSelection", function() { return /* reexport */ documentHasTextSelection; }); -__webpack_require__.d(__webpack_exports__, "documentHasUncollapsedSelection", function() { return /* reexport */ documentHasUncollapsedSelection; }); -__webpack_require__.d(__webpack_exports__, "documentHasSelection", function() { return /* reexport */ documentHasSelection; }); -__webpack_require__.d(__webpack_exports__, "getRectangleFromRange", function() { return /* reexport */ getRectangleFromRange; }); -__webpack_require__.d(__webpack_exports__, "getScrollContainer", function() { return /* reexport */ getScrollContainer; }); -__webpack_require__.d(__webpack_exports__, "getOffsetParent", function() { return /* reexport */ getOffsetParent; }); -__webpack_require__.d(__webpack_exports__, "isEntirelySelected", function() { return /* reexport */ isEntirelySelected; }); -__webpack_require__.d(__webpack_exports__, "isHorizontalEdge", function() { return /* reexport */ isHorizontalEdge; }); -__webpack_require__.d(__webpack_exports__, "isNumberInput", function() { return /* reexport */ isNumberInput; }); -__webpack_require__.d(__webpack_exports__, "isTextField", function() { return /* reexport */ isTextField; }); -__webpack_require__.d(__webpack_exports__, "isVerticalEdge", function() { return /* reexport */ isVerticalEdge; }); -__webpack_require__.d(__webpack_exports__, "placeCaretAtHorizontalEdge", function() { return /* reexport */ placeCaretAtHorizontalEdge; }); -__webpack_require__.d(__webpack_exports__, "placeCaretAtVerticalEdge", function() { return /* reexport */ placeCaretAtVerticalEdge; }); -__webpack_require__.d(__webpack_exports__, "replace", function() { return /* reexport */ replace; }); -__webpack_require__.d(__webpack_exports__, "remove", function() { return /* reexport */ remove; }); -__webpack_require__.d(__webpack_exports__, "insertAfter", function() { return /* reexport */ insertAfter; }); -__webpack_require__.d(__webpack_exports__, "unwrap", function() { return /* reexport */ unwrap; }); -__webpack_require__.d(__webpack_exports__, "replaceTag", function() { return /* reexport */ replaceTag; }); -__webpack_require__.d(__webpack_exports__, "wrap", function() { return /* reexport */ wrap; }); -__webpack_require__.d(__webpack_exports__, "__unstableStripHTML", function() { return /* reexport */ stripHTML; }); -__webpack_require__.d(__webpack_exports__, "isEmpty", function() { return /* reexport */ isEmpty; }); -__webpack_require__.d(__webpack_exports__, "removeInvalidHTML", function() { return /* reexport */ removeInvalidHTML; }); -__webpack_require__.d(__webpack_exports__, "isRTL", function() { return /* reexport */ isRTL; }); -__webpack_require__.d(__webpack_exports__, "safeHTML", function() { return /* reexport */ safeHTML; }); -__webpack_require__.d(__webpack_exports__, "getPhrasingContentSchema", function() { return /* reexport */ getPhrasingContentSchema; }); -__webpack_require__.d(__webpack_exports__, "isPhrasingContent", function() { return /* reexport */ isPhrasingContent; }); -__webpack_require__.d(__webpack_exports__, "isTextContent", function() { return /* reexport */ isTextContent; }); -__webpack_require__.d(__webpack_exports__, "getFilesFromDataTransfer", function() { return /* reexport */ getFilesFromDataTransfer; }); +__webpack_require__.d(__webpack_exports__, { + "__unstableStripHTML": function() { return /* reexport */ stripHTML; }, + "computeCaretRect": function() { return /* reexport */ computeCaretRect; }, + "documentHasSelection": function() { return /* reexport */ documentHasSelection; }, + "documentHasTextSelection": function() { return /* reexport */ documentHasTextSelection; }, + "documentHasUncollapsedSelection": function() { return /* reexport */ documentHasUncollapsedSelection; }, + "focus": function() { return /* binding */ build_module_focus; }, + "getFilesFromDataTransfer": function() { return /* reexport */ getFilesFromDataTransfer; }, + "getOffsetParent": function() { return /* reexport */ getOffsetParent; }, + "getPhrasingContentSchema": function() { return /* reexport */ getPhrasingContentSchema; }, + "getRectangleFromRange": function() { return /* reexport */ getRectangleFromRange; }, + "getScrollContainer": function() { return /* reexport */ getScrollContainer; }, + "insertAfter": function() { return /* reexport */ insertAfter; }, + "isEmpty": function() { return /* reexport */ isEmpty; }, + "isEntirelySelected": function() { return /* reexport */ isEntirelySelected; }, + "isFormElement": function() { return /* reexport */ isFormElement; }, + "isHorizontalEdge": function() { return /* reexport */ isHorizontalEdge; }, + "isNumberInput": function() { return /* reexport */ isNumberInput; }, + "isPhrasingContent": function() { return /* reexport */ isPhrasingContent; }, + "isRTL": function() { return /* reexport */ isRTL; }, + "isTextContent": function() { return /* reexport */ isTextContent; }, + "isTextField": function() { return /* reexport */ isTextField; }, + "isVerticalEdge": function() { return /* reexport */ isVerticalEdge; }, + "placeCaretAtHorizontalEdge": function() { return /* reexport */ placeCaretAtHorizontalEdge; }, + "placeCaretAtVerticalEdge": function() { return /* reexport */ placeCaretAtVerticalEdge; }, + "remove": function() { return /* reexport */ remove; }, + "removeInvalidHTML": function() { return /* reexport */ removeInvalidHTML; }, + "replace": function() { return /* reexport */ replace; }, + "replaceTag": function() { return /* reexport */ replaceTag; }, + "safeHTML": function() { return /* reexport */ safeHTML; }, + "unwrap": function() { return /* reexport */ unwrap; }, + "wrap": function() { return /* reexport */ wrap; } +}); // NAMESPACE OBJECT: ./node_modules/@wordpress/dom/build-module/focusable.js var focusable_namespaceObject = {}; __webpack_require__.r(focusable_namespaceObject); -__webpack_require__.d(focusable_namespaceObject, "find", function() { return find; }); +__webpack_require__.d(focusable_namespaceObject, { + "find": function() { return find; } +}); // NAMESPACE OBJECT: ./node_modules/@wordpress/dom/build-module/tabbable.js var tabbable_namespaceObject = {}; __webpack_require__.r(tabbable_namespaceObject); -__webpack_require__.d(tabbable_namespaceObject, "isTabbableIndex", function() { return isTabbableIndex; }); -__webpack_require__.d(tabbable_namespaceObject, "find", function() { return tabbable_find; }); -__webpack_require__.d(tabbable_namespaceObject, "findPrevious", function() { return findPrevious; }); -__webpack_require__.d(tabbable_namespaceObject, "findNext", function() { return findNext; }); +__webpack_require__.d(tabbable_namespaceObject, { + "find": function() { return tabbable_find; }, + "findNext": function() { return findNext; }, + "findPrevious": function() { return findPrevious; }, + "isTabbableIndex": function() { return isTabbableIndex; } +}); -// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/focusable.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/focusable.js /** * References: * @@ -158,7 +108,21 @@ * AREA elements associated with an IMG: * - https://w3c.github.io/html/editing.html#data-model */ -const SELECTOR = ['[tabindex]', 'a[href]', 'button:not([disabled])', 'input:not([type="hidden"]):not([disabled])', 'select:not([disabled])', 'textarea:not([disabled])', 'iframe', 'object', 'embed', 'area[href]', '[contenteditable]:not([contenteditable=false])'].join(','); + +/** + * Returns a CSS selector used to query for focusable elements. + * + * @param {boolean} sequential If set, only query elements that are sequentially + * focusable. Non-interactive elements with a + * negative `tabindex` are focusable but not + * sequentially focusable. + * https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute + * + * @return {string} CSS selector. + */ +function buildSelector(sequential) { + return [sequential ? '[tabindex]:not([tabindex^="-"])' : '[tabindex]', 'a[href]', 'button:not([disabled])', 'input:not([type="hidden"]):not([disabled])', 'select:not([disabled])', 'textarea:not([disabled])', 'iframe:not([tabindex^="-"])', 'object', 'embed', 'area[href]', '[contenteditable]:not([contenteditable=false])'].join(','); +} /** * Returns true if the specified element is visible (i.e. neither display: none * nor visibility: hidden). @@ -168,23 +132,11 @@ * @return {boolean} Whether element is visible. */ + function isVisible(element) { return element.offsetWidth > 0 || element.offsetHeight > 0 || element.getClientRects().length > 0; } /** - * Returns true if the specified element should be skipped from focusable elements. - * For now it rather specific for `iframes` and if tabindex attribute is set to -1. - * - * @param {Element} element DOM element to test. - * - * @return {boolean} Whether element should be skipped from focusable elements. - */ - - -function skipFocus(element) { - return element.nodeName.toLowerCase() === 'iframe' && element.getAttribute('tabindex') === '-1'; -} -/** * Returns true if the specified area element is a valid focusable element, or * false otherwise. Area is only focusable if within a map where a named map * referenced by an image somewhere in the document. @@ -211,21 +163,32 @@ /** * Returns all focusable elements within a given context. * - * @param {Element} context Element in which to search. + * @param {Element} context Element in which to search. + * @param {Object} [options] + * @param {boolean} [options.sequential] If set, only return elements that are + * sequentially focusable. + * Non-interactive elements with a + * negative `tabindex` are focusable but + * not sequentially focusable. + * https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute * * @return {Element[]} Focusable elements. */ function find(context) { + let { + sequential = false + } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + /* eslint-disable jsdoc/no-undefined-types */ /** @type {NodeListOf} */ /* eslint-enable jsdoc/no-undefined-types */ - const elements = context.querySelectorAll(SELECTOR); + const elements = context.querySelectorAll(buildSelector(sequential)); return Array.from(elements).filter(element => { - if (!isVisible(element) || skipFocus(element)) { + if (!isVisible(element)) { return false; } @@ -243,10 +206,9 @@ }); } -// EXTERNAL MODULE: external "lodash" -var external_lodash_ = __webpack_require__("YLtl"); - -// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/tabbable.js +;// CONCATENATED MODULE: external "lodash" +var external_lodash_namespaceObject = window["lodash"]; +;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/tabbable.js /** * External dependencies */ @@ -328,7 +290,7 @@ if (hasChosen) { const hadChosenElement = CHOSEN_RADIO_BY_NAME[name]; - result = Object(external_lodash_["without"])(result, hadChosenElement); + result = (0,external_lodash_namespaceObject.without)(result, hadChosenElement); } CHOSEN_RADIO_BY_NAME[name] = element; @@ -415,14 +377,21 @@ * * @param {Element} element The focusable element before which to look. Defaults * to the active element. + * + * @return {Element|undefined} Preceding tabbable element. */ function findPrevious(element) { const focusables = find(element.ownerDocument.body); - const index = focusables.indexOf(element); // Remove all focusables after and including `element`. + const index = focusables.indexOf(element); + + if (index === -1) { + return undefined; + } // Remove all focusables after and including `element`. + focusables.length = index; - return Object(external_lodash_["last"])(filterTabbable(focusables)); + return (0,external_lodash_namespaceObject.last)(filterTabbable(focusables)); } /** * Given a focusable element, find the next tabbable element. @@ -433,18 +402,18 @@ function findNext(element) { const focusables = find(element.ownerDocument.body); - const index = focusables.indexOf(element); // Remove all focusables before and inside `element`. + const index = focusables.indexOf(element); // Remove all focusables before and including `element`. - const remaining = focusables.slice(index + 1).filter(node => !element.contains(node)); - return Object(external_lodash_["first"])(filterTabbable(remaining)); + const remaining = focusables.slice(index + 1); + return (0,external_lodash_namespaceObject.first)(filterTabbable(remaining)); } -// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/utils/assert-is-defined.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/utils/assert-is-defined.js function assertIsDefined(val, name) { if (false) {} } -// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/get-rectangle-from-range.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/get-rectangle-from-range.js /** * Internal dependencies */ @@ -469,9 +438,12 @@ } // Ignore tiny selection at the edge of a range. - const filteredRects = rects.filter(({ - width - }) => width > 1); // If it's full of tiny selections, return browser default. + const filteredRects = rects.filter(_ref => { + let { + width + } = _ref; + return width > 1; + }); // If it's full of tiny selections, return browser default. if (filteredRects.length === 0) { return range.getBoundingClientRect(); @@ -544,7 +516,7 @@ return rect; } -// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/compute-caret-rect.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/compute-caret-rect.js /** * Internal dependencies */ @@ -570,14 +542,14 @@ return getRectangleFromRange(range); } -// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/document-has-text-selection.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/document-has-text-selection.js /** * Internal dependencies */ /** * Check whether the current document has selected text. This applies to ranges - * of text in the document, and not selection inside and