Make WordPress Core


Ignore:
Timestamp:
03/16/2025 06:49:39 PM (3 months ago)
Author:
joedolson
Message:

Media: Add 'muted' attribute and normalize HTML attributes.

Add the 'muted' attribute to the audio shortcode. Fix boolean attributes to meet HTML5 standards. Replaces instances like attr="1" with attr for loop, autoplay, and muted, and improves handling of the preload attribute to only output valid values.

Props shub07, dmsnell, debarghyabanerjee, audrasjb, narenin, apermo, joedolson.
Fixes #61515.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/media.php

    r59954 r59987  
    942942        $this->assertStringNotContainsString( 'loop', $actual );
    943943        $this->assertStringNotContainsString( 'autoplay', $actual );
     944        $this->assertStringNotContainsString( 'muted', $actual );
    944945        $this->assertStringContainsString( 'preload="none"', $actual );
    945946        $this->assertStringContainsString( 'class="wp-audio-shortcode"', $actual );
     
    951952                'loop'     => true,
    952953                'autoplay' => true,
    953                 'preload'  => true,
     954                'muted'    => true,
     955                'preload'  => 'none',
    954956                'class'    => 'foobar',
    955957                'style'    => 'padding:0;',
     
    958960
    959961        $this->assertStringContainsString( 'src="https://example.com/foo.mp3', $actual );
    960         $this->assertStringContainsString( 'loop="1"', $actual );
    961         $this->assertStringContainsString( 'autoplay="1"', $actual );
    962         $this->assertStringContainsString( 'preload="1"', $actual );
     962        $this->assertStringContainsString( 'loop', $actual );
     963        $this->assertStringContainsString( 'autoplay', $actual );
     964        $this->assertStringContainsString( 'muted', $actual );
     965        $this->assertStringContainsString( 'preload="none"', $actual );
    963966        $this->assertStringContainsString( 'class="foobar"', $actual );
    964967        $this->assertStringContainsString( 'style="padding:0;"', $actual );
Note: See TracChangeset for help on using the changeset viewer.