[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 02:09:01 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         |   Keywords:
--------------------------+-----------------------------
 Before I start, the HTML Javascript helpers are marked as experimental.

 In `wp-includes/js/shortcode.js`, the `wp.html.attrs` method mis-parses
 attributes containing dashes. Instead the name, equal, and value all end
 up as the key.

 `wp.html.attrs( 'src="hi.jpg" selected data-foo="bar"' );`

 Results in:

 {{{
 {
   "src": "hi.jpg",
   "selected": "",
   "data-foo=\"bar\"": ""
 }
 }}}

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


More information about the wp-trac mailing list