PDA

View Full Version : [FIXED]Ext.DomHelper.markup uses single quotes instead of double for attribute values



neonskimmer
9 Jul 2009, 7:16 AM
Ext version tested:
Ext 3.0 rev --Browser versions tested against:
IE8
FF3 (firebug 1.3.3 installed)Operating System:
Windows VistaDescription:

When using the markup method of the DomHelper object, the results
returned are different than the ones produced by the 2.2 version of DomHelper.
Attribute values are enclosed in single quotes rather than double-quotes.

Test Case:



Ext.DomHelper.markup({ tag: 'div', cls: 'myclass'});


The result that was expected:



'<div class="myclass"></div>' (or escaped, etc)
The result that occurs instead:

"<div class='myclass'></div>" (single quotes around attribute values)


Debugging already done:

A cursory glance into DomHelper.js points to the createHtml method:


if (Ext.isObject(val)) {
b += " " + attr + "='";
Ext.iterate(val, function(key, keyVal){
b += key + ":" + keyVal + ";";
});
b += "'";
}else{
b += " " + ({cls : "class", htmlFor : "for"}[attr] || attr) + "='" + val + "'";
}


Possible fix:


if (Ext.isObject(val)) {
b += " " + attr + '="';
Ext.iterate(val, function(key, keyVal){
b += key + ":" + keyVal + ";";
});
b += '"';
}else{
b += " " + ({cls : "class", htmlFor : "for"}[attr] || attr) + '="' + val + '"';
}

NB: Totally untested, may have side effects. I'm probably going to give this a try
with an override, or use the previous version of DomHelper under a different name.

evant
9 Jul 2009, 7:31 AM
Thanks for the report, your fix looks correct, it's been added in SVN.