3ec6698ac5b7edf3aa2a978423cf9a43dd655da5
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Resources / Public / JavaScript / Contrib / extjs / ext-all-debug.js
1 /*
2 This file is part of Ext JS 3.4
3
4 Copyright (c) 2011-2013 Sencha Inc
5
6 Contact: http://www.sencha.com/contact
7
8 GNU General Public License Usage
9 This file may be used under the terms of the GNU General Public License version 3.0 as
10 published by the Free Software Foundation and appearing in the file LICENSE included in the
11 packaging of this file.
12
13 Please review the following information to ensure the GNU General Public License version 3.0
14 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
15
16 If you are unsure which license is appropriate for your use, please contact the sales department
17 at http://www.sencha.com/contact.
18
19 Build date: 2013-04-03 15:07:25
20 */
21 (function(){
22
23 var EXTUTIL = Ext.util,
24 EACH = Ext.each,
25 TRUE = true,
26 FALSE = false;
27
28 EXTUTIL.Observable = function(){
29
30 var me = this, e = me.events;
31 if(me.listeners){
32 me.on(me.listeners);
33 delete me.listeners;
34 }
35 me.events = e || {};
36 };
37
38 EXTUTIL.Observable.prototype = {
39
40 filterOptRe : /^(?:scope|delay|buffer|single)$/,
41
42
43 fireEvent : function(){
44 var a = Array.prototype.slice.call(arguments, 0),
45 ename = a[0].toLowerCase(),
46 me = this,
47 ret = TRUE,
48 ce = me.events[ename],
49 cc,
50 q,
51 c;
52 if (me.eventsSuspended === TRUE) {
53 if (q = me.eventQueue) {
54 q.push(a);
55 }
56 }
57 else if(typeof ce == 'object') {
58 if (ce.bubble){
59 if(ce.fire.apply(ce, a.slice(1)) === FALSE) {
60 return FALSE;
61 }
62 c = me.getBubbleTarget && me.getBubbleTarget();
63 if(c && c.enableBubble) {
64 cc = c.events[ename];
65 if(!cc || typeof cc != 'object' || !cc.bubble) {
66 c.enableBubble(ename);
67 }
68 return c.fireEvent.apply(c, a);
69 }
70 }
71 else {
72 a.shift();
73 ret = ce.fire.apply(ce, a);
74 }
75 }
76 return ret;
77 },
78
79
80 addListener : function(eventName, fn, scope, o){
81 var me = this,
82 e,
83 oe,
84 ce;
85
86 if (typeof eventName == 'object') {
87 o = eventName;
88 for (e in o) {
89 oe = o[e];
90 if (!me.filterOptRe.test(e)) {
91 me.addListener(e, oe.fn || oe, oe.scope || o.scope, oe.fn ? oe : o);
92 }
93 }
94 } else {
95 eventName = eventName.toLowerCase();
96 ce = me.events[eventName] || TRUE;
97 if (typeof ce == 'boolean') {
98 me.events[eventName] = ce = new EXTUTIL.Event(me, eventName);
99 }
100 ce.addListener(fn, scope, typeof o == 'object' ? o : {});
101 }
102 },
103
104
105 removeListener : function(eventName, fn, scope){
106 var ce = this.events[eventName.toLowerCase()];
107 if (typeof ce == 'object') {
108 ce.removeListener(fn, scope);
109 }
110 },
111
112
113 purgeListeners : function(){
114 var events = this.events,
115 evt,
116 key;
117 for(key in events){
118 evt = events[key];
119 if(typeof evt == 'object'){
120 evt.clearListeners();
121 }
122 }
123 },
124
125
126 addEvents : function(o){
127 var me = this;
128 me.events = me.events || {};
129 if (typeof o == 'string') {
130 var a = arguments,
131 i = a.length;
132 while(i--) {
133 me.events[a[i]] = me.events[a[i]] || TRUE;
134 }
135 } else {
136 Ext.applyIf(me.events, o);
137 }
138 },
139
140
141 hasListener : function(eventName){
142 var e = this.events[eventName.toLowerCase()];
143 return typeof e == 'object' && e.listeners.length > 0;
144 },
145
146
147 suspendEvents : function(queueSuspended){
148 this.eventsSuspended = TRUE;
149 if(queueSuspended && !this.eventQueue){
150 this.eventQueue = [];
151 }
152 },
153
154
155 resumeEvents : function(){
156 var me = this,
157 queued = me.eventQueue || [];
158 me.eventsSuspended = FALSE;
159 delete me.eventQueue;
160 EACH(queued, function(e) {
161 me.fireEvent.apply(me, e);
162 });
163 }
164 };
165
166 var OBSERVABLE = EXTUTIL.Observable.prototype;
167
168 OBSERVABLE.on = OBSERVABLE.addListener;
169
170 OBSERVABLE.un = OBSERVABLE.removeListener;
171
172
173 EXTUTIL.Observable.releaseCapture = function(o){
174 o.fireEvent = OBSERVABLE.fireEvent;
175 };
176
177 function createTargeted(h, o, scope){
178 return function(){
179 if(o.target == arguments[0]){
180 h.apply(scope, Array.prototype.slice.call(arguments, 0));
181 }
182 };
183 };
184
185 function createBuffered(h, o, l, scope){
186 l.task = new EXTUTIL.DelayedTask();
187 return function(){
188 l.task.delay(o.buffer, h, scope, Array.prototype.slice.call(arguments, 0));
189 };
190 };
191
192 function createSingle(h, e, fn, scope){
193 return function(){
194 e.removeListener(fn, scope);
195 return h.apply(scope, arguments);
196 };
197 };
198
199 function createDelayed(h, o, l, scope){
200 return function(){
201 var task = new EXTUTIL.DelayedTask(),
202 args = Array.prototype.slice.call(arguments, 0);
203 if(!l.tasks) {
204 l.tasks = [];
205 }
206 l.tasks.push(task);
207 task.delay(o.delay || 10, function(){
208 l.tasks.remove(task);
209 h.apply(scope, args);
210 }, scope);
211 };
212 };
213
214 EXTUTIL.Event = function(obj, name){
215 this.name = name;
216 this.obj = obj;
217 this.listeners = [];
218 };
219
220 EXTUTIL.Event.prototype = {
221 addListener : function(fn, scope, options){
222 var me = this,
223 l;
224 scope = scope || me.obj;
225 if(!me.isListening(fn, scope)){
226 l = me.createListener(fn, scope, options);
227 if(me.firing){
228 me.listeners = me.listeners.slice(0);
229 }
230 me.listeners.push(l);
231 }
232 },
233
234 createListener: function(fn, scope, o){
235 o = o || {};
236 scope = scope || this.obj;
237 var l = {
238 fn: fn,
239 scope: scope,
240 options: o
241 }, h = fn;
242 if(o.target){
243 h = createTargeted(h, o, scope);
244 }
245 if(o.delay){
246 h = createDelayed(h, o, l, scope);
247 }
248 if(o.single){
249 h = createSingle(h, this, fn, scope);
250 }
251 if(o.buffer){
252 h = createBuffered(h, o, l, scope);
253 }
254 l.fireFn = h;
255 return l;
256 },
257
258 findListener : function(fn, scope){
259 var list = this.listeners,
260 i = list.length,
261 l;
262
263 scope = scope || this.obj;
264 while(i--){
265 l = list[i];
266 if(l){
267 if(l.fn == fn && l.scope == scope){
268 return i;
269 }
270 }
271 }
272 return -1;
273 },
274
275 isListening : function(fn, scope){
276 return this.findListener(fn, scope) != -1;
277 },
278
279 removeListener : function(fn, scope){
280 var index,
281 l,
282 k,
283 me = this,
284 ret = FALSE;
285 if((index = me.findListener(fn, scope)) != -1){
286 if (me.firing) {
287 me.listeners = me.listeners.slice(0);
288 }
289 l = me.listeners[index];
290 if(l.task) {
291 l.task.cancel();
292 delete l.task;
293 }
294 k = l.tasks && l.tasks.length;
295 if(k) {
296 while(k--) {
297 l.tasks[k].cancel();
298 }
299 delete l.tasks;
300 }
301 me.listeners.splice(index, 1);
302 ret = TRUE;
303 }
304 return ret;
305 },
306
307
308 clearListeners : function(){
309 var me = this,
310 l = me.listeners,
311 i = l.length;
312 while(i--) {
313 me.removeListener(l[i].fn, l[i].scope);
314 }
315 },
316
317 fire : function(){
318 var me = this,
319 listeners = me.listeners,
320 len = listeners.length,
321 i = 0,
322 l;
323
324 if(len > 0){
325 me.firing = TRUE;
326 var args = Array.prototype.slice.call(arguments, 0);
327 for (; i < len; i++) {
328 l = listeners[i];
329 if(l && l.fireFn.apply(l.scope || me.obj || window, args) === FALSE) {
330 return (me.firing = FALSE);
331 }
332 }
333 }
334 me.firing = FALSE;
335 return TRUE;
336 }
337
338 };
339 })();
340
341 Ext.DomHelper = function(){
342 var tempTableEl = null,
343 emptyTags = /^(?:br|frame|hr|img|input|link|meta|range|spacer|wbr|area|param|col)$/i,
344 tableRe = /^table|tbody|tr|td$/i,
345 confRe = /tag|children|cn|html$/i,
346 tableElRe = /td|tr|tbody/i,
347 cssRe = /([a-z0-9-]+)\s*:\s*([^;\s]+(?:\s*[^;\s]+)*);?/gi,
348 endRe = /end/i,
349 pub,
350
351 afterbegin = 'afterbegin',
352 afterend = 'afterend',
353 beforebegin = 'beforebegin',
354 beforeend = 'beforeend',
355 ts = '<table>',
356 te = '</table>',
357 tbs = ts+'<tbody>',
358 tbe = '</tbody>'+te,
359 trs = tbs + '<tr>',
360 tre = '</tr>'+tbe;
361
362
363 function doInsert(el, o, returnElement, pos, sibling, append){
364 var newNode = pub.insertHtml(pos, Ext.getDom(el), createHtml(o));
365 return returnElement ? Ext.get(newNode, true) : newNode;
366 }
367
368
369 function createHtml(o){
370 var b = '',
371 attr,
372 val,
373 key,
374 cn;
375
376 if(typeof o == "string"){
377 b = o;
378 } else if (Ext.isArray(o)) {
379 for (var i=0; i < o.length; i++) {
380 if(o[i]) {
381 b += createHtml(o[i]);
382 }
383 };
384 } else {
385 b += '<' + (o.tag = o.tag || 'div');
386 for (attr in o) {
387 val = o[attr];
388 if(!confRe.test(attr)){
389 if (typeof val == "object") {
390 b += ' ' + attr + '="';
391 for (key in val) {
392 b += key + ':' + val[key] + ';';
393 };
394 b += '"';
395 }else{
396 b += ' ' + ({cls : 'class', htmlFor : 'for'}[attr] || attr) + '="' + val + '"';
397 }
398 }
399 };
400
401 if (emptyTags.test(o.tag)) {
402 b += '/>';
403 } else {
404 b += '>';
405 if ((cn = o.children || o.cn)) {
406 b += createHtml(cn);
407 } else if(o.html){
408 b += o.html;
409 }
410 b += '</' + o.tag + '>';
411 }
412 }
413 return b;
414 }
415
416 function ieTable(depth, s, h, e){
417 tempTableEl.innerHTML = [s, h, e].join('');
418 var i = -1,
419 el = tempTableEl,
420 ns;
421 while(++i < depth){
422 el = el.firstChild;
423 }
424
425 if(ns = el.nextSibling){
426 var df = document.createDocumentFragment();
427 while(el){
428 ns = el.nextSibling;
429 df.appendChild(el);
430 el = ns;
431 }
432 el = df;
433 }
434 return el;
435 }
436
437
438 function insertIntoTable(tag, where, el, html) {
439 var node,
440 before;
441
442 tempTableEl = tempTableEl || document.createElement('div');
443
444 if(tag == 'td' && (where == afterbegin || where == beforeend) ||
445 !tableElRe.test(tag) && (where == beforebegin || where == afterend)) {
446 return;
447 }
448 before = where == beforebegin ? el :
449 where == afterend ? el.nextSibling :
450 where == afterbegin ? el.firstChild : null;
451
452 if (where == beforebegin || where == afterend) {
453 el = el.parentNode;
454 }
455
456 if (tag == 'td' || (tag == 'tr' && (where == beforeend || where == afterbegin))) {
457 node = ieTable(4, trs, html, tre);
458 } else if ((tag == 'tbody' && (where == beforeend || where == afterbegin)) ||
459 (tag == 'tr' && (where == beforebegin || where == afterend))) {
460 node = ieTable(3, tbs, html, tbe);
461 } else {
462 node = ieTable(2, ts, html, te);
463 }
464 el.insertBefore(node, before);
465 return node;
466 }
467
468
469 function createContextualFragment(html){
470 var div = document.createElement("div"),
471 fragment = document.createDocumentFragment(),
472 i = 0,
473 length, childNodes;
474
475 div.innerHTML = html;
476 childNodes = div.childNodes;
477 length = childNodes.length;
478
479 for (; i < length; i++) {
480 fragment.appendChild(childNodes[i].cloneNode(true));
481 }
482
483 return fragment;
484 }
485
486 pub = {
487
488 markup : function(o){
489 return createHtml(o);
490 },
491
492
493 applyStyles : function(el, styles){
494 if (styles) {
495 var matches;
496
497 el = Ext.fly(el);
498 if (typeof styles == "function") {
499 styles = styles.call();
500 }
501 if (typeof styles == "string") {
502
503 cssRe.lastIndex = 0;
504 while ((matches = cssRe.exec(styles))) {
505 el.setStyle(matches[1], matches[2]);
506 }
507 } else if (typeof styles == "object") {
508 el.setStyle(styles);
509 }
510 }
511 },
512
513 insertHtml : function(where, el, html){
514 var hash = {},
515 hashVal,
516 range,
517 rangeEl,
518 setStart,
519 frag,
520 rs;
521
522 where = where.toLowerCase();
523
524 hash[beforebegin] = ['BeforeBegin', 'previousSibling'];
525 hash[afterend] = ['AfterEnd', 'nextSibling'];
526
527 if (el.insertAdjacentHTML) {
528 if(tableRe.test(el.tagName) && (rs = insertIntoTable(el.tagName.toLowerCase(), where, el, html))){
529 return rs;
530 }
531
532 hash[afterbegin] = ['AfterBegin', 'firstChild'];
533 hash[beforeend] = ['BeforeEnd', 'lastChild'];
534 if ((hashVal = hash[where])) {
535 el.insertAdjacentHTML(hashVal[0], html);
536 return el[hashVal[1]];
537 }
538 } else {
539 range = el.ownerDocument.createRange();
540 setStart = 'setStart' + (endRe.test(where) ? 'After' : 'Before');
541 if (hash[where]) {
542 range[setStart](el);
543 if (!range.createContextualFragment) {
544 frag = createContextualFragment(html);
545 }
546 else {
547 frag = range.createContextualFragment(html);
548 }
549 el.parentNode.insertBefore(frag, where == beforebegin ? el : el.nextSibling);
550 return el[(where == beforebegin ? 'previous' : 'next') + 'Sibling'];
551 } else {
552 rangeEl = (where == afterbegin ? 'first' : 'last') + 'Child';
553 if (el.firstChild) {
554 range[setStart](el[rangeEl]);
555 if (!range.createContextualFragment) {
556 frag = createContextualFragment(html);
557 }
558 else {
559 frag = range.createContextualFragment(html);
560 }
561 if(where == afterbegin){
562 el.insertBefore(frag, el.firstChild);
563 }else{
564 el.appendChild(frag);
565 }
566 } else {
567 el.innerHTML = html;
568 }
569 return el[rangeEl];
570 }
571 }
572 throw 'Illegal insertion point -> "' + where + '"';
573 },
574
575
576 insertBefore : function(el, o, returnElement){
577 return doInsert(el, o, returnElement, beforebegin);
578 },
579
580
581 insertAfter : function(el, o, returnElement){
582 return doInsert(el, o, returnElement, afterend, 'nextSibling');
583 },
584
585
586 insertFirst : function(el, o, returnElement){
587 return doInsert(el, o, returnElement, afterbegin, 'firstChild');
588 },
589
590
591 append : function(el, o, returnElement){
592 return doInsert(el, o, returnElement, beforeend, '', true);
593 },
594
595
596 overwrite : function(el, o, returnElement){
597 el = Ext.getDom(el);
598 el.innerHTML = createHtml(o);
599 return returnElement ? Ext.get(el.firstChild) : el.firstChild;
600 },
601
602 createHtml : createHtml
603 };
604 return pub;
605 }();
606
607 Ext.Template = function(html){
608 var me = this,
609 a = arguments,
610 buf = [],
611 v;
612
613 if (Ext.isArray(html)) {
614 html = html.join("");
615 } else if (a.length > 1) {
616 for(var i = 0, len = a.length; i < len; i++){
617 v = a[i];
618 if(typeof v == 'object'){
619 Ext.apply(me, v);
620 } else {
621 buf.push(v);
622 }
623 };
624 html = buf.join('');
625 }
626
627
628 me.html = html;
629
630 if (me.compiled) {
631 me.compile();
632 }
633 };
634 Ext.Template.prototype = {
635
636 re : /\{([\w\-]+)\}/g,
637
638
639
640 applyTemplate : function(values){
641 var me = this;
642
643 return me.compiled ?
644 me.compiled(values) :
645 me.html.replace(me.re, function(m, name){
646 return values[name] !== undefined ? values[name] : "";
647 });
648 },
649
650
651 set : function(html, compile){
652 var me = this;
653 me.html = html;
654 me.compiled = null;
655 return compile ? me.compile() : me;
656 },
657
658
659 compile : function(){
660 var me = this,
661 sep = Ext.isGecko ? "+" : ",";
662
663 function fn(m, name){
664 name = "values['" + name + "']";
665 return "'"+ sep + '(' + name + " == undefined ? '' : " + name + ')' + sep + "'";
666 }
667
668 eval("this.compiled = function(values){ return " + (Ext.isGecko ? "'" : "['") +
669 me.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn) +
670 (Ext.isGecko ? "';};" : "'].join('');};"));
671 return me;
672 },
673
674
675 insertFirst: function(el, values, returnElement){
676 return this.doInsert('afterBegin', el, values, returnElement);
677 },
678
679
680 insertBefore: function(el, values, returnElement){
681 return this.doInsert('beforeBegin', el, values, returnElement);
682 },
683
684
685 insertAfter : function(el, values, returnElement){
686 return this.doInsert('afterEnd', el, values, returnElement);
687 },
688
689
690 append : function(el, values, returnElement){
691 return this.doInsert('beforeEnd', el, values, returnElement);
692 },
693
694 doInsert : function(where, el, values, returnEl){
695 el = Ext.getDom(el);
696 var newNode = Ext.DomHelper.insertHtml(where, el, this.applyTemplate(values));
697 return returnEl ? Ext.get(newNode, true) : newNode;
698 },
699
700
701 overwrite : function(el, values, returnElement){
702 el = Ext.getDom(el);
703 el.innerHTML = this.applyTemplate(values);
704 return returnElement ? Ext.get(el.firstChild, true) : el.firstChild;
705 }
706 };
707
708 Ext.Template.prototype.apply = Ext.Template.prototype.applyTemplate;
709
710
711 Ext.Template.from = function(el, config){
712 el = Ext.getDom(el);
713 return new Ext.Template(el.value || el.innerHTML, config || '');
714 };
715
716
717 Ext.DomQuery = function(){
718 var cache = {},
719 simpleCache = {},
720 valueCache = {},
721 nonSpace = /\S/,
722 trimRe = /^\s+|\s+$/g,
723 tplRe = /\{(\d+)\}/g,
724 modeRe = /^(\s?[\/>+~]\s?|\s|$)/,
725 tagTokenRe = /^(#)?([\w\-\*]+)/,
726 nthRe = /(\d*)n\+?(\d*)/,
727 nthRe2 = /\D/,
728
729
730
731 isIE = window.ActiveXObject ? true : false,
732 key = 30803;
733
734
735
736 eval("var batch = 30803;");
737
738
739
740 function child(parent, index){
741 var i = 0,
742 n = parent.firstChild;
743 while(n){
744 if(n.nodeType == 1){
745 if(++i == index){
746 return n;
747 }
748 }
749 n = n.nextSibling;
750 }
751 return null;
752 }
753
754
755 function next(n){
756 while((n = n.nextSibling) && n.nodeType != 1);
757 return n;
758 }
759
760
761 function prev(n){
762 while((n = n.previousSibling) && n.nodeType != 1);
763 return n;
764 }
765
766
767
768 function children(parent){
769 var n = parent.firstChild,
770 nodeIndex = -1,
771 nextNode;
772 while(n){
773 nextNode = n.nextSibling;
774
775 if(n.nodeType == 3 && !nonSpace.test(n.nodeValue)){
776 parent.removeChild(n);
777 }else{
778
779 n.nodeIndex = ++nodeIndex;
780 }
781 n = nextNode;
782 }
783 return this;
784 }
785
786
787
788
789 function byClassName(nodeSet, cls){
790 if(!cls){
791 return nodeSet;
792 }
793 var result = [], ri = -1;
794 for(var i = 0, ci; ci = nodeSet[i]; i++){
795 if((' '+ci.className+' ').indexOf(cls) != -1){
796 result[++ri] = ci;
797 }
798 }
799 return result;
800 };
801
802 function attrValue(n, attr){
803
804 if(!n.tagName && typeof n.length != "undefined"){
805 n = n[0];
806 }
807 if(!n){
808 return null;
809 }
810
811 if(attr == "for"){
812 return n.htmlFor;
813 }
814 if(attr == "class" || attr == "className"){
815 return n.className;
816 }
817 return n.getAttribute(attr) || n[attr];
818
819 };
820
821
822
823
824
825 function getNodes(ns, mode, tagName){
826 var result = [], ri = -1, cs;
827 if(!ns){
828 return result;
829 }
830 tagName = tagName || "*";
831
832 if(typeof ns.getElementsByTagName != "undefined"){
833 ns = [ns];
834 }
835
836
837
838 if(!mode){
839 for(var i = 0, ni; ni = ns[i]; i++){
840 cs = ni.getElementsByTagName(tagName);
841 for(var j = 0, ci; ci = cs[j]; j++){
842 result[++ri] = ci;
843 }
844 }
845
846
847 } else if(mode == "/" || mode == ">"){
848 var utag = tagName.toUpperCase();
849 for(var i = 0, ni, cn; ni = ns[i]; i++){
850 cn = ni.childNodes;
851 for(var j = 0, cj; cj = cn[j]; j++){
852 if(cj.nodeName == utag || cj.nodeName == tagName || tagName == '*'){
853 result[++ri] = cj;
854 }
855 }
856 }
857
858
859 }else if(mode == "+"){
860 var utag = tagName.toUpperCase();
861 for(var i = 0, n; n = ns[i]; i++){
862 while((n = n.nextSibling) && n.nodeType != 1);
863 if(n && (n.nodeName == utag || n.nodeName == tagName || tagName == '*')){
864 result[++ri] = n;
865 }
866 }
867
868
869 }else if(mode == "~"){
870 var utag = tagName.toUpperCase();
871 for(var i = 0, n; n = ns[i]; i++){
872 while((n = n.nextSibling)){
873 if (n.nodeName == utag || n.nodeName == tagName || tagName == '*'){
874 result[++ri] = n;
875 }
876 }
877 }
878 }
879 return result;
880 }
881
882 function concat(a, b){
883 if(b.slice){
884 return a.concat(b);
885 }
886 for(var i = 0, l = b.length; i < l; i++){
887 a[a.length] = b[i];
888 }
889 return a;
890 }
891
892 function byTag(cs, tagName){
893 if(cs.tagName || cs == document){
894 cs = [cs];
895 }
896 if(!tagName){
897 return cs;
898 }
899 var result = [], ri = -1;
900 tagName = tagName.toLowerCase();
901 for(var i = 0, ci; ci = cs[i]; i++){
902 if(ci.nodeType == 1 && ci.tagName.toLowerCase() == tagName){
903 result[++ri] = ci;
904 }
905 }
906 return result;
907 }
908
909 function byId(cs, id){
910 if(cs.tagName || cs == document){
911 cs = [cs];
912 }
913 if(!id){
914 return cs;
915 }
916 var result = [], ri = -1;
917 for(var i = 0, ci; ci = cs[i]; i++){
918 if(ci && ci.id == id){
919 result[++ri] = ci;
920 return result;
921 }
922 }
923 return result;
924 }
925
926
927
928 function byAttribute(cs, attr, value, op, custom){
929 var result = [],
930 ri = -1,
931 useGetStyle = custom == "{",
932 fn = Ext.DomQuery.operators[op],
933 a,
934 xml,
935 hasXml;
936
937 for(var i = 0, ci; ci = cs[i]; i++){
938
939 if(ci.nodeType != 1){
940 continue;
941 }
942
943 if(!hasXml){
944 xml = Ext.DomQuery.isXml(ci);
945 hasXml = true;
946 }
947
948
949 if(!xml){
950 if(useGetStyle){
951 a = Ext.DomQuery.getStyle(ci, attr);
952 } else if (attr == "class" || attr == "className"){
953 a = ci.className;
954 } else if (attr == "for"){
955 a = ci.htmlFor;
956 } else if (attr == "href"){
957
958
959 a = ci.getAttribute("href", 2);
960 } else{
961 a = ci.getAttribute(attr);
962 }
963 }else{
964 a = ci.getAttribute(attr);
965 }
966 if((fn && fn(a, value)) || (!fn && a)){
967 result[++ri] = ci;
968 }
969 }
970 return result;
971 }
972
973 function byPseudo(cs, name, value){
974 return Ext.DomQuery.pseudos[name](cs, value);
975 }
976
977 function nodupIEXml(cs){
978 var d = ++key,
979 r;
980 cs[0].setAttribute("_nodup", d);
981 r = [cs[0]];
982 for(var i = 1, len = cs.length; i < len; i++){
983 var c = cs[i];
984 if(!c.getAttribute("_nodup") != d){
985 c.setAttribute("_nodup", d);
986 r[r.length] = c;
987 }
988 }
989 for(var i = 0, len = cs.length; i < len; i++){
990 cs[i].removeAttribute("_nodup");
991 }
992 return r;
993 }
994
995 function nodup(cs){
996 if(!cs){
997 return [];
998 }
999 var len = cs.length, c, i, r = cs, cj, ri = -1;
1000 if(!len || typeof cs.nodeType != "undefined" || len == 1){
1001 return cs;
1002 }
1003 if(isIE && typeof cs[0].selectSingleNode != "undefined"){
1004 return nodupIEXml(cs);
1005 }
1006 var d = ++key;
1007 cs[0]._nodup = d;
1008 for(i = 1; c = cs[i]; i++){
1009 if(c._nodup != d){
1010 c._nodup = d;
1011 }else{
1012 r = [];
1013 for(var j = 0; j < i; j++){
1014 r[++ri] = cs[j];
1015 }
1016 for(j = i+1; cj = cs[j]; j++){
1017 if(cj._nodup != d){
1018 cj._nodup = d;
1019 r[++ri] = cj;
1020 }
1021 }
1022 return r;
1023 }
1024 }
1025 return r;
1026 }
1027
1028 function quickDiffIEXml(c1, c2){
1029 var d = ++key,
1030 r = [];
1031 for(var i = 0, len = c1.length; i < len; i++){
1032 c1[i].setAttribute("_qdiff", d);
1033 }
1034 for(var i = 0, len = c2.length; i < len; i++){
1035 if(c2[i].getAttribute("_qdiff") != d){
1036 r[r.length] = c2[i];
1037 }
1038 }
1039 for(var i = 0, len = c1.length; i < len; i++){
1040 c1[i].removeAttribute("_qdiff");
1041 }
1042 return r;
1043 }
1044
1045 function quickDiff(c1, c2){
1046 var len1 = c1.length,
1047 d = ++key,
1048 r = [];
1049 if(!len1){
1050 return c2;
1051 }
1052 if(isIE && typeof c1[0].selectSingleNode != "undefined"){
1053 return quickDiffIEXml(c1, c2);
1054 }
1055 for(var i = 0; i < len1; i++){
1056 c1[i]._qdiff = d;
1057 }
1058 for(var i = 0, len = c2.length; i < len; i++){
1059 if(c2[i]._qdiff != d){
1060 r[r.length] = c2[i];
1061 }
1062 }
1063 return r;
1064 }
1065
1066 function quickId(ns, mode, root, id){
1067 if(ns == root){
1068 var d = root.ownerDocument || root;
1069 return d.getElementById(id);
1070 }
1071 ns = getNodes(ns, mode, "*");
1072 return byId(ns, id);
1073 }
1074
1075 return {
1076 getStyle : function(el, name){
1077 return Ext.fly(el).getStyle(name);
1078 },
1079
1080 compile : function(path, type){
1081 type = type || "select";
1082
1083
1084 var fn = ["var f = function(root){\n var mode; ++batch; var n = root || document;\n"],
1085 mode,
1086 lastPath,
1087 matchers = Ext.DomQuery.matchers,
1088 matchersLn = matchers.length,
1089 modeMatch,
1090
1091 lmode = path.match(modeRe);
1092
1093 if(lmode && lmode[1]){
1094 fn[fn.length] = 'mode="'+lmode[1].replace(trimRe, "")+'";';
1095 path = path.replace(lmode[1], "");
1096 }
1097
1098
1099 while(path.substr(0, 1)=="/"){
1100 path = path.substr(1);
1101 }
1102
1103 while(path && lastPath != path){
1104 lastPath = path;
1105 var tokenMatch = path.match(tagTokenRe);
1106 if(type == "select"){
1107 if(tokenMatch){
1108
1109 if(tokenMatch[1] == "#"){
1110 fn[fn.length] = 'n = quickId(n, mode, root, "'+tokenMatch[2]+'");';
1111 }else{
1112 fn[fn.length] = 'n = getNodes(n, mode, "'+tokenMatch[2]+'");';
1113 }
1114 path = path.replace(tokenMatch[0], "");
1115 }else if(path.substr(0, 1) != '@'){
1116 fn[fn.length] = 'n = getNodes(n, mode, "*");';
1117 }
1118
1119 }else{
1120 if(tokenMatch){
1121 if(tokenMatch[1] == "#"){
1122 fn[fn.length] = 'n = byId(n, "'+tokenMatch[2]+'");';
1123 }else{
1124 fn[fn.length] = 'n = byTag(n, "'+tokenMatch[2]+'");';
1125 }
1126 path = path.replace(tokenMatch[0], "");
1127 }
1128 }
1129 while(!(modeMatch = path.match(modeRe))){
1130 var matched = false;
1131 for(var j = 0; j < matchersLn; j++){
1132 var t = matchers[j];
1133 var m = path.match(t.re);
1134 if(m){
1135 fn[fn.length] = t.select.replace(tplRe, function(x, i){
1136 return m[i];
1137 });
1138 path = path.replace(m[0], "");
1139 matched = true;
1140 break;
1141 }
1142 }
1143
1144 if(!matched){
1145 throw 'Error parsing selector, parsing failed at "' + path + '"';
1146 }
1147 }
1148 if(modeMatch[1]){
1149 fn[fn.length] = 'mode="'+modeMatch[1].replace(trimRe, "")+'";';
1150 path = path.replace(modeMatch[1], "");
1151 }
1152 }
1153
1154 fn[fn.length] = "return nodup(n);\n}";
1155
1156
1157 eval(fn.join(""));
1158 return f;
1159 },
1160
1161
1162 jsSelect: function(path, root, type){
1163
1164 root = root || document;
1165
1166 if(typeof root == "string"){
1167 root = document.getElementById(root);
1168 }
1169 var paths = path.split(","),
1170 results = [];
1171
1172
1173 for(var i = 0, len = paths.length; i < len; i++){
1174 var subPath = paths[i].replace(trimRe, "");
1175
1176 if(!cache[subPath]){
1177 cache[subPath] = Ext.DomQuery.compile(subPath);
1178 if(!cache[subPath]){
1179 throw subPath + " is not a valid selector";
1180 }
1181 }
1182 var result = cache[subPath](root);
1183 if(result && result != document){
1184 results = results.concat(result);
1185 }
1186 }
1187
1188
1189
1190 if(paths.length > 1){
1191 return nodup(results);
1192 }
1193 return results;
1194 },
1195 isXml: function(el) {
1196 var docEl = (el ? el.ownerDocument || el : 0).documentElement;
1197 return docEl ? docEl.nodeName !== "HTML" : false;
1198 },
1199 select : document.querySelectorAll ? function(path, root, type) {
1200 root = root || document;
1201 if (!Ext.DomQuery.isXml(root)) {
1202 try {
1203 var cs = root.querySelectorAll(path);
1204 return Ext.toArray(cs);
1205 }
1206 catch (ex) {}
1207 }
1208 return Ext.DomQuery.jsSelect.call(this, path, root, type);
1209 } : function(path, root, type) {
1210 return Ext.DomQuery.jsSelect.call(this, path, root, type);
1211 },
1212
1213
1214 selectNode : function(path, root){
1215 return Ext.DomQuery.select(path, root)[0];
1216 },
1217
1218
1219 selectValue : function(path, root, defaultValue){
1220 path = path.replace(trimRe, "");
1221 if(!valueCache[path]){
1222 valueCache[path] = Ext.DomQuery.compile(path, "select");
1223 }
1224 var n = valueCache[path](root), v;
1225 n = n[0] ? n[0] : n;
1226
1227
1228
1229
1230
1231 if (typeof n.normalize == 'function') n.normalize();
1232
1233 v = (n && n.firstChild ? n.firstChild.nodeValue : null);
1234 return ((v === null||v === undefined||v==='') ? defaultValue : v);
1235 },
1236
1237
1238 selectNumber : function(path, root, defaultValue){
1239 var v = Ext.DomQuery.selectValue(path, root, defaultValue || 0);
1240 return parseFloat(v);
1241 },
1242
1243
1244 is : function(el, ss){
1245 if(typeof el == "string"){
1246 el = document.getElementById(el);
1247 }
1248 var isArray = Ext.isArray(el),
1249 result = Ext.DomQuery.filter(isArray ? el : [el], ss);
1250 return isArray ? (result.length == el.length) : (result.length > 0);
1251 },
1252
1253
1254 filter : function(els, ss, nonMatches){
1255 ss = ss.replace(trimRe, "");
1256 if(!simpleCache[ss]){
1257 simpleCache[ss] = Ext.DomQuery.compile(ss, "simple");
1258 }
1259 var result = simpleCache[ss](els);
1260 return nonMatches ? quickDiff(result, els) : result;
1261 },
1262
1263
1264 matchers : [{
1265 re: /^\.([\w\-]+)/,
1266 select: 'n = byClassName(n, " {1} ");'
1267 }, {
1268 re: /^\:([\w\-]+)(?:\(((?:[^\s>\/]*|.*?))\))?/,
1269 select: 'n = byPseudo(n, "{1}", "{2}");'
1270 },{
1271 re: /^(?:([\[\{])(?:@)?([\w\-]+)\s?(?:(=|.=)\s?(["']?)(.*?)\4)?[\]\}])/,
1272 select: 'n = byAttribute(n, "{2}", "{5}", "{3}", "{1}");'
1273 }, {
1274 re: /^#([\w\-]+)/,
1275 select: 'n = byId(n, "{1}");'
1276 },{
1277 re: /^@([\w\-]+)/,
1278 select: 'return {firstChild:{nodeValue:attrValue(n, "{1}")}};'
1279 }
1280 ],
1281
1282 /**
1283 * Collection of operator comparison functions. The default operators are =, !=, ^=, $=, *=, %=, |= and ~=.
1284 * New operators can be added as long as the match the format <i>c</i>= where <i>c</i> is any character other than space, &gt; &lt;.
1285 */
1286 operators : {
1287 "=" : function(a, v){
1288 return a == v;
1289 },
1290 "!=" : function(a, v){
1291 return a != v;
1292 },
1293 "^=" : function(a, v){
1294 return a && a.substr(0, v.length) == v;
1295 },
1296 "$=" : function(a, v){
1297 return a && a.substr(a.length-v.length) == v;
1298 },
1299 "*=" : function(a, v){
1300 return a && a.indexOf(v) !== -1;
1301 },
1302 "%=" : function(a, v){
1303 return (a % v) == 0;
1304 },
1305 "|=" : function(a, v){
1306 return a && (a == v || a.substr(0, v.length+1) == v+'-');
1307 },
1308 "~=" : function(a, v){
1309 return a && (' '+a+' ').indexOf(' '+v+' ') != -1;
1310 }
1311 },
1312
1313 /**
1314 * <p>Object hash of "pseudo class" filter functions which are used when filtering selections. Each function is passed
1315 * two parameters:</p><div class="mdetail-params"><ul>
1316 * <li><b>c</b> : Array<div class="sub-desc">An Array of DOM elements to filter.</div></li>
1317 * <li><b>v</b> : String<div class="sub-desc">The argument (if any) supplied in the selector.</div></li>
1318 * </ul></div>
1319 * <p>A filter function returns an Array of DOM elements which conform to the pseudo class.</p>
1320 * <p>In addition to the provided pseudo classes listed above such as <code>first-child</code> and <code>nth-child</code>,
1321 * developers may add additional, custom psuedo class filters to select elements according to application-specific requirements.</p>
1322 * <p>For example, to filter <code>&lt;a></code> elements to only return links to <i>external</i> resources:</p>
1323 * <code><pre>
1324 Ext.DomQuery.pseudos.external = function(c, v){
1325 var r = [], ri = -1;
1326 for(var i = 0, ci; ci = c[i]; i++){
1327 // Include in result set only if it's a link to an external resource
1328 if(ci.hostname != location.hostname){
1329 r[++ri] = ci;
1330 }
1331 }
1332 return r;
1333 };</pre></code>
1334 * Then external links could be gathered with the following statement:<code><pre>
1335 var externalLinks = Ext.select("a:external");
1336 </code></pre>
1337 */
1338 pseudos : {
1339 "first-child" : function(c){
1340 var r = [], ri = -1, n;
1341 for(var i = 0, ci; ci = n = c[i]; i++){
1342 while((n = n.previousSibling) && n.nodeType != 1);
1343 if(!n){
1344 r[++ri] = ci;
1345 }
1346 }
1347 return r;
1348 },
1349
1350 "last-child" : function(c){
1351 var r = [], ri = -1, n;
1352 for(var i = 0, ci; ci = n = c[i]; i++){
1353 while((n = n.nextSibling) && n.nodeType != 1);
1354 if(!n){
1355 r[++ri] = ci;
1356 }
1357 }
1358 return r;
1359 },
1360
1361 "nth-child" : function(c, a) {
1362 var r = [], ri = -1,
1363 m = nthRe.exec(a == "even" && "2n" || a == "odd" && "2n+1" || !nthRe2.test(a) && "n+" + a || a),
1364 f = (m[1] || 1) - 0, l = m[2] - 0;
1365 for(var i = 0, n; n = c[i]; i++){
1366 var pn = n.parentNode;
1367 if (batch != pn._batch) {
1368 var j = 0;
1369 for(var cn = pn.firstChild; cn; cn = cn.nextSibling){
1370 if(cn.nodeType == 1){
1371 cn.nodeIndex = ++j;
1372 }
1373 }
1374 pn._batch = batch;
1375 }
1376 if (f == 1) {
1377 if (l == 0 || n.nodeIndex == l){
1378 r[++ri] = n;
1379 }
1380 } else if ((n.nodeIndex + l) % f == 0){
1381 r[++ri] = n;
1382 }
1383 }
1384
1385 return r;
1386 },
1387
1388 "only-child" : function(c){
1389 var r = [], ri = -1;;
1390 for(var i = 0, ci; ci = c[i]; i++){
1391 if(!prev(ci) && !next(ci)){
1392 r[++ri] = ci;
1393 }
1394 }
1395 return r;
1396 },
1397
1398 "empty" : function(c){
1399 var r = [], ri = -1;
1400 for(var i = 0, ci; ci = c[i]; i++){
1401 var cns = ci.childNodes, j = 0, cn, empty = true;
1402 while(cn = cns[j]){
1403 ++j;
1404 if(cn.nodeType == 1 || cn.nodeType == 3){
1405 empty = false;
1406 break;
1407 }
1408 }
1409 if(empty){
1410 r[++ri] = ci;
1411 }
1412 }
1413 return r;
1414 },
1415
1416 "contains" : function(c, v){
1417 var r = [], ri = -1;
1418 for(var i = 0, ci; ci = c[i]; i++){
1419 if((ci.textContent||ci.innerText||'').indexOf(v) != -1){
1420 r[++ri] = ci;
1421 }
1422 }
1423 return r;
1424 },
1425
1426 "nodeValue" : function(c, v){
1427 var r = [], ri = -1;
1428 for(var i = 0, ci; ci = c[i]; i++){
1429 if(ci.firstChild && ci.firstChild.nodeValue == v){
1430 r[++ri] = ci;
1431 }
1432 }
1433 return r;
1434 },
1435
1436 "checked" : function(c){
1437 var r = [], ri = -1;
1438 for(var i = 0, ci; ci = c[i]; i++){
1439 if(ci.checked == true){
1440 r[++ri] = ci;
1441 }
1442 }
1443 return r;
1444 },
1445
1446 "not" : function(c, ss){
1447 return Ext.DomQuery.filter(c, ss, true);
1448 },
1449
1450 "any" : function(c, selectors){
1451 var ss = selectors.split('|'),
1452 r = [], ri = -1, s;
1453 for(var i = 0, ci; ci = c[i]; i++){
1454 for(var j = 0; s = ss[j]; j++){
1455 if(Ext.DomQuery.is(ci, s)){
1456 r[++ri] = ci;
1457 break;
1458 }
1459 }
1460 }
1461 return r;
1462 },
1463
1464 "odd" : function(c){
1465 return this["nth-child"](c, "odd");
1466 },
1467
1468 "even" : function(c){
1469 return this["nth-child"](c, "even");
1470 },
1471
1472 "nth" : function(c, a){
1473 return c[a-1] || [];
1474 },
1475
1476 "first" : function(c){
1477 return c[0] || [];
1478 },
1479
1480 "last" : function(c){
1481 return c[c.length-1] || [];
1482 },
1483
1484 "has" : function(c, ss){
1485 var s = Ext.DomQuery.select,
1486 r = [], ri = -1;
1487 for(var i = 0, ci; ci = c[i]; i++){
1488 if(s(ss, ci).length > 0){
1489 r[++ri] = ci;
1490 }
1491 }
1492 return r;
1493 },
1494
1495 "next" : function(c, ss){
1496 var is = Ext.DomQuery.is,
1497 r = [], ri = -1;
1498 for(var i = 0, ci; ci = c[i]; i++){
1499 var n = next(ci);
1500 if(n && is(n, ss)){
1501 r[++ri] = ci;
1502 }
1503 }
1504 return r;
1505 },
1506
1507 "prev" : function(c, ss){
1508 var is = Ext.DomQuery.is,
1509 r = [], ri = -1;
1510 for(var i = 0, ci; ci = c[i]; i++){
1511 var n = prev(ci);
1512 if(n && is(n, ss)){
1513 r[++ri] = ci;
1514 }
1515 }
1516 return r;
1517 }
1518 }
1519 };
1520 }();
1521
1522 /**
1523 * Selects an array of DOM nodes by CSS/XPath selector. Shorthand of {@link Ext.DomQuery#select}
1524 * @param {String} path The selector/xpath query
1525 * @param {Node} root (optional) The start of the query (defaults to document).
1526 * @return {Array}
1527 * @member Ext
1528 * @method query
1529 */
1530 Ext.query = Ext.DomQuery.select;
1531 /**
1532 * @class Ext.util.DelayedTask
1533 * <p> The DelayedTask class provides a convenient way to "buffer" the execution of a method,
1534 * performing setTimeout where a new timeout cancels the old timeout. When called, the
1535 * task will wait the specified time period before executing. If durng that time period,
1536 * the task is called again, the original call will be cancelled. This continues so that
1537 * the function is only called a single time for each iteration.</p>
1538 * <p>This method is especially useful for things like detecting whether a user has finished
1539 * typing in a text field. An example would be performing validation on a keypress. You can
1540 * use this class to buffer the keypress events for a certain number of milliseconds, and
1541 * perform only if they stop for that amount of time. Usage:</p><pre><code>
1542 var task = new Ext.util.DelayedTask(function(){
1543 alert(Ext.getDom('myInputField').value.length);
1544 });
1545 // Wait 500ms before calling our function. If the user presses another key
1546 // during that 500ms, it will be cancelled and we'll wait another 500ms.
1547 Ext.get('myInputField').on('keypress', function(){
1548 task.{@link #delay}(500);
1549 });
1550 * </code></pre>
1551 * <p>Note that we are using a DelayedTask here to illustrate a point. The configuration
1552 * option <tt>buffer</tt> for {@link Ext.util.Observable#addListener addListener/on} will
1553 * also setup a delayed task for you to buffer events.</p>
1554 * @constructor The parameters to this constructor serve as defaults and are not required.
1555 * @param {Function} fn (optional) The default function to call.
1556 * @param {Object} scope (optional) The default scope (The <code><b>this</b></code> reference) in which the
1557 * function is called. If not specified, <code>this</code> will refer to the browser window.
1558 * @param {Array} args (optional) The default Array of arguments.
1559 */
1560 Ext.util.DelayedTask = function(fn, scope, args){
1561 var me = this,
1562 id,
1563 call = function(){
1564 clearInterval(id);
1565 id = null;
1566 fn.apply(scope, args || []);
1567 };
1568
1569 /**
1570 * Cancels any pending timeout and queues a new one
1571 * @param {Number} delay The milliseconds to delay
1572 * @param {Function} newFn (optional) Overrides function passed to constructor
1573 * @param {Object} newScope (optional) Overrides scope passed to constructor. Remember that if no scope
1574 * is specified, <code>this</code> will refer to the browser window.
1575 * @param {Array} newArgs (optional) Overrides args passed to constructor
1576 */
1577 me.delay = function(delay, newFn, newScope, newArgs){
1578 me.cancel();
1579 fn = newFn || fn;
1580 scope = newScope || scope;
1581 args = newArgs || args;
1582 id = setInterval(call, delay);
1583 };
1584
1585 /**
1586 * Cancel the last queued timeout
1587 */
1588 me.cancel = function(){
1589 if(id){
1590 clearInterval(id);
1591 id = null;
1592 }
1593 };
1594 };/**
1595 * @class Ext.Element
1596 * <p>Encapsulates a DOM element, adding simple DOM manipulation facilities, normalizing for browser differences.</p>
1597 * <p>All instances of this class inherit the methods of {@link Ext.Fx} making visual effects easily available to all DOM elements.</p>
1598 * <p>Note that the events documented in this class are not Ext events, they encapsulate browser events. To
1599 * access the underlying browser event, see {@link Ext.EventObject#browserEvent}. Some older
1600 * browsers may not support the full range of events. Which events are supported is beyond the control of ExtJs.</p>
1601 * Usage:<br>
1602 <pre><code>
1603 // by id
1604 var el = Ext.get("my-div");
1605
1606 // by DOM element reference
1607 var el = Ext.get(myDivElement);
1608 </code></pre>
1609 * <b>Animations</b><br />
1610 * <p>When an element is manipulated, by default there is no animation.</p>
1611 * <pre><code>
1612 var el = Ext.get("my-div");
1613
1614 // no animation
1615 el.setWidth(100);
1616 * </code></pre>
1617 * <p>Many of the functions for manipulating an element have an optional "animate" parameter. This
1618 * parameter can be specified as boolean (<tt>true</tt>) for default animation effects.</p>
1619 * <pre><code>
1620 // default animation
1621 el.setWidth(100, true);
1622 * </code></pre>
1623 *
1624 * <p>To configure the effects, an object literal with animation options to use as the Element animation
1625 * configuration object can also be specified. Note that the supported Element animation configuration
1626 * options are a subset of the {@link Ext.Fx} animation options specific to Fx effects. The supported
1627 * Element animation configuration options are:</p>
1628 <pre>
1629 Option Default Description
1630 --------- -------- ---------------------------------------------
1631 {@link Ext.Fx#duration duration} .35 The duration of the animation in seconds
1632 {@link Ext.Fx#easing easing} easeOut The easing method
1633 {@link Ext.Fx#callback callback} none A function to execute when the anim completes
1634 {@link Ext.Fx#scope scope} this The scope (this) of the callback function
1635 </pre>
1636 *
1637 * <pre><code>
1638 // Element animation options object
1639 var opt = {
1640 {@link Ext.Fx#duration duration}: 1,
1641 {@link Ext.Fx#easing easing}: 'elasticIn',
1642 {@link Ext.Fx#callback callback}: this.foo,
1643 {@link Ext.Fx#scope scope}: this
1644 };
1645 // animation with some options set
1646 el.setWidth(100, opt);
1647 * </code></pre>
1648 * <p>The Element animation object being used for the animation will be set on the options
1649 * object as "anim", which allows you to stop or manipulate the animation. Here is an example:</p>
1650 * <pre><code>
1651 // using the "anim" property to get the Anim object
1652 if(opt.anim.isAnimated()){
1653 opt.anim.stop();
1654 }
1655 * </code></pre>
1656 * <p>Also see the <tt>{@link #animate}</tt> method for another animation technique.</p>
1657 * <p><b> Composite (Collections of) Elements</b></p>
1658 * <p>For working with collections of Elements, see {@link Ext.CompositeElement}</p>
1659 * @constructor Create a new Element directly.
1660 * @param {String/HTMLElement} element
1661 * @param {Boolean} forceNew (optional) By default the constructor checks to see if there is already an instance of this element in the cache and if there is it returns the same instance. This will skip that check (useful for extending this class).
1662 */
1663 (function(){
1664 var DOC = document;
1665
1666 Ext.Element = function(element, forceNew){
1667 var dom = typeof element == "string" ?
1668 DOC.getElementById(element) : element,
1669 id;
1670
1671 if(!dom) return null;
1672
1673 id = dom.id;
1674
1675 if(!forceNew && id && Ext.elCache[id]){ // element object already exists
1676 return Ext.elCache[id].el;
1677 }
1678
1679 /**
1680 * The DOM element
1681 * @type HTMLElement
1682 */
1683 this.dom = dom;
1684
1685 /**
1686 * The DOM element ID
1687 * @type String
1688 */
1689 this.id = id || Ext.id(dom);
1690 };
1691
1692 var DH = Ext.DomHelper,
1693 El = Ext.Element,
1694 EC = Ext.elCache;
1695
1696 El.prototype = {
1697 /**
1698 * Sets the passed attributes as attributes of this element (a style attribute can be a string, object or function)
1699 * @param {Object} o The object with the attributes
1700 * @param {Boolean} useSet (optional) false to override the default setAttribute to use expandos.
1701 * @return {Ext.Element} this
1702 */
1703 set : function(o, useSet){
1704 var el = this.dom,
1705 attr,
1706 val,
1707 useSet = (useSet !== false) && !!el.setAttribute;
1708
1709 for (attr in o) {
1710 if (o.hasOwnProperty(attr)) {
1711 val = o[attr];
1712 if (attr == 'style') {
1713 DH.applyStyles(el, val);
1714 } else if (attr == 'cls') {
1715 el.className = val;
1716 } else if (useSet) {
1717 el.setAttribute(attr, val);
1718 } else {
1719 el[attr] = val;
1720 }
1721 }
1722 }
1723 return this;
1724 },
1725
1726 // Mouse events
1727 /**
1728 * @event click
1729 * Fires when a mouse click is detected within the element.
1730 * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
1731 * @param {HtmlElement} t The target of the event.
1732 * @param {Object} o The options configuration passed to the {@link #addListener} call.
1733 */
1734 /**
1735 * @event contextmenu
1736 * Fires when a right click is detected within the element.
1737 * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
1738 * @param {HtmlElement} t The target of the event.
1739 * @param {Object} o The options configuration passed to the {@link #addListener} call.
1740 */
1741 /**
1742 * @event dblclick
1743 * Fires when a mouse double click is detected within the element.
1744 * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
1745 * @param {HtmlElement} t The target of the event.
1746 * @param {Object} o The options configuration passed to the {@link #addListener} call.
1747 */
1748 /**
1749 * @event mousedown
1750 * Fires when a mousedown is detected within the element.
1751 * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
1752 * @param {HtmlElement} t The target of the event.
1753 * @param {Object} o The options configuration passed to the {@link #addListener} call.
1754 */
1755 /**
1756 * @event mouseup
1757 * Fires when a mouseup is detected within the element.
1758 * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
1759 * @param {HtmlElement} t The target of the event.
1760 * @param {Object} o The options configuration passed to the {@link #addListener} call.
1761 */
1762 /**
1763 * @event mouseover
1764 * Fires when a mouseover is detected within the element.
1765 * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
1766 * @param {HtmlElement} t The target of the event.
1767 * @param {Object} o The options configuration passed to the {@link #addListener} call.
1768 */
1769 /**
1770 * @event mousemove
1771 * Fires when a mousemove is detected with the element.
1772 * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
1773 * @param {HtmlElement} t The target of the event.
1774 * @param {Object} o The options configuration passed to the {@link #addListener} call.
1775 */
1776 /**
1777 * @event mouseout
1778 * Fires when a mouseout is detected with the element.
1779 * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
1780 * @param {HtmlElement} t The target of the event.
1781 * @param {Object} o The options configuration passed to the {@link #addListener} call.
1782 */
1783 /**
1784 * @event mouseenter
1785 * Fires when the mouse enters the element.
1786 * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
1787 * @param {HtmlElement} t The target of the event.
1788 * @param {Object} o The options configuration passed to the {@link #addListener} call.
1789 */
1790 /**
1791 * @event mouseleave
1792 * Fires when the mouse leaves the element.
1793 * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
1794 * @param {HtmlElement} t The target of the event.
1795 * @param {Object} o The options configuration passed to the {@link #addListener} call.
1796 */
1797
1798 // Keyboard events
1799 /**
1800 * @event keypress
1801 * Fires when a keypress is detected within the element.
1802 * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
1803 * @param {HtmlElement} t The target of the event.
1804 * @param {Object} o The options configuration passed to the {@link #addListener} call.
1805 */
1806 /**
1807 * @event keydown
1808 * Fires when a keydown is detected within the element.
1809 * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
1810 * @param {HtmlElement} t The target of the event.
1811 * @param {Object} o The options configuration passed to the {@link #addListener} call.
1812 */
1813 /**
1814 * @event keyup
1815 * Fires when a keyup is detected within the element.
1816 * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
1817 * @param {HtmlElement} t The target of the event.
1818 * @param {Object} o The options configuration passed to the {@link #addListener} call.
1819 */
1820
1821
1822 // HTML frame/object events
1823 /**
1824 * @event load
1825 * Fires when the user agent finishes loading all content within the element. Only supported by window, frames, objects and images.
1826 * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
1827 * @param {HtmlElement} t The target of the event.
1828 * @param {Object} o The options configuration passed to the {@link #addListener} call.
1829 */
1830 /**
1831 * @event unload
1832 * Fires when the user agent removes all content from a window or frame. For elements, it fires when the target element or any of its content has been removed.
1833 * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
1834 * @param {HtmlElement} t The target of the event.
1835 * @param {Object} o The options configuration passed to the {@link #addListener} call.
1836 */
1837 /**
1838 * @event abort
1839 * Fires when an object/image is stopped from loading before completely loaded.
1840 * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
1841 * @param {HtmlElement} t The target of the event.
1842 * @param {Object} o The options configuration passed to the {@link #addListener} call.
1843 */
1844 /**
1845 * @event error
1846 * Fires when an object/image/frame cannot be loaded properly.
1847 * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
1848 * @param {HtmlElement} t The target of the event.
1849 * @param {Object} o The options configuration passed to the {@link #addListener} call.
1850 */
1851 /**
1852 * @event resize
1853 * Fires when a document view is resized.
1854 * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
1855 * @param {HtmlElement} t The target of the event.
1856 * @param {Object} o The options configuration passed to the {@link #addListener} call.
1857 */
1858 /**
1859 * @event scroll
1860 * Fires when a document view is scrolled.
1861 * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
1862 * @param {HtmlElement} t The target of the event.
1863 * @param {Object} o The options configuration passed to the {@link #addListener} call.
1864 */
1865
1866 // Form events
1867 /**
1868 * @event select
1869 * Fires when a user selects some text in a text field, including input and textarea.
1870 * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
1871 * @param {HtmlElement} t The target of the event.
1872 * @param {Object} o The options configuration passed to the {@link #addListener} call.
1873 */
1874 /**
1875 * @event change
1876 * Fires when a control loses the input focus and its value has been modified since gaining focus.
1877 * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
1878 * @param {HtmlElement} t The target of the event.
1879 * @param {Object} o The options configuration passed to the {@link #addListener} call.
1880 */
1881 /**
1882 * @event submit
1883 * Fires when a form is submitted.
1884 * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
1885 * @param {HtmlElement} t The target of the event.
1886 * @param {Object} o The options configuration passed to the {@link #addListener} call.
1887 */
1888 /**
1889 * @event reset
1890 * Fires when a form is reset.
1891 * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
1892 * @param {HtmlElement} t The target of the event.
1893 * @param {Object} o The options configuration passed to the {@link #addListener} call.
1894 */
1895 /**
1896 * @event focus
1897 * Fires when an element receives focus either via the pointing device or by tab navigation.
1898 * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
1899 * @param {HtmlElement} t The target of the event.
1900 * @param {Object} o The options configuration passed to the {@link #addListener} call.
1901 */
1902 /**
1903 * @event blur
1904 * Fires when an element loses focus either via the pointing device or by tabbing navigation.
1905 * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
1906 * @param {HtmlElement} t The target of the event.
1907 * @param {Object} o The options configuration passed to the {@link #addListener} call.
1908 */
1909
1910 // User Interface events
1911 /**
1912 * @event DOMFocusIn
1913 * Where supported. Similar to HTML focus event, but can be applied to any focusable element.
1914 * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
1915 * @param {HtmlElement} t The target of the event.
1916 * @param {Object} o The options configuration passed to the {@link #addListener} call.
1917 */
1918 /**
1919 * @event DOMFocusOut
1920 * Where supported. Similar to HTML blur event, but can be applied to any focusable element.
1921 * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
1922 * @param {HtmlElement} t The target of the event.
1923 * @param {Object} o The options configuration passed to the {@link #addListener} call.
1924 */
1925 /**
1926 * @event DOMActivate
1927 * Where supported. Fires when an element is activated, for instance, through a mouse click or a keypress.
1928 * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
1929 * @param {HtmlElement} t The target of the event.
1930 * @param {Object} o The options configuration passed to the {@link #addListener} call.
1931 */
1932
1933 // DOM Mutation events
1934 /**
1935 * @event DOMSubtreeModified
1936 * Where supported. Fires when the subtree is modified.
1937 * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
1938 * @param {HtmlElement} t The target of the event.
1939 * @param {Object} o The options configuration passed to the {@link #addListener} call.
1940 */
1941 /**
1942 * @event DOMNodeInserted
1943 * Where supported. Fires when a node has been added as a child of another node.
1944 * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
1945 * @param {HtmlElement} t The target of the event.
1946 * @param {Object} o The options configuration passed to the {@link #addListener} call.
1947 */
1948 /**
1949 * @event DOMNodeRemoved
1950 * Where supported. Fires when a descendant node of the element is removed.
1951 * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
1952 * @param {HtmlElement} t The target of the event.
1953 * @param {Object} o The options configuration passed to the {@link #addListener} call.
1954 */
1955 /**
1956 * @event DOMNodeRemovedFromDocument
1957 * Where supported. Fires when a node is being removed from a document.
1958 * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
1959 * @param {HtmlElement} t The target of the event.
1960 * @param {Object} o The options configuration passed to the {@link #addListener} call.
1961 */
1962 /**
1963 * @event DOMNodeInsertedIntoDocument
1964 * Where supported. Fires when a node is being inserted into a document.
1965 * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
1966 * @param {HtmlElement} t The target of the event.
1967 * @param {Object} o The options configuration passed to the {@link #addListener} call.
1968 */
1969 /**
1970 * @event DOMAttrModified
1971 * Where supported. Fires when an attribute has been modified.
1972 * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
1973 * @param {HtmlElement} t The target of the event.
1974 * @param {Object} o The options configuration passed to the {@link #addListener} call.
1975 */
1976 /**
1977 * @event DOMCharacterDataModified
1978 * Where supported. Fires when the character data has been modified.
1979 * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
1980 * @param {HtmlElement} t The target of the event.
1981 * @param {Object} o The options configuration passed to the {@link #addListener} call.
1982 */
1983
1984 /**
1985 * The default unit to append to CSS values where a unit isn't provided (defaults to px).
1986 * @type String
1987 */
1988 defaultUnit : "px",
1989
1990 /**
1991 * Returns true if this element matches the passed simple selector (e.g. div.some-class or span:first-child)
1992 * @param {String} selector The simple selector to test
1993 * @return {Boolean} True if this element matches the selector, else false
1994 */
1995 is : function(simpleSelector){
1996 return Ext.DomQuery.is(this.dom, simpleSelector);
1997 },
1998
1999 /**
2000 * Tries to focus the element. Any exceptions are caught and ignored.
2001 * @param {Number} defer (optional) Milliseconds to defer the focus
2002 * @return {Ext.Element} this
2003 */
2004 focus : function(defer, /* private */ dom) {
2005 var me = this,
2006 dom = dom || me.dom;
2007 try{
2008 if(Number(defer)){
2009 me.focus.defer(defer, null, [null, dom]);
2010 }else{
2011 dom.focus();
2012 }
2013 }catch(e){}
2014 return me;
2015 },
2016
2017 /**
2018 * Tries to blur the element. Any exceptions are caught and ignored.
2019 * @return {Ext.Element} this
2020 */
2021 blur : function() {
2022 try{
2023 this.dom.blur();
2024 }catch(e){}
2025 return this;
2026 },
2027
2028 /**
2029 * Returns the value of the "value" attribute
2030 * @param {Boolean} asNumber true to parse the value as a number
2031 * @return {String/Number}
2032 */
2033 getValue : function(asNumber){
2034 var val = this.dom.value;
2035 return asNumber ? parseInt(val, 10) : val;
2036 },
2037
2038 /**
2039 * Appends an event handler to this element. The shorthand version {@link #on} is equivalent.
2040 * @param {String} eventName The name of event to handle.
2041 * @param {Function} fn The handler function the event invokes. This function is passed
2042 * the following parameters:<ul>
2043 * <li><b>evt</b> : EventObject<div class="sub-desc">The {@link Ext.EventObject EventObject} describing the event.</div></li>
2044 * <li><b>el</b> : HtmlElement<div class="sub-desc">The DOM element which was the target of the event.
2045 * Note that this may be filtered by using the <tt>delegate</tt> option.</div></li>
2046 * <li><b>o</b> : Object<div class="sub-desc">The options object from the addListener call.</div></li>
2047 * </ul>
2048 * @param {Object} scope (optional) The scope (<code><b>this</b></code> reference) in which the handler function is executed.
2049 * <b>If omitted, defaults to this Element.</b>.
2050 * @param {Object} options (optional) An object containing handler configuration properties.
2051 * This may contain any of the following properties:<ul>
2052 * <li><b>scope</b> Object : <div class="sub-desc">The scope (<code><b>this</b></code> reference) in which the handler function is executed.
2053 * <b>If omitted, defaults to this Element.</b></div></li>
2054 * <li><b>delegate</b> String: <div class="sub-desc">A simple selector to filter the target or look for a descendant of the target. See below for additional details.</div></li>
2055 * <li><b>stopEvent</b> Boolean: <div class="sub-desc">True to stop the event. That is stop propagation, and prevent the default action.</div></li>
2056 * <li><b>preventDefault</b> Boolean: <div class="sub-desc">True to prevent the default action</div></li>
2057 * <li><b>stopPropagation</b> Boolean: <div class="sub-desc">True to prevent event propagation</div></li>
2058 * <li><b>normalized</b> Boolean: <div class="sub-desc">False to pass a browser event to the handler function instead of an Ext.EventObject</div></li>
2059 * <li><b>target</b> Ext.Element: <div class="sub-desc">Only call the handler if the event was fired on the target Element, <i>not</i> if the event was bubbled up from a child node.</div></li>
2060 * <li><b>delay</b> Number: <div class="sub-desc">The number of milliseconds to delay the invocation of the handler after the event fires.</div></li>
2061 * <li><b>single</b> Boolean: <div class="sub-desc">True to add a handler to handle just the next firing of the event, and then remove itself.</div></li>
2062 * <li><b>buffer</b> Number: <div class="sub-desc">Causes the handler to be scheduled to run in an {@link Ext.util.DelayedTask} delayed
2063 * by the specified number of milliseconds. If the event fires again within that time, the original
2064 * handler is <em>not</em> invoked, but the new handler is scheduled in its place.</div></li>
2065 * </ul><br>
2066 * <p>
2067 * <b>Combining Options</b><br>
2068 * In the following examples, the shorthand form {@link #on} is used rather than the more verbose
2069 * addListener. The two are equivalent. Using the options argument, it is possible to combine different
2070 * types of listeners:<br>
2071 * <br>
2072 * A delayed, one-time listener that auto stops the event and adds a custom argument (forumId) to the
2073 * options object. The options object is available as the third parameter in the handler function.<div style="margin: 5px 20px 20px;">
2074 * Code:<pre><code>
2075 el.on('click', this.onClick, this, {
2076 single: true,
2077 delay: 100,
2078 stopEvent : true,
2079 forumId: 4
2080 });</code></pre></p>
2081 * <p>
2082 * <b>Attaching multiple handlers in 1 call</b><br>
2083 * The method also allows for a single argument to be passed which is a config object containing properties
2084 * which specify multiple handlers.</p>
2085 * <p>
2086 * Code:<pre><code>
2087 el.on({
2088 'click' : {
2089 fn: this.onClick,
2090 scope: this,
2091 delay: 100
2092 },
2093 'mouseover' : {
2094 fn: this.onMouseOver,
2095 scope: this
2096 },
2097 'mouseout' : {
2098 fn: this.onMouseOut,
2099 scope: this
2100 }
2101 });</code></pre>
2102 * <p>
2103 * Or a shorthand syntax:<br>
2104 * Code:<pre><code></p>
2105 el.on({
2106 'click' : this.onClick,
2107 'mouseover' : this.onMouseOver,
2108 'mouseout' : this.onMouseOut,
2109 scope: this
2110 });
2111 * </code></pre></p>
2112 * <p><b>delegate</b></p>
2113 * <p>This is a configuration option that you can pass along when registering a handler for
2114 * an event to assist with event delegation. Event delegation is a technique that is used to
2115 * reduce memory consumption and prevent exposure to memory-leaks. By registering an event
2116 * for a container element as opposed to each element within a container. By setting this
2117 * configuration option to a simple selector, the target element will be filtered to look for
2118 * a descendant of the target.
2119 * For example:<pre><code>
2120 // using this markup:
2121 &lt;div id='elId'>
2122 &lt;p id='p1'>paragraph one&lt;/p>
2123 &lt;p id='p2' class='clickable'>paragraph two&lt;/p>
2124 &lt;p id='p3'>paragraph three&lt;/p>
2125 &lt;/div>
2126 // utilize event delegation to registering just one handler on the container element:
2127 el = Ext.get('elId');
2128 el.on(
2129 'click',
2130 function(e,t) {
2131 // handle click
2132 console.info(t.id); // 'p2'
2133 },
2134 this,
2135 {
2136 // filter the target element to be a descendant with the class 'clickable'
2137 delegate: '.clickable'
2138 }
2139 );
2140 * </code></pre></p>
2141 * @return {Ext.Element} this
2142 */
2143 addListener : function(eventName, fn, scope, options){
2144 Ext.EventManager.on(this.dom, eventName, fn, scope || this, options);
2145 return this;
2146 },
2147
2148 /**
2149 * Removes an event handler from this element. The shorthand version {@link #un} is equivalent.
2150 * <b>Note</b>: if a <i>scope</i> was explicitly specified when {@link #addListener adding} the
2151 * listener, the same scope must be specified here.
2152 * Example:
2153 * <pre><code>
2154 el.removeListener('click', this.handlerFn);
2155 // or
2156 el.un('click', this.handlerFn);
2157 </code></pre>
2158 * @param {String} eventName The name of the event from which to remove the handler.
2159 * @param {Function} fn The handler function to remove. <b>This must be a reference to the function passed into the {@link #addListener} call.</b>
2160 * @param {Object} scope If a scope (<b><code>this</code></b> reference) was specified when the listener was added,
2161 * then this must refer to the same object.
2162 * @return {Ext.Element} this
2163 */
2164 removeListener : function(eventName, fn, scope){
2165 Ext.EventManager.removeListener(this.dom, eventName, fn, scope || this);
2166 return this;
2167 },
2168
2169 /**
2170 * Removes all previous added listeners from this element
2171 * @return {Ext.Element} this
2172 */
2173 removeAllListeners : function(){
2174 Ext.EventManager.removeAll(this.dom);
2175 return this;
2176 },
2177
2178 /**
2179 * Recursively removes all previous added listeners from this element and its children
2180 * @return {Ext.Element} this
2181 */
2182 purgeAllListeners : function() {
2183 Ext.EventManager.purgeElement(this, true);
2184 return this;
2185 },
2186 /**
2187 * @private Test if size has a unit, otherwise appends the default
2188 */
2189 addUnits : function(size){
2190 if(size === "" || size == "auto" || size === undefined){
2191 size = size || '';
2192 } else if(!isNaN(size) || !unitPattern.test(size)){
2193 size = size + (this.defaultUnit || 'px');
2194 }
2195 return size;
2196 },
2197
2198 /**
2199 * <p>Updates the <a href="http:
2200 * from a specified URL. Note that this is subject to the <a href="http://en.wikipedia.org/wiki/Same_origin_policy">Same Origin Policy</a></p>
2201 * <p>Updating innerHTML of an element will <b>not</b> execute embedded <tt>&lt;script></tt> elements. This is a browser restriction.</p>
2202 * @param {Mixed} options. Either a sring containing the URL from which to load the HTML, or an {@link Ext.Ajax#request} options object specifying
2203 * exactly how to request the HTML.
2204 * @return {Ext.Element} this
2205 */
2206 load : function(url, params, cb){
2207 Ext.Ajax.request(Ext.apply({
2208 params: params,
2209 url: url.url || url,
2210 callback: cb,
2211 el: this.dom,
2212 indicatorText: url.indicatorText || ''
2213 }, Ext.isObject(url) ? url : {}));
2214 return this;
2215 },
2216
2217
2218 isBorderBox : function(){
2219 return Ext.isBorderBox || Ext.isForcedBorderBox || noBoxAdjust[(this.dom.tagName || "").toLowerCase()];
2220 },
2221
2222
2223 remove : function(){
2224 var me = this,
2225 dom = me.dom;
2226
2227 if (dom) {
2228 delete me.dom;
2229 Ext.removeNode(dom);
2230 }
2231 },
2232
2233
2234 hover : function(overFn, outFn, scope, options){
2235 var me = this;
2236 me.on('mouseenter', overFn, scope || me.dom, options);
2237 me.on('mouseleave', outFn, scope || me.dom, options);
2238 return me;
2239 },
2240
2241
2242 contains : function(el){
2243 return !el ? false : Ext.lib.Dom.isAncestor(this.dom, el.dom ? el.dom : el);
2244 },
2245
2246
2247 getAttributeNS : function(ns, name){
2248 return this.getAttribute(name, ns);
2249 },
2250
2251
2252 getAttribute: (function(){
2253 var test = document.createElement('table'),
2254 isBrokenOnTable = false,
2255 hasGetAttribute = 'getAttribute' in test,
2256 unknownRe = /undefined|unknown/;
2257
2258 if (hasGetAttribute) {
2259
2260 try {
2261 test.getAttribute('ext:qtip');
2262 } catch (e) {
2263 isBrokenOnTable = true;
2264 }
2265
2266 return function(name, ns) {
2267 var el = this.dom,
2268 value;
2269
2270 if (el.getAttributeNS) {
2271 value = el.getAttributeNS(ns, name) || null;
2272 }
2273
2274 if (value == null) {
2275 if (ns) {
2276 if (isBrokenOnTable && el.tagName.toUpperCase() == 'TABLE') {
2277 try {
2278 value = el.getAttribute(ns + ':' + name);
2279 } catch (e) {
2280 value = '';
2281 }
2282 } else {
2283 value = el.getAttribute(ns + ':' + name);
2284 }
2285 } else {
2286 value = el.getAttribute(name) || el[name];
2287 }
2288 }
2289 return value || '';
2290 };
2291 } else {
2292 return function(name, ns) {
2293 var el = this.om,
2294 value,
2295 attribute;
2296
2297 if (ns) {
2298 attribute = el[ns + ':' + name];
2299 value = unknownRe.test(typeof attribute) ? undefined : attribute;
2300 } else {
2301 value = el[name];
2302 }
2303 return value || '';
2304 };
2305 }
2306 test = null;
2307 })(),
2308
2309
2310 update : function(html) {
2311 if (this.dom) {
2312 this.dom.innerHTML = html;
2313 }
2314 return this;
2315 }
2316 };
2317
2318 var ep = El.prototype;
2319
2320 El.addMethods = function(o){
2321 Ext.apply(ep, o);
2322 };
2323
2324
2325 ep.on = ep.addListener;
2326
2327
2328 ep.un = ep.removeListener;
2329
2330
2331 ep.autoBoxAdjust = true;
2332
2333
2334 var unitPattern = /\d+(px|em|%|en|ex|pt|in|cm|mm|pc)$/i,
2335 docEl;
2336
2337
2338 El.get = function(el){
2339 var ex,
2340 elm,
2341 id;
2342 if(!el){ return null; }
2343 if (typeof el == "string") {
2344 if (!(elm = DOC.getElementById(el))) {
2345 return null;
2346 }
2347 if (EC[el] && EC[el].el) {
2348 ex = EC[el].el;
2349 ex.dom = elm;
2350 } else {
2351 ex = El.addToCache(new El(elm));
2352 }
2353 return ex;
2354 } else if (el.tagName) {
2355 if(!(id = el.id)){
2356 id = Ext.id(el);
2357 }
2358 if (EC[id] && EC[id].el) {
2359 ex = EC[id].el;
2360 ex.dom = el;
2361 } else {
2362 ex = El.addToCache(new El(el));
2363 }
2364 return ex;
2365 } else if (el instanceof El) {
2366 if(el != docEl){
2367
2368
2369
2370
2371 if (Ext.isIE && (el.id == undefined || el.id == '')) {
2372 el.dom = el.dom;
2373 } else {
2374 el.dom = DOC.getElementById(el.id) || el.dom;
2375 }
2376 }
2377 return el;
2378 } else if(el.isComposite) {
2379 return el;
2380 } else if(Ext.isArray(el)) {
2381 return El.select(el);
2382 } else if(el == DOC) {
2383
2384 if(!docEl){
2385 var f = function(){};
2386 f.prototype = El.prototype;
2387 docEl = new f();
2388 docEl.dom = DOC;
2389 }
2390 return docEl;
2391 }
2392 return null;
2393 };
2394
2395 El.addToCache = function(el, id){
2396 id = id || el.id;
2397 EC[id] = {
2398 el: el,
2399 data: {},
2400 events: {}
2401 };
2402 return el;
2403 };
2404
2405
2406 El.data = function(el, key, value){
2407 el = El.get(el);
2408 if (!el) {
2409 return null;
2410 }
2411 var c = EC[el.id].data;
2412 if(arguments.length == 2){
2413 return c[key];
2414 }else{
2415 return (c[key] = value);
2416 }
2417 };
2418
2419
2420
2421
2422 function garbageCollect(){
2423 if(!Ext.enableGarbageCollector){
2424 clearInterval(El.collectorThreadId);
2425 } else {
2426 var eid,
2427 el,
2428 d,
2429 o;
2430
2431 for(eid in EC){
2432 o = EC[eid];
2433 if(o.skipGC){
2434 Ext.EventManager.removeFromSpecialCache(o.el);
2435 continue;
2436 }
2437 el = o.el;
2438 d = el.dom;
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456 if(!d || !d.parentNode || (!d.offsetParent && !DOC.getElementById(eid))){
2457 if(Ext.enableListenerCollection){
2458 Ext.EventManager.removeAll(d);
2459 }
2460 delete EC[eid];
2461 }
2462 }
2463
2464 if (Ext.isIE) {
2465 var t = {};
2466 for (eid in EC) {
2467 t[eid] = EC[eid];
2468 }
2469 EC = Ext.elCache = t;
2470 }
2471 }
2472 }
2473 El.collectorThreadId = setInterval(garbageCollect, 30000);
2474
2475 var flyFn = function(){};
2476 flyFn.prototype = El.prototype;
2477
2478
2479 El.Flyweight = function(dom){
2480 this.dom = dom;
2481 };
2482
2483 El.Flyweight.prototype = new flyFn();
2484 El.Flyweight.prototype.isFlyweight = true;
2485 El._flyweights = {};
2486
2487
2488 El.fly = function(el, named){
2489 var ret = null;
2490 named = named || '_global';
2491
2492 if (el = Ext.getDom(el)) {
2493 (El._flyweights[named] = El._flyweights[named] || new El.Flyweight()).dom = el;
2494 ret = El._flyweights[named];
2495 }
2496 return ret;
2497 };
2498
2499
2500 Ext.get = El.get;
2501
2502
2503 Ext.fly = El.fly;
2504
2505
2506 var noBoxAdjust = Ext.isStrict ? {
2507 select:1
2508 } : {
2509 input:1, select:1, textarea:1
2510 };
2511 if(Ext.isIE || Ext.isGecko){
2512 noBoxAdjust['button'] = 1;
2513 }
2514
2515 })();
2516
2517 Ext.Element.addMethods(function(){
2518 var PARENTNODE = 'parentNode',
2519 NEXTSIBLING = 'nextSibling',
2520 PREVIOUSSIBLING = 'previousSibling',
2521 DQ = Ext.DomQuery,
2522 GET = Ext.get;
2523
2524 return {
2525
2526 findParent : function(simpleSelector, maxDepth, returnEl){
2527 var p = this.dom,
2528 b = document.body,
2529 depth = 0,
2530 stopEl;
2531 if(Ext.isGecko && Object.prototype.toString.call(p) == '[object XULElement]') {
2532 return null;
2533 }
2534 maxDepth = maxDepth || 50;
2535 if (isNaN(maxDepth)) {
2536 stopEl = Ext.getDom(maxDepth);
2537 maxDepth = Number.MAX_VALUE;
2538 }
2539 while(p && p.nodeType == 1 && depth < maxDepth && p != b && p != stopEl){
2540 if(DQ.is(p, simpleSelector)){
2541 return returnEl ? GET(p) : p;
2542 }
2543 depth++;
2544 p = p.parentNode;
2545 }
2546 return null;
2547 },
2548
2549
2550 findParentNode : function(simpleSelector, maxDepth, returnEl){
2551 var p = Ext.fly(this.dom.parentNode, '_internal');
2552 return p ? p.findParent(simpleSelector, maxDepth, returnEl) : null;
2553 },
2554
2555
2556 up : function(simpleSelector, maxDepth){
2557 return this.findParentNode(simpleSelector, maxDepth, true);
2558 },
2559
2560
2561 select : function(selector){
2562 return Ext.Element.select(selector, this.dom);
2563 },
2564
2565
2566 query : function(selector){
2567 return DQ.select(selector, this.dom);
2568 },
2569
2570
2571 child : function(selector, returnDom){
2572 var n = DQ.selectNode(selector, this.dom);
2573 return returnDom ? n : GET(n);
2574 },
2575
2576
2577 down : function(selector, returnDom){
2578 var n = DQ.selectNode(" > " + selector, this.dom);
2579 return returnDom ? n : GET(n);
2580 },
2581
2582
2583 parent : function(selector, returnDom){
2584 return this.matchNode(PARENTNODE, PARENTNODE, selector, returnDom);
2585 },
2586
2587
2588 next : function(selector, returnDom){
2589 return this.matchNode(NEXTSIBLING, NEXTSIBLING, selector, returnDom);
2590 },
2591
2592
2593 prev : function(selector, returnDom){
2594 return this.matchNode(PREVIOUSSIBLING, PREVIOUSSIBLING, selector, returnDom);
2595 },
2596
2597
2598
2599 first : function(selector, returnDom){
2600 return this.matchNode(NEXTSIBLING, 'firstChild', selector, returnDom);
2601 },
2602
2603
2604 last : function(selector, returnDom){
2605 return this.matchNode(PREVIOUSSIBLING, 'lastChild', selector, returnDom);
2606 },
2607
2608 matchNode : function(dir, start, selector, returnDom){
2609 var n = this.dom[start];
2610 while(n){
2611 if(n.nodeType == 1 && (!selector || DQ.is(n, selector))){
2612 return !returnDom ? GET(n) : n;
2613 }
2614 n = n[dir];
2615 }
2616 return null;
2617 }
2618 };
2619 }());
2620 Ext.Element.addMethods(
2621 function() {
2622 var GETDOM = Ext.getDom,
2623 GET = Ext.get,
2624 DH = Ext.DomHelper;
2625
2626 return {
2627
2628 appendChild: function(el){
2629 return GET(el).appendTo(this);
2630 },
2631
2632
2633 appendTo: function(el){
2634 GETDOM(el).appendChild(this.dom);
2635 return this;
2636 },
2637
2638
2639 insertBefore: function(el){
2640 (el = GETDOM(el)).parentNode.insertBefore(this.dom, el);
2641 return this;
2642 },
2643
2644
2645 insertAfter: function(el){
2646 (el = GETDOM(el)).parentNode.insertBefore(this.dom, el.nextSibling);
2647 return this;
2648 },
2649
2650
2651 insertFirst: function(el, returnDom){
2652 el = el || {};
2653 if(el.nodeType || el.dom || typeof el == 'string'){
2654 el = GETDOM(el);
2655 this.dom.insertBefore(el, this.dom.firstChild);
2656 return !returnDom ? GET(el) : el;
2657 }else{
2658 return this.createChild(el, this.dom.firstChild, returnDom);
2659 }
2660 },
2661
2662
2663 replace: function(el){
2664 el = GET(el);
2665 this.insertBefore(el);
2666 el.remove();
2667 return this;
2668 },
2669
2670
2671 replaceWith: function(el){
2672 var me = this;
2673
2674 if(el.nodeType || el.dom || typeof el == 'string'){
2675 el = GETDOM(el);
2676 me.dom.parentNode.insertBefore(el, me.dom);
2677 }else{
2678 el = DH.insertBefore(me.dom, el);
2679 }
2680
2681 delete Ext.elCache[me.id];
2682 Ext.removeNode(me.dom);
2683 me.id = Ext.id(me.dom = el);
2684 Ext.Element.addToCache(me.isFlyweight ? new Ext.Element(me.dom) : me);
2685 return me;
2686 },
2687
2688
2689 createChild: function(config, insertBefore, returnDom){
2690 config = config || {tag:'div'};
2691 return insertBefore ?
2692 DH.insertBefore(insertBefore, config, returnDom !== true) :
2693 DH[!this.dom.firstChild ? 'overwrite' : 'append'](this.dom, config, returnDom !== true);
2694 },
2695
2696
2697 wrap: function(config, returnDom){
2698 var newEl = DH.insertBefore(this.dom, config || {tag: "div"}, !returnDom);
2699 newEl.dom ? newEl.dom.appendChild(this.dom) : newEl.appendChild(this.dom);
2700 return newEl;
2701 },
2702
2703
2704 insertHtml : function(where, html, returnEl){
2705 var el = DH.insertHtml(where, this.dom, html);
2706 return returnEl ? Ext.get(el) : el;
2707 }
2708 };
2709 }());
2710 Ext.Element.addMethods(function(){
2711
2712 var supports = Ext.supports,
2713 propCache = {},
2714 camelRe = /(-[a-z])/gi,
2715 view = document.defaultView,
2716 opacityRe = /alpha\(opacity=(.*)\)/i,
2717 trimRe = /^\s+|\s+$/g,
2718 EL = Ext.Element,
2719 spacesRe = /\s+/,
2720 wordsRe = /\w/g,
2721 PADDING = "padding",
2722 MARGIN = "margin",
2723 BORDER = "border",
2724 LEFT = "-left",
2725 RIGHT = "-right",
2726 TOP = "-top",
2727 BOTTOM = "-bottom",
2728 WIDTH = "-width",
2729 MATH = Math,
2730 HIDDEN = 'hidden',
2731 ISCLIPPED = 'isClipped',
2732 OVERFLOW = 'overflow',
2733 OVERFLOWX = 'overflow-x',
2734 OVERFLOWY = 'overflow-y',
2735 ORIGINALCLIP = 'originalClip',
2736
2737 borders = {l: BORDER + LEFT + WIDTH, r: BORDER + RIGHT + WIDTH, t: BORDER + TOP + WIDTH, b: BORDER + BOTTOM + WIDTH},
2738 paddings = {l: PADDING + LEFT, r: PADDING + RIGHT, t: PADDING + TOP, b: PADDING + BOTTOM},
2739 margins = {l: MARGIN + LEFT, r: MARGIN + RIGHT, t: MARGIN + TOP, b: MARGIN + BOTTOM},
2740 data = Ext.Element.data;
2741
2742
2743
2744 function camelFn(m, a) {
2745 return a.charAt(1).toUpperCase();
2746 }
2747
2748 function chkCache(prop) {
2749 return propCache[prop] || (propCache[prop] = prop == 'float' ? (supports.cssFloat ? 'cssFloat' : 'styleFloat') : prop.replace(camelRe, camelFn));
2750 }
2751
2752 return {
2753
2754 adjustWidth : function(width) {
2755 var me = this;
2756 var isNum = (typeof width == "number");
2757 if(isNum && me.autoBoxAdjust && !me.isBorderBox()){
2758 width -= (me.getBorderWidth("lr") + me.getPadding("lr"));
2759 }
2760 return (isNum && width < 0) ? 0 : width;
2761 },
2762
2763
2764 adjustHeight : function(height) {
2765 var me = this;
2766 var isNum = (typeof height == "number");
2767 if(isNum && me.autoBoxAdjust && !me.isBorderBox()){
2768 height -= (me.getBorderWidth("tb") + me.getPadding("tb"));
2769 }
2770 return (isNum && height < 0) ? 0 : height;
2771 },
2772
2773
2774
2775 addClass : function(className){
2776 var me = this,
2777 i,
2778 len,
2779 v,
2780 cls = [];
2781
2782 if (!Ext.isArray(className)) {
2783 if (typeof className == 'string' && !this.hasClass(className)) {
2784 me.dom.className += " " + className;
2785 }
2786 }
2787 else {
2788 for (i = 0, len = className.length; i < len; i++) {
2789 v = className[i];
2790 if (typeof v == 'string' && (' ' + me.dom.className + ' ').indexOf(' ' + v + ' ') == -1) {
2791 cls.push(v);
2792 }
2793 }
2794 if (cls.length) {
2795 me.dom.className += " " + cls.join(" ");
2796 }
2797 }
2798 return me;
2799 },
2800
2801
2802 removeClass : function(className){
2803 var me = this,
2804 i,
2805 idx,
2806 len,
2807 cls,
2808 elClasses;
2809 if (!Ext.isArray(className)){
2810 className = [className];
2811 }
2812 if (me.dom && me.dom.className) {
2813 elClasses = me.dom.className.replace(trimRe, '').split(spacesRe);
2814 for (i = 0, len = className.length; i < len; i++) {
2815 cls = className[i];
2816 if (typeof cls == 'string') {
2817 cls = cls.replace(trimRe, '');
2818 idx = elClasses.indexOf(cls);
2819 if (idx != -1) {
2820 elClasses.splice(idx, 1);
2821 }
2822 }
2823 }
2824 me.dom.className = elClasses.join(" ");
2825 }
2826 return me;
2827 },
2828
2829
2830 radioClass : function(className){
2831 var cn = this.dom.parentNode.childNodes,
2832 v,
2833 i,
2834 len;
2835 className = Ext.isArray(className) ? className : [className];
2836 for (i = 0, len = cn.length; i < len; i++) {
2837 v = cn[i];
2838 if (v && v.nodeType == 1) {
2839 Ext.fly(v, '_internal').removeClass(className);
2840 }
2841 };
2842 return this.addClass(className);
2843 },
2844
2845
2846 toggleClass : function(className){
2847 return this.hasClass(className) ? this.removeClass(className) : this.addClass(className);
2848 },
2849
2850
2851 hasClass : function(className){
2852 return className && (' '+this.dom.className+' ').indexOf(' '+className+' ') != -1;
2853 },
2854
2855
2856 replaceClass : function(oldClassName, newClassName){
2857 return this.removeClass(oldClassName).addClass(newClassName);
2858 },
2859
2860 isStyle : function(style, val) {
2861 return this.getStyle(style) == val;
2862 },
2863
2864
2865 getStyle : function(){
2866 return view && view.getComputedStyle ?
2867 function(prop){
2868 var el = this.dom,
2869 v,
2870 cs,
2871 out,
2872 display;
2873
2874 if(el == document){
2875 return null;
2876 }
2877 prop = chkCache(prop);
2878 out = (v = el.style[prop]) ? v :
2879 (cs = view.getComputedStyle(el, "")) ? cs[prop] : null;
2880
2881
2882
2883 if(prop == 'marginRight' && out != '0px' && !supports.correctRightMargin){
2884 display = el.style.display;
2885 el.style.display = 'inline-block';
2886 out = view.getComputedStyle(el, '').marginRight;
2887 el.style.display = display;
2888 }
2889
2890 if(prop == 'backgroundColor' && out == 'rgba(0, 0, 0, 0)' && !supports.correctTransparentColor){
2891 out = 'transparent';
2892 }
2893 return out;
2894 } :
2895 function(prop){
2896 var el = this.dom,
2897 m,
2898 cs;
2899
2900 if(el == document) return null;
2901 if (prop == 'opacity') {
2902 if (el.style.filter.match) {
2903 if(m = el.style.filter.match(opacityRe)){
2904 var fv = parseFloat(m[1]);
2905 if(!isNaN(fv)){
2906 return fv ? fv / 100 : 0;
2907 }
2908 }
2909 }
2910 return 1;
2911 }
2912 prop = chkCache(prop);
2913 return el.style[prop] || ((cs = el.currentStyle) ? cs[prop] : null);
2914 };
2915 }(),
2916
2917
2918 getColor : function(attr, defaultValue, prefix){
2919 var v = this.getStyle(attr),
2920 color = (typeof prefix != 'undefined') ? prefix : '#',
2921 h;
2922
2923 if(!v || (/transparent|inherit/.test(v))) {
2924 return defaultValue;
2925 }
2926 if(/^r/.test(v)){
2927 Ext.each(v.slice(4, v.length -1).split(','), function(s){
2928 h = parseInt(s, 10);
2929 color += (h < 16 ? '0' : '') + h.toString(16);
2930 });
2931 }else{
2932 v = v.replace('#', '');
2933 color += v.length == 3 ? v.replace(/^(\w)(\w)(\w)$/, '$1$1$2$2$3$3') : v;
2934 }
2935 return(color.length > 5 ? color.toLowerCase() : defaultValue);
2936 },
2937
2938
2939 setStyle : function(prop, value){
2940 var tmp, style;
2941
2942 if (typeof prop != 'object') {
2943 tmp = {};
2944 tmp[prop] = value;
2945 prop = tmp;
2946 }
2947 for (style in prop) {
2948 value = prop[style];
2949 style == 'opacity' ?
2950 this.setOpacity(value) :
2951 this.dom.style[chkCache(style)] = value;
2952 }
2953 return this;
2954 },
2955
2956
2957 setOpacity : function(opacity, animate){
2958 var me = this,
2959 s = me.dom.style;
2960
2961 if(!animate || !me.anim){
2962 if(Ext.isIE9m){
2963 var opac = opacity < 1 ? 'alpha(opacity=' + opacity * 100 + ')' : '',
2964 val = s.filter.replace(opacityRe, '').replace(trimRe, '');
2965
2966 s.zoom = 1;
2967 s.filter = val + (val.length > 0 ? ' ' : '') + opac;
2968 }else{
2969 s.opacity = opacity;
2970 }
2971 }else{
2972 me.anim({opacity: {to: opacity}}, me.preanim(arguments, 1), null, .35, 'easeIn');
2973 }
2974 return me;
2975 },
2976
2977
2978 clearOpacity : function(){
2979 var style = this.dom.style;
2980 if(Ext.isIE9m){
2981 if(!Ext.isEmpty(style.filter)){
2982 style.filter = style.filter.replace(opacityRe, '').replace(trimRe, '');
2983 }
2984 }else{
2985 style.opacity = style['-moz-opacity'] = style['-khtml-opacity'] = '';
2986 }
2987 return this;
2988 },
2989
2990
2991 getHeight : function(contentHeight){
2992 var me = this,
2993 dom = me.dom,
2994 hidden = Ext.isIE9m && me.isStyle('display', 'none'),
2995 h = MATH.max(dom.offsetHeight, hidden ? 0 : dom.clientHeight) || 0;
2996
2997 h = !contentHeight ? h : h - me.getBorderWidth("tb") - me.getPadding("tb");
2998 return h < 0 ? 0 : h;
2999 },
3000
3001
3002 getWidth : function(contentWidth){
3003 var me = this,
3004 dom = me.dom,
3005 hidden = Ext.isIE9m && me.isStyle('display', 'none'),
3006 w = MATH.max(dom.offsetWidth, hidden ? 0 : dom.clientWidth) || 0;
3007 w = !contentWidth ? w : w - me.getBorderWidth("lr") - me.getPadding("lr");
3008 return w < 0 ? 0 : w;
3009 },
3010
3011
3012 setWidth : function(width, animate){
3013 var me = this;
3014 width = me.adjustWidth(width);
3015 !animate || !me.anim ?
3016 me.dom.style.width = me.addUnits(width) :
3017 me.anim({width : {to : width}}, me.preanim(arguments, 1));
3018 return me;
3019 },
3020
3021
3022 setHeight : function(height, animate){
3023 var me = this;
3024 height = me.adjustHeight(height);
3025 !animate || !me.anim ?
3026 me.dom.style.height = me.addUnits(height) :
3027 me.anim({height : {to : height}}, me.preanim(arguments, 1));
3028 return me;
3029 },
3030
3031
3032 getBorderWidth : function(side){
3033 return this.addStyles(side, borders);
3034 },
3035
3036
3037 getPadding : function(side){
3038 return this.addStyles(side, paddings);
3039 },
3040
3041
3042 clip : function(){
3043 var me = this,
3044 dom = me.dom;
3045
3046 if(!data(dom, ISCLIPPED)){
3047 data(dom, ISCLIPPED, true);
3048 data(dom, ORIGINALCLIP, {
3049 o: me.getStyle(OVERFLOW),
3050 x: me.getStyle(OVERFLOWX),
3051 y: me.getStyle(OVERFLOWY)
3052 });
3053 me.setStyle(OVERFLOW, HIDDEN);
3054 me.setStyle(OVERFLOWX, HIDDEN);
3055 me.setStyle(OVERFLOWY, HIDDEN);
3056 }
3057 return me;
3058 },
3059
3060
3061 unclip : function(){
3062 var me = this,
3063 dom = me.dom;
3064
3065 if(data(dom, ISCLIPPED)){
3066 data(dom, ISCLIPPED, false);
3067 var o = data(dom, ORIGINALCLIP);
3068 if(o.o){
3069 me.setStyle(OVERFLOW, o.o);
3070 }
3071 if(o.x){
3072 me.setStyle(OVERFLOWX, o.x);
3073 }
3074 if(o.y){
3075 me.setStyle(OVERFLOWY, o.y);
3076 }
3077 }
3078 return me;
3079 },
3080
3081
3082 addStyles : function(sides, styles){
3083 var ttlSize = 0,
3084 sidesArr = sides.match(wordsRe),
3085 side,