[wp-trac] [WordPress Trac] #40245: Youtube embeds lack title attribute
WordPress Trac
noreply at wordpress.org
Thu Mar 14 21:54:56 UTC 2019
#40245: Youtube embeds lack title attribute
--------------------------------------+----------------------------
Reporter: morriscountynj | Owner: swissspidy
Type: enhancement | Status: assigned
Priority: normal | Milestone: 5.2
Component: Embeds | Version: 2.9
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses: accessibility
--------------------------------------+----------------------------
Comment (by jrf):
Improved regex line:
{{{#!php
<?php
$pattern = '`<iframe[^>]*?title=(\\\\'|\\\\"|['"])([^>]*?)\1`i';
}}}
**Important:** `$matches[1]` on line 802 and 803 will need to be changed
to `$matches[2]` when using this regex.
Test data used:
{{{
<img src="..." title="title"/>
'<iframe src="..." title="title" width="324" height="auto"/>'
"<iframe src='...' width='324' height='auto' title='title' ></iframe>"
"<iframe src=\"...\" title=\"title\" width=\"324\" height=\"auto\"/>"
'<iframe src=\'...\' width=\'324\' height=\'auto\' title=\'title\'
></iframe>'
"<iframe src=\"...\" title=\"title's with apostrophe\" width=\"324\"
height=\"auto\"/>"
"<iframe src='...' width='324' height='auto' title='title \"quoting\"
something' ></iframe>"
}}}
Aside from the first one which shouldn't match, all the others now match
the title correctly.
Just for fun, try using the old regex against this data set.
Let me know if there are any peculiarities in how the oembed data is
received which should be taken into account additionally.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/40245#comment:44>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list