Skip to content

1.5.0 [YANKED]

Compare
Choose a tag to compare
@westonruter westonruter released this 30 Mar 20:58
· 11504 commits to develop since this release
1.5.0
03ebd5d

For the full list of changes in this release, please see the 1.5 milestone, with 80 closed issues and 109 merged pull requests.

🔥 This release was yanked. Skip this release in favor of the subsequent v1.5.1 hotfix release, or rather the latest stable release.

Changelog

What follows are the key changes in this release, broken down into categories.

Optimizer

Transitional Mode and Paired Browsing

  • Add paired browsing interface for Transitional mode to aid with checking visual and functional parity between AMP and non-AMP versions. This is a useful tool when checking a site for AMP-compatibility, to evaluate whether there are any differences between the two, and if any of them are significant enough to warrant switching to another theme or remaining in Transitional mode; if there are no issues, then Paired Browsing can help determine whether a site is ready for Standard mode. Paired Browsing is accessed via the AMP admin bar menu item on the frontend. #3365, #3656, #4127, #4163, #3863, #3932, #3963
  • ✨ Allow opting-out of AMP-to-AMP linking either by adding rel=noamphtml to links or by adding URLs to the amp_to_amp_excluded_links filter. #3689, #4146
  • 🐛 Prevent validation errors on valid mailto: links; restrict AMP-to-AMP linking to HTTP(S) protocol links. #4182, #4251

CSS Handling

  • Add stylesheet information to the validated URL screen. This eliminates the CSS manifest HTML comment preceding the style[amp-custom] element. The stylesheet information is presented in a “Stylesheets” metabox. A table lists out each stylesheet whether coming from a link element, style element, or style attribute. The source for the style is indicated (e.g. a specific theme or plugin). The table also indicates the original size of the CSS and the final size after minification (including tree shaking); the percentage of the total CSS taken up by a given stylesheet is also indicated. The table also indicates the priority of a given stylesheet (e.g. where theme styles are more important than plugin styles), and which stylesheets (if any) were excluded due to exceeding the 75KB limit. Lastly, expanding a stylesheet table row allows inspection of the tree shaking effectiveness in a view similar to the coverage tool in Chrome DevTools. #2169, #4026, #4275, #4283, #4294, #4411
  • ✨ Show notice on the frontend when there is excessive CSS; this is displayed as a percentage of the total CSS budget (75KB) in a submenu item of the AMP admin bar menu item. #1801
  • ✨ Don't tree-shake class names from react-dates when amp-date-picker on the page. #4334, #4339
  • ✨ Prevent plugin from removing styles for amp-experiment variants. #4437, #4438
  • ✨ Automatically extract @viewport CSS at-rules to meta viewport tag. This eliminates very common validation errors from being reported for themes across WordPress.org. #4118, #4375
  • ✨ Detect high cache miss rate for obtaining parsed CSS from variable stylesheets; add ability to prevent storing parsed CSS in transients. This prevents filling up the wp_options table when there are stylesheets with random contents. New filters: amp_parsed_css_transient_caching_allowed, amp_css_transient_monitoring_threshold, and amp_css_transient_monitoring_sampling_range. #2092, #4177
  • ✨ Honor Cache-Control directive for external stylesheet caching. #4293, #4404
  • ✨ Improve handling of fetching external stylesheets; provide more information when a fetch_external_stylesheet failure happened. #2449, #4257
  • 🐛 Exclude processing style attributes inside of Mustache templates. #4374
  • ✨ Prioritize inline CSS for theme stylesheets. #3877
  • ✨ Preserve styles applied via [style] attribute selectors. #4105
  • 🐛 Add patch from PHP-CSS-Parser to prevent malformed CSS properties from leaking AMP validation error past the sanitizer. #4113, #4290
  • 🐛 Prevent semicolon at end of declaration block in media query from producing invalid CSS; require unreleased version of PHP-CSS-Parser. #4197, #4300
  • 🐛 Remove extraneous closing brace from AMP_Core_Theme_Sanitizer::add_nav_menu_styles(). Trailing right brace in tree-shaken CSS when using featured image in Twenty Twenty theme. #4335, #4370, #4336

