Opened 9 years ago

Closed 9 years ago

#11791 closed defect (fixed)

dojox.html.format.prettyPrint removes html5 custom-data attributes

Reported by: Ferdinand Weinberger Owned by: Jared Jurkiewicz
Priority: high Milestone: 1.6
Component: HTML Version: 1.5
Keywords: Cc:
Blocked By: Blocking:

Description

    var tag = '<div data-dojo-type="dijit.form.Button" data-dojo-props="label: \'myButton\'" id="testbutton" data-dojo-id="myButton" style="border: 1px solid black;"></div>';
    
    //will result <div id="testbutton" style="border: 1px solid black;"> </div>
    console.log(dojox.html.format.prettyPrint(tag));

the problem is the regular expression to find attributes in the html-string.

dojox/html/format.js line 38

var rgxp_attrsMatch = /\s\w+=("[^"]*"|'[^']*'|\S*)/gi;

should be changed to

var rgxp_attrsMatch = /[\w-]+=("[^"]*"|'[^']*'|\S*)/gi;

Attachments (1)

dojox_html_format_regex.html (1.3 KB) - added by Ferdinand Weinberger 9 years ago.
quick example with the attribute-search regex

Download all attachments as: .zip

Change History (4)

Changed 9 years ago by Ferdinand Weinberger

quick example with the attribute-search regex

comment:1 Changed 9 years ago by Adam Peller

Owner: changed from sjmiles to Jared Jurkiewicz

comment:2 Changed 9 years ago by Jared Jurkiewicz

Milestone: tbd1.6

comment:3 Changed 9 years ago by Jared Jurkiewicz

Resolution: fixed
Status: newclosed

(In [22942]) Minor patch to regexp to match atttributes. fixes #11791

Note: See TracTickets for help on using tickets.