]>
git.proxmox.com Git - extjs.git/blob - extjs/packages/core/src/Ext.js
5 * The Ext namespace (global object) encapsulates all classes, singletons, and
6 * utility methods provided by Sencha's libraries.
8 * Most user interface Components are at a lower level of nesting in the namespace,
9 * but many common utility functions are provided as direct properties of the Ext namespace.
11 * Also many frequently used methods from other classes are provided as shortcuts
12 * within the Ext namespace. For example {@link Ext#getCmp Ext.getCmp} aliases
13 * {@link Ext.ComponentManager#get Ext.ComponentManager.get}.
15 * Many applications are initiated with {@link Ext#application Ext.application} which is
16 * called once the DOM is ready. This ensures all scripts have been loaded, preventing
17 * dependency issues. For example:
22 * launch: function () {
23 * Ext.Msg.alert(this.name, 'Ready to go!');
27 * <b><a href="http://www.sencha.com/products/sencha-cmd/">Sencha Cmd</a></b> is a free tool
28 * for helping you generate and build Ext JS (and Sencha Touch) applications. See
29 * `{@link Ext.app.Application Application}` for more information about creating an app.
31 * A lower-level technique that does not use the `Ext.app.Application` architecture is
32 * {@link Ext#onReady Ext.onReady}.
34 * For more information about how to use the Ext classes, see:
36 * - <a href="http://www.sencha.com/learn/">The Learning Center</a>
37 * - <a href="http://www.sencha.com/learn/Ext_FAQ">The FAQ</a>
38 * - <a href="http://www.sencha.com/forum/">The forums</a>
42 var Ext
= Ext
|| {}; // jshint ignore:line
47 objectPrototype
= Object
. prototype ,
48 toString
= objectPrototype
. toString
,
49 enumerables
= [ //'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable',
50 'valueOf' , 'toLocaleString' , 'toString' , 'constructor' ],
51 emptyFn = function () {},
52 privateFn = function () {},
53 identityFn = function ( o
) { return o
; },
54 // This is the "$previous" method of a hook function on an instance. When called, it
55 // calls through the class prototype by the name of the called method.
56 callOverrideParent = function () {
57 var method
= callOverrideParent
. caller
. caller
; // skip callParent (our caller)
58 return method
.$ owner
. prototype [ method
.$ name
]. apply ( this , arguments
);
60 manifest
= Ext
. manifest
|| {},
62 iterableRe
= /\[object\s*(?:Array|Arguments|\w*Collection|\w*List|HTML\s+document\.all\s+class)\]/ ,
63 MSDateRe
= /^\\?\/Date\(([-+])?(\d+)(?:[+-]\d{4})?\)\\?\/$/ ;
68 * Returns the current timestamp.
69 * @return {Number} Milliseconds since UNIX epoch.
73 Ext
. now
= Date
. now
|| ( Date
. now = function () {
78 * Returns the current high-resolution timestamp.
79 * @return {Number} Milliseconds ellapsed since arbitrary epoch.
84 Ext
. ticks
= ( global
. performance
&& global
. performance
. now
) ? function () {
85 return performance
. now (); // jshint ignore:line
88 Ext
. _startTime
= Ext
. ticks ();
90 // Mark these special fn's for easy identification:
91 emptyFn
.$ nullFn
= identityFn
.$ nullFn
= emptyFn
.$ emptyFn
= identityFn
.$ identityFn
=
92 privateFn
.$ nullFn
= true ;
93 privateFn
.$ privacy
= 'framework' ;
95 // These are emptyFn's in core and are redefined only in Ext JS (we use this syntax
96 // so Cmd does not detect them):
97 Ext
[ 'suspendLayouts' ] = Ext
[ 'resumeLayouts' ] = emptyFn
; // jshint ignore:line
99 for ( i
in { toString
: 1 }) {
104 * An array containing extra enumerables for old browsers
105 * @property {String[]}
107 Ext
. enumerables
= enumerables
;
110 * Copies all the properties of `config` to the specified `object`. There are two levels
111 * of defaulting supported:
113 * Ext.apply(obj, { a: 1 }, { a: 2 });
116 * Ext.apply(obj, { }, { a: 2 });
119 * Note that if recursive merging and cloning without referencing the original objects
120 * or arrays is needed, use {@link Ext.Object#merge} instead.
122 * @param {Object} object The receiver of the properties.
123 * @param {Object} config The primary source of the properties.
124 * @param {Object} [defaults] An object that will also be applied for default values.
125 * @return {Object} returns `object`.
127 Ext
. apply = function ( object
, config
, defaults
) {
129 Ext
. apply ( object
, defaults
);
132 if ( object
&& config
&& typeof config
=== 'object' ) {
136 object
[ i
] = config
[ i
];
140 for ( j
= enumerables
. length
; j
--;) {
142 if ( config
. hasOwnProperty ( k
)) {
143 object
[ k
] = config
[ k
];
152 // Used by Ext.override
153 function addInstanceOverrides ( target
, owner
, overrides
) {
156 for ( name
in overrides
) {
157 if ( overrides
. hasOwnProperty ( name
)) {
158 value
= overrides
[ name
];
160 if ( typeof value
=== 'function' ) {
162 if ( owner
.$ className
) {
163 value
. name
= owner
.$ className
+ '#' + name
;
168 value
.$ owner
= owner
;
170 value
.$ previous
= target
. hasOwnProperty ( name
) ?
171 target
[ name
] // already hooked, so call previous hook
172 : callOverrideParent
; // calls by name on prototype
175 target
[ name
] = value
;
180 Ext
. buildSettings
= Ext
. apply ({
182 }, Ext
. buildSettings
|| {});
196 * @property {Boolean} isSecure
197 * True if the page is running over SSL
200 isSecure
: /^https/i . test ( window
. location
. protocol
),
203 * `true` to automatically uncache orphaned Ext.Elements periodically. If set to
204 * `false`, the application will be required to clean up orphaned Ext.Elements and
205 * it's listeners as to not cause memory leakage.
207 enableGarbageCollector
: false ,
210 * True to automatically purge event listeners during garbageCollection.
212 enableListenerCollection
: true ,
215 * @property {String} [name='Ext']
216 * <p>The name of the property in the global namespace (The <code>window</code> in browser environments) which refers to the current instance of Ext.</p>
217 * <p>This is usually <code>"Ext"</code>, but if a sandboxed build of ExtJS is being used, this will be an alternative name.</p>
218 * <p>If code is being generated for use by <code>eval</code> or to create a <code>new Function</code>, and the global instance
219 * of Ext must be referenced, this is the name that should be built into the code.</p>
221 name
: Ext
. sandboxName
|| 'Ext' ,
224 * @property {Function}
225 * A reusable empty function for use as `privates` members.
227 * Ext.define('MyClass', {
228 * nothing: Ext.emptyFn,
231 * privateNothing: Ext.privateFn
236 privateFn
: privateFn
,
239 * @property {Function}
240 * A reusable empty function.
245 * @property {Function}
246 * A reusable identity function that simply returns its first argument.
248 identityFn
: identityFn
,
251 * This indicate the start timestamp of current cycle.
252 * It is only reliable during dom-event-initiated cycles and
253 * {@link Ext.draw.Animator} initiated cycles.
255 frameStartTime
: Ext
. now (),
258 * This object is initialized prior to loading the framework (Ext JS or Sencha
259 * Touch) and contains settings and other information describing the application.
261 * For applications built using Sencha Cmd, this is produced from the `"app.json"`
262 * file with information extracted from all of the required packages' `"package.json"`
263 * files. This can be set to a string when your application is using the
264 * (microloader)[#/guide/microloader]. In this case, the string of "foo" will be
265 * requested as `"foo.json"` and the object in that JSON file will parsed and set
268 * @cfg {String/Object} manifest
270 * @cfg {String/Object} manifest.compatibility An object keyed by package name with
271 * the value being to desired compatibility level as a version number. If this is
272 * just a string, this version is assumed to apply to the framework ('ext' or
273 * 'touch'). Setting this value to less than 5 for 'ext' will enable the compatibility
274 * layer to assist in the application upgrade process. For details on the upgrade
275 * process, see the (Upgrade Guide)[#/guides/upgrade_50].
277 * @cfg {Object} manifest.debug An object configuring the debugging characteristics
278 * of the framework. See `Ext.debugConfig` which is set to this value.
280 * @cfg {Object} manifest.packages An object keyed by package name with the value
281 * being a subset of the package's `"package.json"` descriptor.
288 * @cfg {Object} [debugConfig]
289 * This object is used to enable or disable debugging for classes or namespaces. The
290 * default instance looks like this:
292 * Ext.debugConfig = {
298 * Typically applications will set this in their `"app.json"` like so:
303 * // Default for all namespaces:
306 * // Except for Ext namespace which is disabled
309 * // Except for Ext.layout namespace which is enabled
315 * Alternatively, because this property is consumed very early in the load process of
316 * the framework, this can be set in a `script` tag that is defined prior to loading
317 * the framework itself.
319 * For example, to enable debugging for the `Ext.layout` namespace only:
321 * var Ext = Ext || {};
322 * Ext.debugConfig = {
328 * For any class declared, the longest matching namespace specified determines if its
329 * `debugHooks` will be enabled. The default setting is specified by the '*' property.
331 * **NOTE:** This option only applies to debug builds. All debugging is disabled in
334 debugConfig
: Ext
. debugConfig
|| manifest
. debug
|| {
342 * @property {Boolean} [enableAria=true] This property is provided for backward
343 * compatibility with previous versions of Ext JS. Accessibility is always enabled
350 * @property {Boolean} [enableAriaButtons=true] Set to `false` to disable WAI-ARIA
351 * compatibility checks for buttons.
354 enableAriaButtons
: true ,
357 * @property {Boolean} [enableAriaPanels=true] Set to `false` to disable WAI-ARIA
358 * compatibility checks for panels.
361 enableAriaPanels
: true ,
363 startsWithHashRe
: /^#/ ,
368 * Regular expression used for validating identifiers.
370 validIdRe
: /^[a-z_][a-z0-9\-_]*$/i ,
373 * @property {String} BLANK_IMAGE_URL
374 * URL to a 1x1 transparent gif image used by Ext to create inline icons with
375 * CSS background images.
377 BLANK_IMAGE_URL
: 'data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==' ,
380 * Converts an id (`'foo'`) into an id selector (`'#foo'`). This method is used
381 * internally by the framework whenever an id needs to be converted into a selector
382 * and is provided as a hook for those that need to escape IDs selectors since,
383 * as of Ext 5.0, the framework no longer escapes IDs by default.
388 makeIdSelector : function ( id
) {
390 if (! Ext
. validIdRe
. test ( id
)) {
391 Ext
. raise ( 'Invalid id selector: "' + id
+ '"' );
398 * Generates unique ids. If the object/element is passes and it already has an `id`, it is unchanged.
399 * @param {Object} [o] The object to generate an id for.
400 * @param {String} [prefix=ext-gen] (optional) The `id` prefix.
401 * @return {String} The generated `id`.
403 id : function ( o
, prefix
) {
408 var id
= ( prefix
|| Ext
. idPrefix
) + (++ Ext
. idSeed
);
418 * A reusable function which returns the value of `getId()` called upon a single passed parameter.
419 * Useful when creating a {@link Ext.util.MixedCollection} of objects keyed by an identifier returned from a `getId` method.
421 returnId : function ( o
) {
426 * A reusable function which returns `true`.
428 returnTrue : function () {
433 * A zero length string which will pass a truth test. Useful for passing to methods
434 * which use a truth test to reject <i>falsy</i> values where a string value must be cleared.
436 emptyString
: new String (), // jshint ignore:line
439 * @property {String} [baseCSSPrefix='x-']
440 * The base prefix to use for all `Ext` components. To configure this property, you should use the
441 * Ext.buildSettings object before the framework is loaded:
443 * Ext.buildSettings = {
444 * baseCSSPrefix : 'abc-'
447 * or you can change it before any components are rendered:
449 * Ext.baseCSSPrefix = Ext.buildSettings.baseCSSPrefix = 'abc-';
451 * This will change what CSS classes components will use and you should
452 * then recompile the SASS changing the `$prefix` SASS variable to match.
454 baseCSSPrefix
: Ext
. buildSettings
. baseCSSPrefix
,
457 * @property {Object} $eventNameMap
458 * A map of event names which contained the lower-cased versions of any mixed
464 // Vendor-specific events do not work if lower-cased. This regex specifies event
465 // prefixes for names that should NOT be lower-cased by Ext.canonicalEventName()
466 $ vendorEventRe
: /^(Moz.+|MS.+|webkit.+)/ ,
468 // TODO: inlinable function - SDKTOOLS-686
473 canonicalEventName : function ( name
) {
474 return Ext
.$ eventNameMap
[ name
] || ( Ext
.$ eventNameMap
[ name
] =
475 ( Ext
.$ vendorEventRe
. test ( name
) ? name
: name
. toLowerCase ()));
479 * Copies all the properties of config to object if they don't already exist.
480 * @param {Object} object The receiver of the properties
481 * @param {Object} config The source of the properties
482 * @return {Object} returns obj
484 applyIf : function ( object
, config
) {
488 for ( property
in config
) {
489 if ( object
[ property
] === undefined ) {
490 object
[ property
] = config
[ property
];
499 * Destroys all of the given objects. If arrays are passed, the elements of these
500 * are destroyed recursively.
502 * What it means to "destroy" an object depends on the type of object.
504 * * `Array`: Each element of the array is destroyed recursively.
505 * * `Object`: Any object with a `destroy` method will have that method called.
507 * @param {Mixed...} args Any number of objects or arrays.
509 destroy : function () {
510 var ln
= arguments
. length
,
513 for ( i
= 0 ; i
< ln
; i
++) {
516 if ( Ext
. isArray ( arg
)) {
517 this . destroy
. apply ( this , arg
);
518 } else if ( Ext
. isFunction ( arg
. destroy
)) {
527 * Destroys the specified named members of the given object using `Ext.destroy`. These
528 * properties will be set to `null`.
529 * @param {Object} object The object who's properties you wish to destroy.
530 * @param {String...} args One or more names of the properties to destroy and remove from the object.
532 destroyMembers : function ( object
) {
533 for ( var ref
, name
, i
= 1 , a
= arguments
, len
= a
. length
; i
< len
; i
++) {
534 ref
= object
[ name
= a
[ i
]];
536 // Avoid adding the property if it does not already exist
538 object
[ name
] = Ext
. destroy ( ref
);
544 * Overrides members of the specified `target` with the given values.
546 * If the `target` is a class declared using {@link Ext#define Ext.define}, the
547 * `override` method of that class is called (see {@link Ext.Base#override}) given
550 * If the `target` is a function, it is assumed to be a constructor and the contents
551 * of `overrides` are applied to its `prototype` using {@link Ext#apply Ext.apply}.
553 * If the `target` is an instance of a class declared using {@link Ext#define Ext.define},
554 * the `overrides` are applied to only that instance. In this case, methods are
555 * specially processed to allow them to use {@link Ext.Base#callParent}.
557 * var panel = new Ext.Panel({ ... });
559 * Ext.override(panel, {
560 * initComponent: function () {
561 * // extra processing...
567 * If the `target` is none of these, the `overrides` are applied to the `target`
568 * using {@link Ext#apply Ext.apply}.
570 * Please refer to {@link Ext#define Ext.define} and {@link Ext.Base#override} for
573 * @param {Object} target The target to override.
574 * @param {Object} overrides The properties to add or replace on `target`.
577 override : function ( target
, overrides
) {
578 if ( target
.$ isClass
) {
579 target
. override ( overrides
);
580 } else if ( typeof target
=== 'function' ) {
581 Ext
. apply ( target
. prototype , overrides
);
583 var owner
= target
. self
,
586 if ( owner
&& owner
.$ isClass
) { // if (instance of Ext.define'd class)
587 privates
= overrides
. privates
;
589 overrides
= Ext
. apply ({}, overrides
);
590 delete overrides
. privates
;
591 addInstanceOverrides ( target
, owner
, privates
);
594 addInstanceOverrides ( target
, owner
, overrides
);
596 Ext
. apply ( target
, overrides
);
604 * Returns the given value itself if it's not empty, as described in {@link Ext#isEmpty}; returns the default
605 * value (second argument) otherwise.
607 * @param {Object} value The value to test.
608 * @param {Object} defaultValue The value to return if the original value is empty.
609 * @param {Boolean} [allowBlank=false] `true` to allow zero length strings to qualify as non-empty.
610 * @return {Object} value, if non-empty, else defaultValue.
612 valueFrom : function ( value
, defaultValue
, allowBlank
){
613 return Ext
. isEmpty ( value
, allowBlank
) ? defaultValue
: value
;
617 * Returns true if the passed value is empty, false otherwise. The value is deemed to be empty if it is either:
621 * - a zero-length array
622 * - a zero-length string (Unless the `allowEmptyString` parameter is set to `true`)
624 * @param {Object} value The value to test.
625 * @param {Boolean} [allowEmptyString=false] `true` to allow empty strings.
628 isEmpty : function ( value
, allowEmptyString
) {
629 return ( value
== null ) || (! allowEmptyString
? value
=== '' : false ) || ( Ext
. isArray ( value
) && value
. length
=== 0 );
633 * Returns `true` if the passed value is a JavaScript Array, `false` otherwise.
635 * @param {Object} target The target to test.
639 isArray
: ( 'isArray' in Array
) ? Array
. isArray : function ( value
) {
640 return toString
. call ( value
) === '[object Array]' ;
644 * Returns `true` if the passed value is a JavaScript Date object, `false` otherwise.
645 * @param {Object} object The object to test.
648 isDate : function ( value
) {
649 return toString
. call ( value
) === '[object Date]' ;
653 * Returns 'true' if the passed value is a String that matches the MS Date JSON
655 * @param {String} value The string to test.
658 isMSDate : function ( value
) {
659 if (! Ext
. isString ( value
)) {
662 return MSDateRe
. test ( value
);
666 * Returns `true` if the passed value is a JavaScript Object, `false` otherwise.
667 * @param {Object} value The value to test.
671 isObject
: ( toString
. call ( null ) === '[object Object]' ) ?
673 // check ownerDocument here as well to exclude DOM nodes
674 return value
!== null && value
!== undefined && toString
. call ( value
) === '[object Object]' && value
. ownerDocument
=== undefined ;
677 return toString
. call ( value
) === '[object Object]' ;
683 isSimpleObject : function ( value
) {
684 return value
instanceof Object
&& value
. constructor === Object
;
688 * Returns `true` if the passed value is a JavaScript 'primitive', a string, number
690 * @param {Object} value The value to test.
693 isPrimitive : function ( value
) {
694 var type
= typeof value
;
696 return type
=== 'string' || type
=== 'number' || type
=== 'boolean' ;
700 * Returns `true` if the passed value is a JavaScript Function, `false` otherwise.
701 * @param {Object} value The value to test.
706 // Safari 3.x and 4.x returns 'function' for typeof <NodeList>, hence we need to fall back to using
707 // Object.prototype.toString (slower)
708 ( typeof document
!== 'undefined' && typeof document
. getElementsByTagName ( 'body' ) === 'function' ) ? function ( value
) {
709 return !! value
&& toString
. call ( value
) === '[object Function]' ;
710 } : function ( value
) {
711 return !! value
&& typeof value
=== 'function' ;
715 * Returns `true` if the passed value is a number. Returns `false` for non-finite numbers.
716 * @param {Object} value The value to test.
719 isNumber : function ( value
) {
720 return typeof value
=== 'number' && isFinite ( value
);
724 * Validates that a value is numeric.
725 * @param {Object} value Examples: 1, '1', '2.34'
726 * @return {Boolean} True if numeric, false otherwise
728 isNumeric : function ( value
) {
729 return ! isNaN ( parseFloat ( value
)) && isFinite ( value
);
733 * Returns `true `if the passed value is a string.
734 * @param {Object} value The value to test.
737 isString : function ( value
) {
738 return typeof value
=== 'string' ;
742 * Returns `true` if the passed value is a boolean.
744 * @param {Object} value The value to test.
747 isBoolean : function ( value
) {
748 return typeof value
=== 'boolean' ;
752 * Returns `true` if the passed value is an HTMLElement
753 * @param {Object} value The value to test.
756 isElement : function ( value
) {
757 return value
? value
. nodeType
=== 1 : false ;
761 * Returns `true` if the passed value is a TextNode
762 * @param {Object} value The value to test.
765 isTextNode : function ( value
) {
766 return value
? value
. nodeName
=== "#text" : false ;
770 * Returns `true` if the passed value is defined.
771 * @param {Object} value The value to test.
774 isDefined : function ( value
) {
775 return typeof value
!== 'undefined' ;
779 * Returns `true` if the passed value is iterable, that is, if elements of it are addressable using array
780 * notation with numeric indices, `false` otherwise.
782 * Arrays and function `arguments` objects are iterable. Also HTML collections such as `NodeList` and `HTMLCollection'
785 * @param {Object} value The value to test
788 isIterable : function ( value
) {
789 // To be iterable, the object must have a numeric length property and must not be a string or function.
790 if (! value
|| typeof value
. length
!== 'number' || typeof value
=== 'string' || Ext
. isFunction ( value
)) {
794 // Certain "standard" collections in IE (such as document.images) do not offer the correct
795 // Javascript Object interface; specifically, they lack the propertyIsEnumerable method.
796 // And the item property while it does exist is not typeof "function"
797 if (! value
. propertyIsEnumerable
) {
801 // If it is a regular, interrogatable JS object (not an IE ActiveX object), then...
802 // If it has its own property called "length", but not enumerable, it's iterable
803 if ( value
. hasOwnProperty ( 'length' ) && ! value
. propertyIsEnumerable ( 'length' )) {
807 // Test against whitelist which includes known iterable collection types
808 return iterableRe
. test ( toString
. call ( value
));
812 * This method returns `true` if debug is enabled for the specified class. This is
813 * done by checking the `Ext.debugConfig.hooks` config for the closest match to the
815 * @param {String} className The name of the class.
816 * @return {Boolean} `true` if debug is enabled for the specified class.
820 function ( className
, defaultEnabled
) {
821 var debugConfig
= Ext
. debugConfig
. hooks
;
823 if ( debugConfig
. hasOwnProperty ( className
)) {
824 return debugConfig
[ className
];
827 var enabled
= debugConfig
[ '*' ],
830 if ( defaultEnabled
!== undefined ) {
831 enabled
= defaultEnabled
;
837 for ( var prefix
in debugConfig
) {
838 var value
= debugConfig
[ prefix
];
840 // if prefix=='Ext' match 'Ext.foo.Bar' but not 'Ext4.foo.Bar'
841 if ( className
. charAt ( prefix
. length
) === '.' ) {
842 if ( className
. substring ( 0 , prefix
. length
) === prefix
) {
843 if ( prefixLength
< prefix
. length
) {
844 prefixLength
= prefix
. length
;
857 * Clone simple variables including array, {}-like objects, DOM nodes and Date without keeping the old reference.
858 * A reference for the object itself is returned if it's not a direct descendant of Object. For model cloning,
859 * see {@link Ext.data.Model#copy Model.copy}.
861 * @param {Object} item The variable to clone
862 * @return {Object} clone
864 clone : function ( item
) {
865 if ( item
=== null || item
=== undefined ) {
870 // TODO proxy this to Ext.Element.clone to handle automatic id attribute changing
872 if ( item
. nodeType
&& item
. cloneNode
) {
873 return item
. cloneNode ( true );
876 var type
= toString
. call ( item
),
880 if ( type
=== '[object Date]' ) {
881 return new Date ( item
. getTime ());
885 if ( type
=== '[object Array]' ) {
891 clone
[ i
] = Ext
. clone ( item
[ i
]);
895 else if ( type
=== '[object Object]' && item
. constructor === Object
) {
899 clone
[ key
] = Ext
. clone ( item
[ key
]);
903 for ( j
= enumerables
. length
; j
--;) {
905 if ( item
. hasOwnProperty ( k
)) {
912 return clone
|| item
;
917 * Generate a unique reference of Ext in the global scope, useful for sandboxing
919 getUniqueGlobalNamespace : function () {
920 var uniqueGlobalNamespace
= this . uniqueGlobalNamespace
,
923 if ( uniqueGlobalNamespace
=== undefined ) {
927 uniqueGlobalNamespace
= 'ExtBox' + (++ i
);
928 } while ( global
[ uniqueGlobalNamespace
] !== undefined );
930 global
[ uniqueGlobalNamespace
] = Ext
;
931 this . uniqueGlobalNamespace
= uniqueGlobalNamespace
;
934 return uniqueGlobalNamespace
;
940 functionFactoryCache
: {},
942 cacheableFunctionFactory : function () {
944 args
= Array
. prototype . slice
. call ( arguments
),
945 cache
= me
. functionFactoryCache
,
948 if ( Ext
. isSandboxed
) {
952 args
[ ln
] = 'var Ext=window.' + Ext
. name
+ ';' + args
[ ln
];
958 fn
= Function
. prototype . constructor . apply ( Function
. prototype , args
);
965 functionFactory : function () {
966 var args
= Array
. prototype . slice
. call ( arguments
),
969 if ( Ext
. isSandboxed
) {
973 args
[ ln
] = 'var Ext=window.' + Ext
. name
+ ';' + args
[ ln
];
977 return Function
. prototype . constructor . apply ( Function
. prototype , args
);
985 log : function ( message
, priority
) {
986 if ( message
&& global
. console
) {
987 if (! priority
|| !( priority
in global
. console
)) {
990 message
= '[' + priority
. toUpperCase () + '] ' + message
;
991 global
. console
[ priority
]( message
);
994 verbose : function ( message
) {
995 this . log ( message
, 'verbose' );
997 info : function ( message
) {
998 this . log ( message
, 'info' );
1000 warn : function ( message
) {
1001 this . log ( message
, 'warn' );
1003 error : function ( message
) {
1004 throw new Error ( message
);
1006 deprecate : function ( message
) {
1007 this . log ( message
, 'warn' );
1015 error : function ( message
) {
1016 throw new Error ( message
);
1024 getElementById : function ( id
) {
1025 return document
. getElementById ( id
);
1032 splitAndUnescape
: ( function () {
1035 return function ( origin
, delimiter
) {
1039 else if (! delimiter
) {
1043 var replaceRe
= cache
[ delimiter
] || ( cache
[ delimiter
] = new RegExp ( ' \\\\ ' + delimiter
, 'g' )),
1047 parts
= origin
. split ( delimiter
);
1049 while (( part
= parts
. shift ()) !== undefined ) {
1050 // If any of the parts ends with the delimiter that means
1051 // the delimiter was escaped and the split was invalid. Roll back.
1052 while ( part
. charAt ( part
. length
- 1 ) === ' \\ ' && parts
. length
> 0 ) {
1053 part
= part
+ delimiter
+ parts
. shift ();
1056 // Now that we have split the parts, unescape the delimiter char
1057 part
= part
. replace ( replaceRe
, delimiter
);
1065 }); // Ext.apply(Ext
1067 Ext
. returnTrue
.$ nullFn
= Ext
. returnId
.$ nullFn
= true ;