Replace regex-based HTML parsing with WP_HTML_Tag_Processor to properly extract text nodes from menu labels. This ensures only root-level text nodes are
collected.
Additionally, replace html_entity_decode() with WP_HTML_Decoder::decode_attribute() with the menu URL for consistent attribute decoding.
Follow-up to [61124], [61126], [61127], [61142].
Props: dmsnell, madhavishah01, peterwilsoncc, wildworks.
Fixes#64233.
Built from https://develop.svn.wordpress.org/trunk@61310
git-svn-id: http://core.svn.wordpress.org/trunk@60622 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This ensures that on-demand block styles are inserted right after the `wp-block-library` inline style whereas other stylesheets not related to blocks are appended to the end of the `HEAD`. This helps ensure the expected cascade is preserved. If no `wp-block-library` inline style is present, then all styles get appended to the `HEAD` regardless.
The handling of the CSS placeholder comment added to the `wp-block-library` inline style is also improved. It is now inserted later to ensure the inline style is printed. Additionally, when the CSS placeholder comment is removed from the `wp-block-library` inline style, the entire `STYLE` tag is now removed if there are no styles left (aside from the `sourceURL` comment).
Lastly, the use of the HTML Tag Processor is significantly improved to leverage `WP_HTML_Text_Replacement`.
Developed in https://github.com/WordPress/wordpress-develop/pull/10436
Follow-up to [61008].
Props westonruter, peterwilsoncc, dmsnell.
Fixes#64099.
Built from https://develop.svn.wordpress.org/trunk@61174
git-svn-id: http://core.svn.wordpress.org/trunk@60510 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Reverts [61126] and [61127], which introduced a bug where the command palette is not stripping numbers. `HTML_Tag_Processor` cannot replace the REGEX yet.
Unprops cbravobernal.
Follow-up to [61126], [61127].
Props wildworks, tusharaddweb.
See #64196.
Built from https://develop.svn.wordpress.org/trunk@61142
git-svn-id: http://core.svn.wordpress.org/trunk@60478 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This reverts part of [61076] which made `wp-block-styles` theme support a precondition for opting in to `should_load_separate_core_block_assets` and `should_load_block_assets_on_demand`. This meant that the Twenty Twenty theme (and other themes without this support declared) would not benefit from on-demand block style loading. Nevertheless, even though such themes were not getting block styles loaded on demand, the `wp_load_classic_theme_block_styles_on_demand()` function was proceeding to opt in to the output buffer for hoisting late-printed styles, even though it was unlikely there would then be any. This meant the template enhancement output buffer was being opened for no reason.
Enabling on-demand block style loading is measured to improve FCP and LCP in Twenty Twenty, for example a ~13% improvement over a Fast 4G connection when loading the Sample Page.
Developed in https://github.com/WordPress/wordpress-develop/pull/10457
Follow-up to [61008], [61076], [60936].
Props westonruter.
See #64099, #64150, #64166, #43258.
Built from https://develop.svn.wordpress.org/trunk@61122
git-svn-id: http://core.svn.wordpress.org/trunk@60458 1a063a9b-81f0-0310-95a4-ce76da25c4cd
To prevent the registration of commands that would cause a 404 error in the network admin screen, pass the result of the `is_network_admin()` check to the command palette initialization function.
Follow-up to [61022].
Props jorbin, ntsekouras, soean, tobiasbg
Fixes#64125.
Built from https://develop.svn.wordpress.org/trunk@61121
git-svn-id: http://core.svn.wordpress.org/trunk@60457 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In [61013] the CSS inline limit was increased from 20K to 50K. However, based on benchmarking the performance improvements of increasing the limit, the relative improvement from 40K to 50K is not as great as from 30K to 40K. The performance improvements start to flatten out beginning at 40K. This 40K is still double the previous limit of 20K. Being more conservative will allow for a more gradual impact to be observed before considering a larger increase. Furthermore, the 50K limit of inline CSS can cause the oEmbed discovery links to be positioned after the first 150K bytes which prevents them from being discovered. See #64178.
Follow-up to [61013].
Props westonruter, mukesh27, szepeviktor.
See #64178.
Fixes#63018.
Built from https://develop.svn.wordpress.org/trunk@61117
git-svn-id: http://core.svn.wordpress.org/trunk@60453 1a063a9b-81f0-0310-95a4-ce76da25c4cd
When the `wp-block-library` stylesheet is not enqueued, there will be no associated inline style present. This inline style normally contains the placeholder CSS comment for the HTML Tag Processor to identify the token after which the late-printed styles should be inserted. However, when the `wp-block-library` stylesheet is not enqueued (such as in themes which do not use blocks), or else the inline style is not printed for whatever reason, this adds a fallback to insert the late-printed styles immediately before `</head>`. This ensures that late-printed styles will always get hoisted.
Developed in https://github.com/WordPress/wordpress-develop/pull/10417
Follow-up to [61008].
Props westonruter, peterwilsoncc, Soean.
See #64099, #43258.
Fixes#64150.
Built from https://develop.svn.wordpress.org/trunk@61076
git-svn-id: http://core.svn.wordpress.org/trunk@60412 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Benchmarking of initial page loads versus repeat page loads shows there is a greater performance improvement to increase inlining versus the benefits of relying on browser cache.
This new limit is expected to be further refined during beta based on additional testing.
Props westonruter, sabernhardt, poena, aristath, spacedmonkey, adamsilverstein, jonoaldersonwp, peterwilsoncc.
See #63007.
Fixes#63018.
Built from https://develop.svn.wordpress.org/trunk@61013
git-svn-id: http://core.svn.wordpress.org/trunk@60349 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* This applies in classic themes when a site has not opted out of the template enhancement buffer by filtering `wp_should_output_buffer_template_for_enhancement` off.
* Both `should_load_separate_core_block_assets` and `should_load_block_assets_on_demand` are filtered on, as otherwise they are only enabled by default in block themes.
* Any style enqueued after `wp_head` and printed via `print_late_styles()` will get hoisted up to be inserted right after the `wp-block-library` inline style in the `HEAD`.
* The result is a >10% benchmarked improvement in LCP for core classic themes due to a ~100KB reduction in the amount of CSS unconditionally being served with every page load.
Developed in https://github.com/WordPress/wordpress-develop/pull/10288
Follow-up to [60936].
Props sjapaget, westonruter, peterwilsoncc, dmsnell, mindctrl.
See #43258.
Fixes#64099.
Built from https://develop.svn.wordpress.org/trunk@61008
git-svn-id: http://core.svn.wordpress.org/trunk@60344 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This patch introduces two new functions: `wp_js_dataset_name()` and `wp_html_custom_data_attribute_name()`. Together, these provide reliable mapping between the HTML attribute names for custom data attributes, and the properties found in JavaScript for a given `HTMLElement`’s `.dataset` property.
These are to be used where matching names is important, such as in the Interactivity API and when WordPress is deciding whether or not to allow an attribute as a custom data attribute.
Developed in https://github.com/WordPress/wordpress-develop/pull/9953
Discussed in https://core.trac.wordpress.org/ticket/61501
Props dmsnell, westonruter.
See #61501.
Built from https://develop.svn.wordpress.org/trunk@61007
git-svn-id: http://core.svn.wordpress.org/trunk@60343 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Remove the ability to enqueue scripts and styles wrapped in IE conditional comment tags. Conditional comment support was removed from IE in version 10 in 2012, and no core supported browser renders them in any way. IE9 has global usage approaching zero. WordPress dropped support for IE10 and below in version 4.8.
Patch adds a deprecation notice if the conditional data argument is added. Scripts and styles are not printed, and neither are their dependencies if they are not required by other non-conditional scripts. Conditional dependencies are removed from core enqueues.
Props jonsurrell, joedolson, shailu25, siliconforks, dmsnell, sabernhardt, rollybueno.
Fixes#63821.
Built from https://develop.svn.wordpress.org/trunk@60948
git-svn-id: http://core.svn.wordpress.org/trunk@60284 1a063a9b-81f0-0310-95a4-ce76da25c4cd
For inline styles which had been inlined from registered external stylesheets via `wp_maybe_inline_styles()`, this defers to using the original stylesheet URL for the `sourceURL` as opposed to fabricating one from the stylesheet handle. This makes the `sourceURL` much more useful for debugging, as it indicates where the stylesheet is located. This allows a developer to make a change to the CSS more easily.
Developed in https://github.com/WordPress/wordpress-develop/pull/10177.
Follow-up to [50836].
Props westonruter, mukesh27, gziolo.
See #50328, #52620.
Fixes#63887.
Built from https://develop.svn.wordpress.org/trunk@60920
git-svn-id: http://core.svn.wordpress.org/trunk@60256 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Improve the source locations referenced by developer tooling in supporting browsers. Inline source locations are named like inline:handle-js-after and appear in the developer tools "sources" panel.
This is the second attempt to add sourceURL comments. The first attempt in [60685] was reverted due to an issue with script concatenation that has been addressed.
Developed in https://github.com/WordPress/wordpress-develop/pull/9672.
Follow-up to [60685], [60690].
Props jonsurrell, westonruter, wildworks, peterwilsoncc, johnbillion, tobiasbg.
Fixes#63887.
Built from https://develop.svn.wordpress.org/trunk@60719
git-svn-id: http://core.svn.wordpress.org/trunk@60055 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Allow scripts and script modules to be registered with a `fetchpriority` of `auto` (default), `high`, `low`:
* When registering a script, add a `fetchpriority` arg to go alongside the `strategy` arg which was added for loading scripts with the `defer` and `async` loading strategies. See #12009.
* For script modules, introduce an `$args` array parameter with a `fetchpriority` key to the `wp_register_script_module()`, and `wp_enqueue_script_module()` functions (and their respective underlying `WP_Script_Modules::register()` and `WP_Script_Modules::enqueue()` methods). This `$args` parameter corresponds with the same parameter used when registering non-module scripts.
* Also for script modules, introduce `WP_Script_Modules::set_fetchpriority()` to override the `fetchpriority` for what was previously registered.
* Emit a `_doing_it_wrong()` warning when an invalid `fetchpriority` value is used, and when `fetchpriority` is added to a script alias.
* Include `fetchpriority` as an attribute on printed `SCRIPT` tags as well as on preload `LINK` tags for static script module dependencies.
* Use a `fetchpriority` of `low` by default for:
* Script modules used with the Interactivity API. For overriding this default in blocks, see [https://github.com/WordPress/gutenberg/issues/71366 Gutenberg#71366].
* The `comment-reply` script.
* Improve type checks and type hints.
Developed in [https://github.com/WordPress/wordpress-develop/pull/8815 GitHub PR], with [https://github.com/WordPress/gutenberg/pull/70173 companion for Gutenberg].
Props westonruter, jonsurrell, swissspidy, luisherranz, kraftbj, audrasjb, dennysdionigi.
Fixes#61734.
Built from https://develop.svn.wordpress.org/trunk@60704
git-svn-id: http://core.svn.wordpress.org/trunk@60040 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In a Block Theme, the Custom CSS from the Customizer is inserted into the global styles, before the global style's Custom CSS. In order to update the Customizer's Custom CSS inside of the global styles, milestone CSS comments are added in the preview so that the live preview logic can do the replacement.
Follow-up to [55192], [58703].
See #57536, #61395.
Props westonruter, wildworks, peterwilsoncc, rollybueno, SirLouen, poojapadamad, rafiq91, audrasjb.
Fixes#63589.
Built from https://develop.svn.wordpress.org/trunk@60522
git-svn-id: http://core.svn.wordpress.org/trunk@59858 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Because validation was added in [59134] to prevent submitting bulk actions with no selected action, sites that remove or change the default bulk actions can fail due to the missing required inputs. Add a filter (`bulk_action_observer_ids`) that allows modifying the actions accepted to fulfill validation rules.
Props ethitter, kabir93, jorbin, davidbaumwald, joedolson.
Fixes#63005.
Built from https://develop.svn.wordpress.org/trunk@60186
git-svn-id: http://core.svn.wordpress.org/trunk@59522 1a063a9b-81f0-0310-95a4-ce76da25c4cd
[54687] introduced a fallback stylesheet for Button block styles (and later File blocks) for both the front end and the editor. In the editor, that has been added within the body, after the theme's block styles. That commit had quick fixes for Twenty Twelve and Twenty Twenty, but raising the specificity for those colors should have been unnecessary. Also, themes such as Twenty Fourteen — and non-bundled themes — still have had a similar problem with the incorrect order.
Thus, this changeset:
- Registers the stylesheet outside `wp_enqueue_classic_theme_styles()`.
- Enqueues classic styles in the `enqueue_block_assets` action instead of adding them in the `block_editor_settings_all` filter.
- Deprecates the `wp_add_editor_classic_theme_styles()` function.
Follow-up to [54687].
Props sabernhardt, mukesh27.
Fixes#61892.
Built from https://develop.svn.wordpress.org/trunk@59980
git-svn-id: http://core.svn.wordpress.org/trunk@59322 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This function and filter complement the existing `wp_should_load_separate_core_block_assets()` with filter `'should_load_separate_core_block_assets'`, which until now was responsible for two different purposes:
1. Loading separate stylesheets for Core blocks, instead of a combined `wp-block-library` stylesheet (as the name indicates).
2. Loading block scripts and stylesheets on demand only if the blocks are included in the page (not indicated by the name).
The new function and filter handles exclusively the 2nd purpose, making it possible to individually adjust both behaviors. For backward compatibility, the return value of `wp_should_load_separate_core_block_assets()` is used as the filterable default for `wp_should_load_block_assets_on_demand()`. Yet, the two filters can now be individually be controlled: For example, a site owner that wants to keep loading the combined `wp-block-library` stylesheet can now do so without giving up on the ability to load block scripts and stylesheets on demand.
Block themes now opt in by default to both features, similar to how they were already doing before via just the one filter. This way, block themes that opt out of loading separate stylesheets for Core blocks will still benefit from loading block scripts and stylesheets on demand, which in the case of block themes is strongly recommended.
Props fabiankaegy, flixos90, gziolo.
Fixes#61965.
Built from https://develop.svn.wordpress.org/trunk@59823
git-svn-id: http://core.svn.wordpress.org/trunk@59165 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Updates the enqueued styles in various editors to remove target styles more precisely to where they are needed.
Removes the following stylesheets as dependencies of `wp-edit-blocks`:
* `wp-editor`
* `wp-reusable-blocks`
* `wp-patterns`
The `wp-editor` stylesheet is targeted to the items requiring the CSS:
* `edit-widgets`
* `customize-widgets`
* `edit-site`
Props ellatrix, youknowriad.
Fixes#62266, #62274.
Built from https://develop.svn.wordpress.org/trunk@59793
git-svn-id: http://core.svn.wordpress.org/trunk@59135 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset improves a bunch of error messages, notably replacing the good old cryptic "Something went wrong" message with more helpful information.
Props peterwilsoncc, netweb, karmatosed, JoshuaWold, mrtortai, audrasjb, sukhendu2002, joedolson.
Fixes#43622.
Built from https://develop.svn.wordpress.org/trunk@59790
git-svn-id: http://core.svn.wordpress.org/trunk@59132 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This fixes a `ReferenceError` caused by a stray Unicode character in the unminified version of moxie.js. This has long been fixed upstream but the library cannot be wholesale updated in WordPress because of an incompatible license change.
Because of this, a new version is being tagged, `1.3.5.1`, and the file header has been updated to make it more clear that the file is a maintained fork with a high level list of changes made.
Props kinggmobb, jorbin, q0rban, azaozz, desrosj, sukhendu2002.
Fixes#59329.
Built from https://develop.svn.wordpress.org/trunk@59770
git-svn-id: http://core.svn.wordpress.org/trunk@59112 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Replaces the `-umd` appendage for the `react` and `react-dom` script versions with `.1`. This it to prevent issues with third party code expecting the version number in the form `/^[\d\.]+$/`.
Updates the version to tests in `Tests_Dependencies_Scripts::test_vendor_script_versions_registered_manually` to include the modified version used for cache busting.
Follow up to [59536], [58775].
Props azaozz, desrosj, peterwilsoncc.
Fixes#62422.
Built from https://develop.svn.wordpress.org/trunk@59540
git-svn-id: http://core.svn.wordpress.org/trunk@58926 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In 6.7, [58775] changed the way `react` and `react-dom` are bundled in Core. This commit resulted in some changes to the built files that are distributed in WordPress even though the actual version of the libraries remained the same.
The result can be a blank white screen when trying to edit a post when those two script files are heavily cached. This adds `-umd` to the end of the version number to properly purge caches until the next update to these libraries occurs.
Props levskipg, get_dave, smerriman, jdnd, juanwp22, seanlanglands, robertstaddon.
Fixes 62422.
Built from https://develop.svn.wordpress.org/trunk@59536
git-svn-id: http://core.svn.wordpress.org/trunk@58922 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Adds a new function, `wp_render_empty_block_template_warning`, that renders a warning for logged-in users when a block template is empty.
Reviewed by get_dave, richtabor.
Props vcanales, mikachan, peterwilsoncc, richtabor, get_dave, mrfoxtalbot, matveb, arielmaidana, seifradwane, annezazu.
Fixes#62053.
Built from https://develop.svn.wordpress.org/trunk@59449
git-svn-id: http://core.svn.wordpress.org/trunk@58835 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This updates several `devDependencies` to their latest versions:
- `autoprefixer` (`10.4.20`)
- `cssnano` (`7.0.6`)
- `grunt-contrib-qunit` (`10.1.1`)
- `grunt-webpack` (`7.0.0`)
- `postcss` (`8.4.47`)
- `qunit` (`2.22.0`)
- `sass` (`1.79.4`)
- `uuid` (`10.0.0`)
- `wait-on` (18.0.1`)
Also included are two minor updates to bundled dependencies:
- `json2php` (`0.0.9`)
- `wicg-inert` (`3.1.3`).
After applying these updates, `npm audit fix` and `grunt precommit:css` were run.
See #62137.
Built from https://develop.svn.wordpress.org/trunk@59135
git-svn-id: http://core.svn.wordpress.org/trunk@58531 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Add an error notice if a user attempts to apply bulk edits with no items selected. Applies to post lists, comments, taxonomies, and plugins screens.
Props garrett-eclipse, nrqsnchz, sumitsingh, nihar007, royho, sabernhardt, oglekler, quadthemes, ankit-k-gupta, fnpen, ukdrahul, joedolson.
Fixes#45006, #58479.
Built from https://develop.svn.wordpress.org/trunk@59134
git-svn-id: http://core.svn.wordpress.org/trunk@58530 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This ensures that the function applies the `wp_editor_settings` filter and merges the resulting array with the rest of TinyMCE init settings.
Includes a unit test to verify that the settings are merged correctly after adding the assignment of `array_merge()` result that was missed in the initial commit.
Follow-up to [44265], [59033].
Props kkmuffme, akshat2802, davidbaumwald, SergeyBiryukov.
Fixes#61754.
Built from https://develop.svn.wordpress.org/trunk@59074
git-svn-id: http://core.svn.wordpress.org/trunk@58470 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This update most notably drops support for jQuery `< 1.12` and `< 2.2`. WordPress has not shipped with a version that matches these ranges since version 4.4 (see [36285]/#35380).
The update also changes the library’s browser support policy to only support the latest Chrome, Firefox, Safari, and Edge. This closely matches Core’s current policy to support the last 2 versions of these browsers. The library’s README notes that other versions nay “also work correctly with this plugin but support is not guaranteed”, which is reasonably similar.
Props vipulgupta003.
Fixes#61835.
Built from https://develop.svn.wordpress.org/trunk@58956
git-svn-id: http://core.svn.wordpress.org/trunk@58352 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The polyfill was added in [57492], but all browsers supported by WordPress already support import maps.
This not only disables the polyfill, but completely removes it as it was only added recently and there is no usage outside of core.
Props swissspidy, desrosj, luisherranz, gziolo.
Fixes#60970.
Built from https://develop.svn.wordpress.org/trunk@58952
git-svn-id: http://core.svn.wordpress.org/trunk@58348 1a063a9b-81f0-0310-95a4-ce76da25c4cd