X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/6a7e4474cba9d8be4b2ec445e10f1691f7277c50..530ef4b6c5b943cfa68b779d11cf7de29aa878bf:/docs/source/DomHelper.html diff --git a/docs/source/DomHelper.html b/docs/source/DomHelper.html index 18b0b3b7..f9871178 100644 --- a/docs/source/DomHelper.html +++ b/docs/source/DomHelper.html @@ -7,7 +7,7 @@
/*! - * Ext JS Library 3.2.0 + * Ext JS Library 3.2.1 * Copyright(c) 2006-2010 Ext JS, Inc. * licensing@extjs.com * http://www.extjs.com/license @@ -144,6 +144,10 @@ Ext.DomHelper = function(){ var tempTableEl = null, emptyTags = /^(?:br|frame|hr|img|input|link|meta|range|spacer|wbr|area|param|col)$/i, tableRe = /^table|tbody|tr|td$/i, + confRe = /tag|children|cn|html$/i, + tableElRe = /td|tr|tbody/i, + cssRe = /([a-z0-9-]+)\s*:\s*([^;\s]+(?:\s*[^;\s]+)*);?/gi, + endRe = /end/i, pub, // kill repeat to save bytes afterbegin = 'afterbegin', @@ -172,7 +176,7 @@ Ext.DomHelper = function(){ keyVal, cn; - if(Ext.isString(o)){ + if(typeof o == "string"){ b = o; } else if (Ext.isArray(o)) { for (var i=0; i < o.length; i++) { @@ -182,19 +186,20 @@ Ext.DomHelper = function(){ }; } else { b += '<' + (o.tag = o.tag || 'div'); - Ext.iterate(o, function(attr, val){ - if(!/tag|children|cn|html$/i.test(attr)){ - if (Ext.isObject(val)) { + for (attr in o) { + val = o[attr]; + if(!confRe.test(attr)){ + if (typeof val == "object") { b += ' ' + attr + '="'; - Ext.iterate(val, function(key, keyVal){ - b += key + ':' + keyVal + ';'; - }); + for (key in val) { + b += key + ':' + val[key] + ';'; + }; b += '"'; }else{ b += ' ' + ({cls : 'class', htmlFor : 'for'}[attr] || attr) + '="' + val + '"'; } } - }); + }; // Now either just close the tag or try to add children and close the tag. if (emptyTags.test(o.tag)) { b += '/>'; @@ -243,7 +248,7 @@ Ext.DomHelper = function(){ tempTableEl = tempTableEl || document.createElement('div'); if(tag == 'td' && (where == afterbegin || where == beforeend) || - !/td|tr|tbody/i.test(tag) && (where == beforebegin || where == afterend)) { + !tableElRe.test(tag) && (where == beforebegin || where == afterend)) { return; } before = where == beforebegin ? el : @@ -276,7 +281,7 @@ Ext.DomHelper = function(){ markup : function(o){ return createHtml(o); }, - + /** * Applies a style specification to an element. * @param {String/HTMLElement} el The element to apply styles to @@ -287,18 +292,18 @@ Ext.DomHelper = function(){ if(styles){ var i = 0, len, - style; + style, + matches; el = Ext.fly(el); - if(Ext.isFunction(styles)){ + if(typeof styles == "function"){ styles = styles.call(); } - if(Ext.isString(styles)){ - styles = styles.trim().split(/\s*(?::|;)\s*/); - for(len = styles.length; i < len;){ - el.setStyle(styles[i++], styles[i++]); + if(typeof styles == "string"){ + while((matches = cssRe.exec(styles))){ + el.setStyle(matches[1], matches[2]); } - }else if (Ext.isObject(styles)){ + }else if (typeof styles == "object"){ el.setStyle(styles); } } @@ -338,7 +343,7 @@ Ext.DomHelper = function(){ } } else { range = el.ownerDocument.createRange(); - setStart = 'setStart' + (/end/i.test(where) ? 'After' : 'Before'); + setStart = 'setStart' + (endRe.test(where) ? 'After' : 'Before'); if (hash[where]) { range[setStart](el); frag = range.createContextualFragment(html); @@ -423,6 +428,7 @@ Ext.DomHelper = function(){ createHtml : createHtml }; return pub; -}();+}(); +