dojox.html.format.prettyPrint removes html5 custom-data attributes
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;
Change History (4)
Owner: |
changed from sjmiles to Jared Jurkiewicz
|
Resolution: |
→ fixed
|
Status: |
new →
closed
|
quick example with the attribute-search regex