X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/6a7e4474cba9d8be4b2ec445e10f1691f7277c50..b37ceabb82336ee82757cd32efe353cfab8ec267:/docs/source/DomHelper.html diff --git a/docs/source/DomHelper.html b/docs/source/DomHelper.html index 18b0b3b7..cce39c60 100644 --- a/docs/source/DomHelper.html +++ b/docs/source/DomHelper.html @@ -7,12 +7,12 @@
/*!
- * Ext JS Library 3.2.0
+ * Ext JS Library 3.2.2
  * Copyright(c) 2006-2010 Ext JS, Inc.
  * licensing@extjs.com
  * http://www.extjs.com/license
  */
-
/** +/** * @class Ext.DomHelper *

The DomHelper class provides a layer of abstraction from DOM and transparently supports creating * elements via DOM or using HTML fragments. It also has the ability to create HTML fragment templates @@ -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', @@ -169,10 +173,9 @@ Ext.DomHelper = function(){ attr, val, key, - 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 +185,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 +247,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 +280,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 @@ -284,21 +288,18 @@ Ext.DomHelper = function(){ * a function which returns such a specification. */ applyStyles : function(el, styles){ - if(styles){ - var i = 0, - len, - style; + if (styles) { + var 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 +339,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 +424,7 @@ Ext.DomHelper = function(){ createHtml : createHtml }; return pub; -}();
+}(); + \ No newline at end of file