Make WordPress Core


Ignore:
Timestamp:
10/20/2024 01:11:24 PM (7 weeks ago)
Author:
SergeyBiryukov
Message:

Editor: Replace id attribute with class in WP_Font_Face::get_style_element().

wp_print_font_faces() prints an HTML tag that can be used more than once, so the document could end up having multiple tags with the same id attribute.

The id global attribute defines an identifier (ID) which must be unique in the whole document.

Reference: MDN Web Docs: id.

Follow-up to [56500].

Props mmaattiiaass, peterwilsoncc.
Fixes #62246.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/fonts/font-face/wpPrintFontFaces.php

    r56540 r59259  
    5656
    5757        $expected_output = <<<CSS
    58 <style id='wp-fonts-local' type='text/css'>
     58<style class='wp-fonts-local' type='text/css'>
    5959@font-face{font-family:"Source Serif Pro";font-style:normal;font-weight:200 900;font-display:fallback;src:url('http://example.com/assets/source-serif-pro/SourceSerif4Variable-Roman.ttf.woff2') format('woff2');font-stretch:;}
    6060</style>
     
    7777
    7878    private function get_expected_styles_output( $styles ) {
    79         $style_element = "<style id='wp-fonts-local' type='text/css'>\n%s\n</style>\n";
     79        $style_element = "<style class='wp-fonts-local' type='text/css'>\n%s\n</style>\n";
    8080        return sprintf( $style_element, $styles );
    8181    }
Note: See TracChangeset for help on using the changeset viewer.