Reader Mode

  • Pass entire Reader mode templates through post-processor. This brings many benefits. Tree shaking now is performed for templates in Reader mode. AMP components used outside the content no longer need manual addition of AMP component scripts (e.g. via the amp_post_template_data filter): AMP component scripts are added automatically for components used anywhere on the page. Conversions are also now performed for the entire page, allowing you to pull in non-AMP HTML (e.g. from ACF) anywhere on the template and have it converted automatically to AMP. #2202, #3781, #688, #732, #4184, #4185, #4209
  • 🖍 Add core block stylesheets to Reader mode template. Blocks added to the content will now render as expected, whereas before they would appear partially broken due to missing block styles. As long as block styles are enqueued at the enqueue_block_assets action, they will be included on the Reader mode templates (and per the previous item, tree-shaken). #4204, #4299
  • ✨ Split Reader mode style template part stylesheet from action-supplied styles. This will assist with ensuring that the core styles remain if the styles added via the amp_post_template_css action cause the CSS to go over the 75KB limit, even after tree shaking. #4205

Document Parsing

  • Support WordPress installs without UTF-8 charset. Automatically convert to UTF-8, as AMP requires this. #855, #3758, #4296
  • ✨ Introduce AmpProject\Dom\Document subclass of DOMDocument to encapsulate logic for parsing, normalizing, and serializing HTML. #3758, #4104, #4107, #4282, #4297
  • 🐛 Prevent removal of closing table and td tags in script[template="amp-mustache"]. Fixes corrupted Mustache templates for tables using script[type=text/plain]. #4254, #4333
  • 🐛 Fix parsing of malformed meta[charset] tag. #4179, #4181

Sanitization and Validation

  • Improve validating sanitizer with context for why element/attribute is invalid. Previously when there was a validation error in a required attribute, the result would be the entire element being removed with a mere “invalid element” error. This was not helpful. Now specific validation errors are reported for the underlying problem (e.g. invalid URL protocol), as well as exposing underlying error codes. #1420, #3780, #4405, #4449
  • Add source information for script/style dependencies and inline scripts/styles. With these changes, no longer will many scripts and styles show that wp-includes is the source. If a theme enqueues a script like navigation.js which has jquery as the dependency, then that theme will be shown as the source for the jQuery script even though the script is located in WordPress core. Also, when using wp_localize_script() or wp_add_inline_script(), the resulting script tag will show the expected source. This also fixes scripts and styles enqueued before wp_enqueue_scripts failing to get sources identified. #4133, #4134, #4135
  • ✨ Add support for mandatory_oneof and mandatory_anyof attribute validation constraints. #938, #4285
  • ✨ Add sanitizer for meta tags. #3758
  • Add validation of individual properties in meta content attributes. #4070, #4137
  • ✨ Validate height, width, and layout attributes to prevent percentage units and bogus values being erroneously permitted for width and height attributes. #2146, #3728
  • 🐛 Fix invalid layout on non-AMP elements, where height=100% results in invalid layout=fill added. #4111
  • ✨ Show plugin name instead of slug when listing incompatible plugins. #3881
  • ✨ Prevent validation errors for URLs with leading or trailing spaces. #4117, #4166
  • ✨ Add validation of JSON to prevent AMP validation errors. #4320, #4340, #4430, #4431
  • 🐛 Remove source stack comments from script and style elements prior to sanitization to prevent CSS parse errors and validation errors from occurring. #4420, #4428
  • 🐛 Ensure validation errors are reported for invalid attributes on the HTML element. #4387, #4440
  • 🐛 Serve back JSON exclusively in amp_validate requests. This fixes validation requests to prevent the error: “URL validation failed to due to the absence of the expected JSON-containing AMP_VALIDATION comment after the body”. #3887, #3898, #4045

