Make WordPress Core


Ignore:
Timestamp:
03/09/2025 09:14:28 AM (2 months ago)
Author:
audrasjb
Message:

Media: Improve HTML5 compliance of wp_video_shortcode() boolean attributes.

This changeset updates wp_video_shortcode() to improve boolean attributes handling in accordance with HTML5 standards. Technically, it replaces attr="1" with attr for the loop, autoplay and muted attributes. The preload attribute is also updated to accept only allowed values: none, metadata, and auto. If a value outside of this list is provided, it will be ignored, preventing invalid attribute outputs.

Props jongycastillo, sabernhardt, joedolson, audrasjb, shub07, debarghyabanerjee.
Fixes #60178.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/widgets/wpWidgetMediaVideo.php

    r52248 r59954  
    278278        // Custom attributes.
    279279        $this->assertStringContainsString( 'preload="metadata"', $output );
    280         $this->assertStringContainsString( 'loop="1"', $output );
     280        $this->assertStringContainsString( 'loop', $output );
    281281
    282282        // Externally hosted video.
Note: See TracChangeset for help on using the changeset viewer.