Opened 11 years ago

Closed 9 years ago

#10153 closed task (fixed)

try using clone(false) to detect which attributes are specified in markup

Reported by: bill Owned by: bill
Priority: high Milestone: 1.7
Component: Parser Version: 1.4.0b
Keywords: Cc: Jared Jurkiewicz
Blocked By: Blocking:


Currently the parser computes a list of attributes in each widget and then tests each DomNode for every parameter, to see if it's specified. (It's calling attributes.getNamedItem(name) in a loop.)

Jared has a different technique in the Editor PrettyPrint code where he takes the node, does a clone(false), sticks it inside a wrapper <div> (or suitable element for problem nodes like <td>), and then uses innerHTML with a regexp to find out which parameters were actually specified.

This may be more performant and may also fix problems like on IE8 where on <button> nodes we can't detect whether the developer has explicitly set type or not (it always seems like they set type=submit).

Change History (3)

comment:1 Changed 10 years ago by bill

(In [22386]) Change examples for Dialog Cancel button, since <button dojoType=dijit.form.Button type=cancel> isn't supported by dijit, and it can't be supported in IE8, short of #10153. Refs #10153, fixes #11346.

comment:2 Changed 9 years ago by bill

Cc: Jared Jurkiewicz added; jared removed
Milestone: future1.7

Will check this in w/fix for #12476. Only using it on IE6/7 though, for other browsers can just access node.attributes.

comment:3 Changed 9 years ago by bill

Resolution: fixed
Status: newclosed

(In [24185]) Refactor parser to allow attributes (for a single node) to be partly specified in data-dojo-props, and partly specified directly ex: value=123. Uses node.attributes to detect which attributes are specified on a node, or for older versions of IE calls cloneNode(false) followed by some regex's on clone.outerHTML.

Due to lowercase/uppercase issues (ex: tabIndex, onClick), and for type conversion, the code still introspects each widget to get it's attribute metadata. In the future, would like to defer/avoid that in the common case. Fixes #10153, #12423, #12476, #10150, #9823, refs #11490 !strict.

Also fixes the problem on IE8 where a button without type=... defaults to type=submit rather than whatever the widget defines the default as, fixes #10163, refs #9334, #8946.

Future updates will be attached to ticket #12476.

Note: See TracTickets for help on using tickets.