Conversion

  • ✨ Improve conversion of resizable iframes and those containing placeholder and overflow. #4288, #4292
  • ✨ Handle sanitization of security, marginwidth, and marginheight attributes when converting iframe to amp-iframe. This prevents validation errors from being raised for WordPress post embeds. #3950, #3954
  • ✨ Prevent decoding=async from being copied from img to amp-img since invalid and built-in; raise validation error for loading attribute when it is not lazy, otherwise omit from amp-img since also built-in. #3938, #3940
  • ✨ Prevent loading=lazy from being copied from iframe to amp-iframe since invalid (and built-in). #3939, #3941
  • ✨ Automatically convert head[profile] to head > link[rel=profile]. #4131, #4193
  • ✨ Remove html[xmlns], convert html[xml:lang] to html[lang]. #4132, #4194
  • 🐛 Prevent the HTML4 meta[http-equiv=Content-Type] from causing a validation error to leak; convert automatically to HTML5 meta[charset]. #3469

Embeds

  • ✨Add initial support for embedding TikTok videos. #4326, #4357
  • ✨ Provide a placeholder element for Twitter embeds. #1753
  • ✨ Improve handling of YouTube embeds. #3313, #3358
  • ✨ Enable captions on Gallery shortcodes when displayed as amp-carousel. #3658, #3659, #4009
  • ✨ For a Gallery block with a lightbox, allow viewing multiple images in the lightbox. #3823
  • 🚮 Prevent duplication of Twitter embed in Classic block; prevent wpautop() from modifying Twitter embed. #3865, #3874
  • 🚮 Remove handling of Jetpack shortcodes since AMP support now moved to Jetpack. #3309, #3678
  • ✨ For a Gallery block with a lightbox, allow viewing multiple images in the lightbox. #2849, #3823
  • 🐛 Fix amp-facebook being wrapped in a <p> tag when it should be in post root like amp-twitter. #4384,

Block Editor

  • ✨ Add an AMP Preview button to the block editor. #2934, #3323, #3392, #4368, #4397
  • ✨ Improve displaying validation errors in Gutenberg block warning notice. #3664, #4401
  • ✨ Change copy for “Remove Element” button to “Remove Block” in validation error warning notice. #3822, #4398

AMP Spec Updates

  • ✨ Update allowed tags/attributes from spec in amphtml 2003031842100. Newly supported components include amp-inline-gallery, amp-mega-menu, amp-nested-menu, and more. #4390
  • ⏪ Stop pinning amp-carousel at v0.1 so that v0.2 can be used. #3700, #3115

Stories Editor

  • 🚮 Remove AMP Stories and eliminate the obsolete experiences UI. Remember that Stories has been removed from the AMP plugin in favor of the feature being released as a standalone plugin. It will be available soon! #4203, #4315

Other

  • 🏗 Bump minimum PHP version to 5.6.
  • 🚮 Eliminate post-processor cache since not effective. #4178, #4391
  • ✨ Add AMP support for protected posts. #3428, #3697
  • ✨ Integrate with Site Health, including moving the Xdebug admin warning. #3886, #2199, #3499, #4432
  • 🐛 Prevent failed attempts to override the reply-title heading in comment form, improving compatibility with Twenty Nineteen and Twenty Twenty. #2489, #4388
  • ✅ Add PHP static analysis via PHPStan. #4342, #4373, #4378
  • 🐛 Fix doubled image margins in Twenty Twenty. #4419, #4421
  • 🐛 Fix sizing and positioning of custom logo in Twenty Twenty. #4418, #4422
  • ✨ Introduce AmpProject namespace. #3810, #4188, #4364

Props

Thanks to the many contributors who made this release possible through work on development, design, testing, project management, and more:

Alain Schlesser, Alberto Medina, Artem Russakovskii, Bartosz, Hendrawan Kuncoro , Hernán Villanueva, Jer Clarke, John Ritterbush, Jonathan Barnett, Kasper Myram, Lofesa, Maciej Mackowiak, Pascal Birchler, Paul Schreiber, Pierre Gordon, Ryan Kienstra, Ryan Smith, spasibych, Thierry Muller, Thomas McMahon, and Weston Ruter.

Installation

Now available to install via WordPress.org (but again, this will be v1.5.1+).