[wp-trac] [WordPress Trac] #47455: Duplicate attributes 'width' and 'height' in class-twentynineteen-svg-icons.php
WordPress Trac
noreply at wordpress.org
Sat Jun 1 09:33:13 UTC 2019
#47455: Duplicate attributes 'width' and 'height' in class-twentynineteen-svg-
icons.php
----------------------------------------+-----------------------------
Reporter: albertomake | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Themes | Version: 5.2.1
Severity: normal | Keywords: needs-patch
Focuses: template, coding-standards |
----------------------------------------+-----------------------------
Hi, in the latest version of the Twenty Nineteen I just found some svgs
with 'width' and 'height' values in class-twentynineteen-svg-icons.php
{{{
'keyboard_arrow_left' => /* material-design –
keyboard_arrow_left */ '
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0
0 24 24">
<path d="M14 7l-5 5 5 5V7z"></path>
<path fill="none" d="M24 0v24H0V0h24z"></path>
</svg>',
'arrow_drop_down_ellipsis' => /* custom –
arrow_drop_down_ellipsis */ '
<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">
<g fill="none" fill-rule="evenodd">
<path d="M0 0h24v24H0z"/>
<path fill="currentColor" fill-rule="nonzero" d="M12 2c5.52 0 10
4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zM6 14a2 2 0 1 0 0-4 2 2
0 0 0 0 4zm6 0a2 2 0 1 0 0-4 2 2 0 0 0 0 4zm6 0a2 2 0 1 0 0-4 2 2 0 0 0 0
4z"/>
</g>
</svg>
}}}
There is no need to have width and height attributes as the 'public static
function get_svg' is adding the width and height. This generate a
Duplicate error. Use validator.w3.org for more details. I would propose to
remove those attributes from the svg tag:
{{{
'keyboard_arrow_left' => /* material-design –
keyboard_arrow_left */ '
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path d="M14 7l-5 5 5 5V7z"></path>
<path fill="none" d="M24 0v24H0V0h24z"></path>
</svg>',
'arrow_drop_down_ellipsis' => /* custom –
arrow_drop_down_ellipsis */ '
<svg xmlns="http://www.w3.org/2000/svg">
<g fill="none" fill-rule="evenodd">
<path d="M0 0h24v24H0z"/>
<path fill="currentColor" fill-rule="nonzero" d="M12 2c5.52 0 10
4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zM6 14a2 2 0 1 0 0-4 2 2
0 0 0 0 4zm6 0a2 2 0 1 0 0-4 2 2 0 0 0 0 4zm6 0a2 2 0 1 0 0-4 2 2 0 0 0 0
4z"/>
</g>
</svg>
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/47455>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list