X-Git-Url: http://git.roojs.org/?p=roojs1;a=blobdiff_plain;f=Roo%2FDomHelper.js;h=fa5e39724e7d446590d0aed0e48d8cec7b06abba;hp=6b4ff2738920879ec4ad3c3a2b62142d187c0c4d;hb=0b69a11b1055a6d3a3fd0719bdd58b5a235de0e4;hpb=988efd4d51d34feb675b832bc59f2e9d68f60f23 diff --git a/Roo/DomHelper.js b/Roo/DomHelper.js index 6b4ff27389..fa5e39724e 100644 --- a/Roo/DomHelper.js +++ b/Roo/DomHelper.js @@ -12,7 +12,7 @@ // nasty IE9 hack - what a pile of crap that is.. - if (typeof Range.prototype.createContextualFragment == "undefined") { + if (typeof Range != "undefined" && typeof Range.prototype.createContextualFragment == "undefined") { Range.prototype.createContextualFragment = function (html) { var doc = window.document; var container = doc.createElement("div"); @@ -28,7 +28,7 @@ /** * @class Roo.DomHelper * Utility class for working with DOM and/or Templates. It transparently supports using HTML fragments or DOM. - * For more information see this blog post with examples. + * For more information see this blog post with examples. * @singleton */ Roo.DomHelper = function(){ @@ -48,7 +48,7 @@ Roo.DomHelper = function(){ } b += "<" + o.tag; for(var attr in o){ - if(attr == "tag" || attr == "children" || attr == "cn" || attr == "html" || typeof o[attr] == "function") continue; + if(attr == "tag" || attr == "children" || attr == "cn" || attr == "html" || typeof o[attr] == "function") { continue; } if(attr == "style"){ var s = o["style"]; if(typeof s == "function"){ @@ -131,13 +131,15 @@ Roo.DomHelper = function(){ for(var attr in o){ if(attr == "tag" || attr == "ns" ||attr == "xmlns" ||attr == "children" || attr == "cn" || attr == "html" || - attr == "style" || typeof o[attr] == "function") continue; + attr == "style" || typeof o[attr] == "function") { continue; } if(attr=="cls" && Roo.isIE){ el.className = o["cls"]; }else{ - if(useSet) el.setAttribute(attr=="cls" ? 'class' : attr, o[attr]); - else el[attr] = o[attr]; + if(useSet) { el.setAttribute(attr=="cls" ? 'class' : attr, o[attr]);} + else { + el[attr] = o[attr]; + } } } Roo.DomHelper.applyStyles(el, o.style);