</head>
<body onload="prettyPrint();">
<pre class="prettyprint lang-js">/*!
- * Ext JS Library 3.2.0
- * Copyright(c) 2006-2010 Ext JS, Inc.
- * licensing@extjs.com
- * http://www.extjs.com/license
+ * Ext JS Library 3.3.1
+ * Copyright(c) 2006-2010 Sencha Inc.
+ * licensing@sencha.com
+ * http://www.sencha.com/license
*/
<div id="cls-Ext.DomHelper"></div>/**
* @class Ext.DomHelper
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',
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++) {
};
} 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 += '/>';
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 :
markup : function(o){
return createHtml(o);
},
-
+
<div id="method-Ext.DomHelper-applyStyles"></div>/**
* Applies a style specification to an element.
* @param {String/HTMLElement} el The element to apply styles to
* 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") {
+ <div id="prop-Ext.DomHelper-lastIndex"></div>/**
+ * Since we're using the g flag on the regex, we need to set the lastIndex.
+ * This automatically happens on some implementations, but not others, see:
+ * http://stackoverflow.com/questions/2645273/javascript-regular-expression-literal-persists-between-function-calls
+ * http://blog.stevenlevithan.com/archives/fixing-javascript-regexp
+ */
+ cssRe.lastIndex = 0;
+ while ((matches = cssRe.exec(styles))) {
+ el.setStyle(matches[1], matches[2]);
}
- }else if (Ext.isObject(styles)){
+ } else if (typeof styles == "object") {
el.setStyle(styles);
}
}
}
} 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);
createHtml : createHtml
};
return pub;
-}();</pre>
+}();
+</pre>
</body>
</html>
\ No newline at end of file