[wp-trac] [WordPress Trac] #25829: wp.html.attrs( string ) JS method has issue with attributes with dashes

WordPress Trac noreply at wordpress.org
Tue Nov 5 19:02:17 UTC 2013


#25829: wp.html.attrs( string ) JS method has issue with attributes with dashes
--------------------------+------------------------------
 Reporter:  seamusleahy   |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Shortcodes    |     Version:
 Severity:  minor         |  Resolution:
 Keywords:                |
--------------------------+------------------------------
Changes (by bananastalktome):

 * cc: bananastalktome@… (added)


Comment:

 It looks like the regex
 (`(\w+)\s*=\s*"([^"]*)"(?:\s|$)|(\w+)\s*=\s*\'([^\']*)\'(?:\s|$)|(\w+)\s*=\s*([^\s\'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|(\S+)(?:\s|$)`)
 uses `\w` in several places which checks only Letters, Numbers, &
 Underscores, but not dashes. In so-basic-it-almost-wasnt-testing testing,
 changing the `\w` to `[\w-]` seemed to resolve the issue.

 Since the regex is shared with the `wp-includes\shortcodes.php` function
 `shortcode_parse_atts()`, I don't know if any changes would be needed
 there as well.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/25829#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list