X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/6746dc89c47ed01b165cc1152533605f97eb8e8d..f562e4c6e5fac7bcb445985b99acbea4d706e6f0:/docs/source/Object.html diff --git a/docs/source/Object.html b/docs/source/Object.html index 1dc60b17..7786d37e 100644 --- a/docs/source/Object.html +++ b/docs/source/Object.html @@ -3,8 +3,8 @@ The source code - - + + @@ -15,535 +15,409 @@ -
/**
- * @author Jacky Nguyen <jacky@sencha.com>
- * @docauthor Jacky Nguyen <jacky@sencha.com>
- * @class Ext.Object
+  
/**
+ * @class Object
  *
- * A collection of useful static methods to deal with objects
+ * Creates an object wrapper.
  *
- * @singleton
+ * The Object constructor creates an object wrapper for the given value. If the value is null or
+ * undefined, it will create and return an empty object, otherwise, it will return an object of a type
+ * that corresponds to the given value.
+ *
+ * When called in a non-constructor context, Object behaves identically.
+ *
+ * # Using Object given undefined and null types
+ *
+ * The following examples store an empty Object object in o:
+ *     var o = new Object();
+ *
+ *     var o = new Object(undefined);
+ *
+ *     var o = new Object(null);
+ *
+ * # Using Object to create Boolean objects
+ *
+ * The following examples store Boolean objects in o:
+ *
+ *     // equivalent to o = new Boolean(true);
+ *     var o = new Object(true);
+ *
+ *     // equivalent to o = new Boolean(false);
+ *     var o = new Object(Boolean());
+ *
+ * <div class="notice">
+ * Documentation for this class comes from <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object">MDN</a>
+ * and is available under <a href="http://creativecommons.org/licenses/by-sa/2.0/">Creative Commons: Attribution-Sharealike license</a>.
+ * </div>
  */
 
-(function() {
-
-var ExtObject = Ext.Object = {
-
-    /**
-     * Convert a `name` - `value` pair to an array of objects with support for nested structures; useful to construct
-     * query strings. For example:
-
-    var objects = Ext.Object.toQueryObjects('hobbies', ['reading', 'cooking', 'swimming']);
-
-    // objects then equals:
-    [
-        { name: 'hobbies', value: 'reading' },
-        { name: 'hobbies', value: 'cooking' },
-        { name: 'hobbies', value: 'swimming' },
-    ];
-
-    var objects = Ext.Object.toQueryObjects('dateOfBirth', {
-        day: 3,
-        month: 8,
-        year: 1987,
-        extra: {
-            hour: 4
-            minute: 30
-        }
-    }, true); // Recursive
-
-    // objects then equals:
-    [
-        { name: 'dateOfBirth[day]', value: 3 },
-        { name: 'dateOfBirth[month]', value: 8 },
-        { name: 'dateOfBirth[year]', value: 1987 },
-        { name: 'dateOfBirth[extra][hour]', value: 4 },
-        { name: 'dateOfBirth[extra][minute]', value: 30 },
-    ];
-
-     * @param {String} name
-     * @param {Mixed} value
-     * @param {Boolean} recursive
-     * @markdown
-     */
-    toQueryObjects: function(name, value, recursive) {
-        var self = ExtObject.toQueryObjects,
-            objects = [],
-            i, ln;
-
-        if (Ext.isArray(value)) {
-            for (i = 0, ln = value.length; i < ln; i++) {
-                if (recursive) {
-                    objects = objects.concat(self(name + '[' + i + ']', value[i], true));
-                }
-                else {
-                    objects.push({
-                        name: name,
-                        value: value[i]
-                    });
-                }
-            }
-        }
-        else if (Ext.isObject(value)) {
-            for (i in value) {
-                if (value.hasOwnProperty(i)) {
-                    if (recursive) {
-                        objects = objects.concat(self(name + '[' + i + ']', value[i], true));
-                    }
-                    else {
-                        objects.push({
-                            name: name,
-                            value: value[i]
-                        });
-                    }
-                }
-            }
-        }
-        else {
-            objects.push({
-                name: name,
-                value: value
-            });
-        }
-
-        return objects;
-    },
-
-    /**
-     * Takes an object and converts it to an encoded query string
-
-- Non-recursive:
-
-    Ext.Object.toQueryString({foo: 1, bar: 2}); // returns "foo=1&bar=2"
-    Ext.Object.toQueryString({foo: null, bar: 2}); // returns "foo=&bar=2"
-    Ext.Object.toQueryString({'some price': '$300'}); // returns "some%20price=%24300"
-    Ext.Object.toQueryString({date: new Date(2011, 0, 1)}); // returns "date=%222011-01-01T00%3A00%3A00%22"
-    Ext.Object.toQueryString({colors: ['red', 'green', 'blue']}); // returns "colors=red&colors=green&colors=blue"
-
-- Recursive:
-
-    Ext.Object.toQueryString({
-        username: 'Jacky',
-        dateOfBirth: {
-            day: 1,
-            month: 2,
-            year: 1911
-        },
-        hobbies: ['coding', 'eating', 'sleeping', ['nested', 'stuff']]
-    }, true); // returns the following string (broken down and url-decoded for ease of reading purpose):
-              // username=Jacky
-              //    &dateOfBirth[day]=1&dateOfBirth[month]=2&dateOfBirth[year]=1911
-              //    &hobbies[0]=coding&hobbies[1]=eating&hobbies[2]=sleeping&hobbies[3][0]=nested&hobbies[3][1]=stuff
-
-     *
-     * @param {Object} object The object to encode
-     * @param {Boolean} recursive (optional) Whether or not to interpret the object in recursive format.
-     * (PHP / Ruby on Rails servers and similar). Defaults to false
-     * @return {String} queryString
-     * @markdown
-     */
-    toQueryString: function(object, recursive) {
-        var paramObjects = [],
-            params = [],
-            i, j, ln, paramObject, value;
-
-        for (i in object) {
-            if (object.hasOwnProperty(i)) {
-                paramObjects = paramObjects.concat(ExtObject.toQueryObjects(i, object[i], recursive));
-            }
-        }
-
-        for (j = 0, ln = paramObjects.length; j < ln; j++) {
-            paramObject = paramObjects[j];
-            value = paramObject.value;
-
-            if (Ext.isEmpty(value)) {
-                value = '';
-            }
-            else if (Ext.isDate(value)) {
-                value = Ext.Date.toString(value);
-            }
-
-            params.push(encodeURIComponent(paramObject.name) + '=' + encodeURIComponent(String(value)));
-        }
-
-        return params.join('&');
-    },
-
-    /**
-     * Converts a query string back into an object.
-     *
-- Non-recursive:
-
-    Ext.Object.fromQueryString(foo=1&bar=2); // returns {foo: 1, bar: 2}
-    Ext.Object.fromQueryString(foo=&bar=2); // returns {foo: null, bar: 2}
-    Ext.Object.fromQueryString(some%20price=%24300); // returns {'some price': '$300'}
-    Ext.Object.fromQueryString(colors=red&colors=green&colors=blue); // returns {colors: ['red', 'green', 'blue']}
-
-- Recursive:
-
-    Ext.Object.fromQueryString("username=Jacky&dateOfBirth[day]=1&dateOfBirth[month]=2&dateOfBirth[year]=1911&hobbies[0]=coding&hobbies[1]=eating&hobbies[2]=sleeping&hobbies[3][0]=nested&hobbies[3][1]=stuff", true);
-
-    // returns
-    {
-        username: 'Jacky',
-        dateOfBirth: {
-            day: '1',
-            month: '2',
-            year: '1911'
-        },
-        hobbies: ['coding', 'eating', 'sleeping', ['nested', 'stuff']]
-    }
-
-     * @param {String} queryString The query string to decode
-     * @param {Boolean} recursive (Optional) Whether or not to recursively decode the string. This format is supported by
-     * PHP / Ruby on Rails servers and similar. Defaults to false
-     * @return {Object}
-     */
-    fromQueryString: function(queryString, recursive) {
-        var parts = queryString.replace(/^\?/, '').split('&'),
-            object = {},
-            temp, components, name, value, i, ln,
-            part, j, subLn, matchedKeys, matchedName,
-            keys, key, nextKey;
-
-        for (i = 0, ln = parts.length; i < ln; i++) {
-            part = parts[i];
-
-            if (part.length > 0) {
-                components = part.split('=');
-                name = decodeURIComponent(components[0]);
-                value = (components[1] !== undefined) ? decodeURIComponent(components[1]) : '';
-
-                if (!recursive) {
-                    if (object.hasOwnProperty(name)) {
-                        if (!Ext.isArray(object[name])) {
-                            object[name] = [object[name]];
-                        }
-
-                        object[name].push(value);
-                    }
-                    else {
-                        object[name] = value;
-                    }
-                }
-                else {
-                    matchedKeys = name.match(/(\[):?([^\]]*)\]/g);
-                    matchedName = name.match(/^([^\[]+)/);
-
-                    //<debug error>
-                    if (!matchedName) {
-                        Ext.Error.raise({
-                            sourceClass: "Ext.Object",
-                            sourceMethod: "fromQueryString",
-                            queryString: queryString,
-                            recursive: recursive,
-                            msg: 'Malformed query string given, failed parsing name from "' + part + '"'
-                        });
-                    }
-                    //</debug>
-
-                    name = matchedName[0];
-                    keys = [];
-
-                    if (matchedKeys === null) {
-                        object[name] = value;
-                        continue;
-                    }
-
-                    for (j = 0, subLn = matchedKeys.length; j < subLn; j++) {
-                        key = matchedKeys[j];
-                        key = (key.length === 2) ? '' : key.substring(1, key.length - 1);
-                        keys.push(key);
-                    }
-
-                    keys.unshift(name);
-
-                    temp = object;
-
-                    for (j = 0, subLn = keys.length; j < subLn; j++) {
-                        key = keys[j];
-
-                        if (j === subLn - 1) {
-                            if (Ext.isArray(temp) && key === '') {
-                                temp.push(value);
-                            }
-                            else {
-                                temp[key] = value;
-                            }
-                        }
-                        else {
-                            if (temp[key] === undefined || typeof temp[key] === 'string') {
-                                nextKey = keys[j+1];
-
-                                temp[key] = (Ext.isNumeric(nextKey) || nextKey === '') ? [] : {};
-                            }
-
-                            temp = temp[key];
-                        }
-                    }
-                }
-            }
-        }
-
-        return object;
-    },
-
-    /**
-     * Iterate through an object and invoke the given callback function for each iteration. The iteration can be stop
-     * by returning `false` in the callback function. For example:
-
-    var person = {
-        name: 'Jacky'
-        hairColor: 'black'
-        loves: ['food', 'sleeping', 'wife']
-    };
-
-    Ext.Object.each(person, function(key, value, myself) {
-        console.log(key + ":" + value);
-
-        if (key === 'hairColor') {
-            return false; // stop the iteration
-        }
-    });
-
-     * @param {Object} object The object to iterate
-     * @param {Function} fn The callback function. Passed arguments for each iteration are:
-
-- {String} `key`
-- {Mixed} `value`
-- {Object} `object` The object itself
-
-     * @param {Object} scope (Optional) The execution scope (`this`) of the callback function
-     * @markdown
-     */
-    each: function(object, fn, scope) {
-        for (var property in object) {
-            if (object.hasOwnProperty(property)) {
-                if (fn.call(scope || object, property, object[property], object) === false) {
-                    return;
-                }
-            }
-        }
-    },
-
-    /**
-     * Merges any number of objects recursively without referencing them or their children.
-
-    var extjs = {
-        companyName: 'Ext JS',
-        products: ['Ext JS', 'Ext GWT', 'Ext Designer'],
-        isSuperCool: true
-        office: {
-            size: 2000,
-            location: 'Palo Alto',
-            isFun: true
-        }
-    };
-
-    var newStuff = {
-        companyName: 'Sencha Inc.',
-        products: ['Ext JS', 'Ext GWT', 'Ext Designer', 'Sencha Touch', 'Sencha Animator'],
-        office: {
-            size: 40000,
-            location: 'Redwood City'
-        }
-    };
-
-    var sencha = Ext.Object.merge(extjs, newStuff);
-
-    // extjs and sencha then equals to
-    {
-        companyName: 'Sencha Inc.',
-        products: ['Ext JS', 'Ext GWT', 'Ext Designer', 'Sencha Touch', 'Sencha Animator'],
-        isSuperCool: true
-        office: {
-            size: 30000,
-            location: 'Redwood City'
-            isFun: true
-        }
-    }
-
-     * @param {Object} object,...
-     * @return {Object} merged The object that is created as a result of merging all the objects passed in.
-     * @markdown
-     */
-    merge: function(source, key, value) {
-        if (typeof key === 'string') {
-            if (value && value.constructor === Object) {
-                if (source[key] && source[key].constructor === Object) {
-                    ExtObject.merge(source[key], value);
-                }
-                else {
-                    source[key] = Ext.clone(value);
-                }
-            }
-            else {
-                source[key] = value;
-            }
-
-            return source;
-        }
-
-        var i = 1,
-            ln = arguments.length,
-            object, property;
-
-        for (; i < ln; i++) {
-            object = arguments[i];
-
-            for (property in object) {
-                if (object.hasOwnProperty(property)) {
-                    ExtObject.merge(source, property, object[property]);
-                }
-            }
-        }
-
-        return source;
-    },
-
-    /**
-     * Returns the first matching key corresponding to the given value.
-     * If no matching value is found, null is returned.
-
-    var person = {
-        name: 'Jacky',
-        loves: 'food'
-    };
-
-    alert(Ext.Object.getKey(sencha, 'loves')); // alerts 'food'
-
-     * @param {Object} object
-     * @param {Object} value The value to find
-     * @markdown
-     */
-    getKey: function(object, value) {
-        for (var property in object) {
-            if (object.hasOwnProperty(property) && object[property] === value) {
-                return property;
-            }
-        }
-
-        return null;
-    },
-
-    /**
-     * Gets all values of the given object as an array.
-
-    var values = Ext.Object.getValues({
-        name: 'Jacky',
-        loves: 'food'
-    }); // ['Jacky', 'food']
-
-     * @param {Object} object
-     * @return {Array} An array of values from the object
-     * @markdown
-     */
-    getValues: function(object) {
-        var values = [],
-            property;
-
-        for (property in object) {
-            if (object.hasOwnProperty(property)) {
-                values.push(object[property]);
-            }
-        }
-
-        return values;
-    },
-
-    /**
-     * Gets all keys of the given object as an array.
-
-    var values = Ext.Object.getKeys({
-        name: 'Jacky',
-        loves: 'food'
-    }); // ['name', 'loves']
-
-     * @param {Object} object
-     * @return {Array} An array of keys from the object
-     * @method
-     */
-    getKeys: ('keys' in Object.prototype) ? Object.keys : function(object) {
-        var keys = [],
-            property;
-
-        for (property in object) {
-            if (object.hasOwnProperty(property)) {
-                keys.push(property);
-            }
-        }
-
-        return keys;
-    },
-
-    /**
-     * Gets the total number of this object's own properties
-
-    var size = Ext.Object.getSize({
-        name: 'Jacky',
-        loves: 'food'
-    }); // size equals 2
+/**
+ * @method constructor
+ * Creates new Object.
+ * @param {Object} [value] The value to wrap.
+ */
 
-     * @param {Object} object
-     * @return {Number} size
-     * @markdown
-     */
-    getSize: function(object) {
-        var size = 0,
-            property;
+//Properties
 
-        for (property in object) {
-            if (object.hasOwnProperty(property)) {
-                size++;
-            }
-        }
+/**
+ * @property prototype
+ * Allows the addition of properties to all objects of type Object.
+ */
 
-        return size;
-    }
-};
+//Methods
 
+/**
+ * @method hasOwnProperty
+ * Returns a boolean indicating whether an object contains the specified property as a direct property
+ * of that object and not inherited through the prototype chain.
+ *
+ * Every object descended from `Object` inherits the `hasOwnProperty` method. This method can be used
+ * to determine whether an object has the specified property as a direct property of that object;
+ * unlike the `in` operator, this method does not check down the object's prototype chain.
+ *
+ * The following example determines whether the o object contains a property named prop:
+ *
+ *     o = new Object();
+ *     o.prop = 'exists';
+ *
+ *     function changeO() {
+ *         o.newprop = o.prop;
+ *         delete o.prop;
+ *     }
+ *
+ *     o.hasOwnProperty('prop');   //returns true
+ *     changeO();
+ *     o.hasOwnProperty('prop');   //returns false
+ *
+ * The following example differentiates between direct properties and properties inherited through the
+ * prototype chain:
+ *
+ *     o = new Object();
+ *     o.prop = 'exists';
+ *     o.hasOwnProperty('prop');             // returns true
+ *     o.hasOwnProperty('toString');         // returns false
+ *     o.hasOwnProperty('hasOwnProperty');   // returns false
+ *
+ * The following example shows how to iterate over the properties of an object without executing on
+ * inherit properties.
+ *
+ *     var buz = {
+ *         fog: 'stack'
+ *     };
+ *
+ *     for (var name in buz) {
+ *         if (buz.hasOwnProperty(name)) {
+ *             alert("this is fog (" + name + ") for sure. Value: " + buz[name]);
+ *         }
+ *         else {
+ *             alert(name); // toString or something else
+ *         }
+ *     }
+ *
+ * @param {String} prop The name of the property to test.
+ * @return {Boolean} Returns true if object contains specified property; else
+ * returns false.
+ */
 
-/**
- * A convenient alias method for {@link Ext.Object#merge}
+/**
+ * @method isPrototypeOf
+ * Returns a boolean indication whether the specified object is in the prototype chain of the object
+ * this method is called upon.
+ *
+ * `isPrototypeOf` allows you to check whether or not an object exists within another object's
+ * prototype chain.
+ *
+ * For example, consider the following prototype chain:
+ *
+ *     function Fee() {
+ *         // . . .
+ *     }
+ *
+ *     function Fi() {
+ *         // . . .
+ *     }
+ *     Fi.prototype = new Fee();
+ *
+ *     function Fo() {
+ *         // . . .
+ *     }
+ *     Fo.prototype = new Fi();
+ *
+ *     function Fum() {
+ *         // . . .
+ *     }
+ *     Fum.prototype = new Fo();
+ *
+ * Later on down the road, if you instantiate `Fum` and need to check if `Fi`'s prototype exists
+ * within the `Fum` prototype chain, you could do this:
  *
- * @member Ext
- * @method merge
+ *     var fum = new Fum();
+ *     . . .
+ *
+ *     if (Fi.prototype.isPrototypeOf(fum)) {
+ *     // do something safe
+ *     }
+ *
+ * This, along with the `instanceof` operator particularly comes in handy if you have code that can
+ * only function when dealing with objects descended from a specific prototype chain, e.g., to
+ * guarantee that certain methods or properties will be present on that object.
+ *
+ * @param {Object} prototype an object to be tested against each link in the prototype chain of the
+ * *object* argument
+ * @param {Object} object the object whose prototype chain will be searched
+ * @return {Boolean} Returns true if object is a prototype and false if not.
  */
-Ext.merge = Ext.Object.merge;
 
-/**
- * A convenient alias method for {@link Ext.Object#toQueryString}
+/**
+ * @method propertyIsEnumerable
+ * Returns a boolean indicating if the internal ECMAScript DontEnum attribute is set.
+ *
+ * Every object has a `propertyIsEnumerable` method. This method can determine whether the specified
+ * property in an object can be enumerated by a `for...in` loop, with the exception of properties
+ * inherited through the prototype chain. If the object does not have the specified property, this
+ * method returns false.
+ *
+ * The following example shows the use of `propertyIsEnumerable` on objects and arrays:
+ *
+ *     var o = {};
+ *     var a = [];
+ *     o.prop = 'is enumerable';
+ *     a[0] = 'is enumerable';
+ *
+ *     o.propertyIsEnumerable('prop');   // returns true
+ *     a.propertyIsEnumerable(0);        // returns true
+ *
+ * The following example demonstrates the enumerability of user-defined versus built-in properties:
+ *
+ *     var a = ['is enumerable'];
+ *
+ *     a.propertyIsEnumerable(0);          // returns true
+ *     a.propertyIsEnumerable('length');   // returns false
+ *
+ *     Math.propertyIsEnumerable('random');   // returns false
+ *     this.propertyIsEnumerable('Math');     // returns false
  *
- * @member Ext
- * @method urlEncode
- * @deprecated 4.0.0 Use {@link Ext.Object#toQueryString Ext.Object.toQueryString} instead
+ * Direct versus inherited properties
+ *
+ *     var a = [];
+ *     a.propertyIsEnumerable('constructor');         // returns false
+ *
+ *     function firstConstructor()
+ *     {
+ *         this.property = 'is not enumerable';
+ *     }
+ *     firstConstructor.prototype.firstMethod = function () {};
+ *
+ *     function secondConstructor()
+ *     {
+ *         this.method = function method() { return 'is enumerable'; };
+ *     }
+ *
+ *     secondConstructor.prototype = new firstConstructor;
+ *     secondConstructor.prototype.constructor = secondConstructor;
+ *
+ *     var o = new secondConstructor();
+ *     o.arbitraryProperty = 'is enumerable';
+ *
+ *     o.propertyIsEnumerable('arbitraryProperty');   // returns true
+ *     o.propertyIsEnumerable('method');              // returns true
+ *     o.propertyIsEnumerable('property');            // returns false
+ *
+ *     o.property = 'is enumerable';
+ *
+ *     o.propertyIsEnumerable('property');            // returns true
+ *
+ *     // These return false as they are on the prototype which
+ *     // propertyIsEnumerable does not consider (even though the last two
+ *     // are iteratable with for-in)
+ *     o.propertyIsEnumerable('prototype'); // returns false (as of JS 1.8.1/FF3.6)
+ *     o.propertyIsEnumerable('constructor'); // returns false
+ *     o.propertyIsEnumerable('firstMethod'); // returns false
+ *
+ * @param {String} prop The name of the property to test.
+ * @return {Boolean} If the object does not have the specified property, this
+ * method returns false.
  */
-Ext.urlEncode = function() {
-    var args = Ext.Array.from(arguments),
-        prefix = '';
 
-    // Support for the old `pre` argument
-    if ((typeof args[1] === 'string')) {
-        prefix = args[1] + '&';
-        args[1] = false;
-    }
+/**
+ * @method toLocaleString
+ * Returns a string representing the object. This method is meant to be overridden by derived objects
+ * for locale-specific purposes.
+ *
+ * `Object`'s `toLocaleString` returns the result of calling `toString`.
+ *
+ * This function is provided to give objects a generic `toLocaleString` method, even though not all
+ * may use it. Currently, only `Array`, `Number`, and `Date` override `toLocaleString`.
+ *
+ * @return {String} Object represented as a string.
+ */
 
-    return prefix + Ext.Object.toQueryString.apply(Ext.Object, args);
-};
+/**
+ * @method toString
+ * Returns a string representation of the object.
+ *
+ * Every object has a `toString()` method that is automatically called when the object is to be
+ * represented as a text value or when an object is referred to in a manner in which a string is
+ * expected. By default, the `toString()` method is inherited by every object descended from `Object`.
+ * If this method is not overridden in a custom object, `toString()` returns "[object type]", where
+ * `type` is the object type. The following code illustrates this:
+ *
+ *     var o = new Object();
+ *     o.toString();           // returns [object Object]
+ *
+ * You can create a function to be called in place of the default `toString()` method. The
+ * `toString()` method takes no arguments and should return a string. The `toString()` method you
+ * create can be any value you want, but it will be most useful if it carries information about the
+ * object.
+ *
+ * The following code defines the `Dog` object type and creates `theDog`, an object of type `Dog`:
+ *
+ *     function Dog(name,breed,color,sex) {
+ *         this.name=name;
+ *         this.breed=breed;
+ *         this.color=color;
+ *         this.sex=sex;
+ *     }
+ *
+ *     theDog = new Dog("Gabby","Lab","chocolate","female");
+ *
+ * If you call the `toString()` method on this custom object, it returns the default value inherited
+ * from `Object`:
+ *
+ *     theDog.toString(); //returns [object Object]
+ *
+ * The following code creates and assigns `dogToString()` to override the default `toString()` method.
+ * This function generates a string containing the name, breed, color, and sex of the object, in the
+ * form `"property = value;"`.
+ *
+ *     Dog.prototype.toString = function dogToString() {
+ *         var ret = "Dog " + this.name + " is a " + this.sex + " " + this.color + " " + this.breed;
+ *         return ret;
+ *     }
+ *
+ * With the preceding code in place, any time theDog is used in a string context, JavaScript
+ * automatically calls the `dogToString()` function, which returns the following string:
+ *
+ *     Dog Gabby is a female chocolate Lab
+ *
+ * `toString()` can be used with every object and allows you to get its class. To use the
+ * `Object.prototype.toString()` with every object, you need to call `Function.prototype.call()` or
+ * `Function.prototype.apply()` on it, passing the object you want to inspect as the first parameter
+ * called `thisArg`.
+ *
+ *     var toString = Object.prototype.toString;
+ *
+ *     toString.call(new Date); // [object Date]
+ *     toString.call(new String); // [object String]
+ *     toString.call(Math); // [object Math]
+ *
+ * @return {String} Object represented as a string.
+ */
 
-/**
- * A convenient alias method for {@link Ext.Object#fromQueryString}
+/**
+ * @method valueOf
+ * Returns the primitive value of the specified object.
+ *
+ * JavaScript calls the `valueOf` method to convert an object to a primitive value. You rarely need to
+ * invoke the `valueOf` method yourself; JavaScript automatically invokes it when encountering an
+ * object where a primitive value is expected.
  *
- * @member Ext
- * @method urlDecode
- * @deprecated 4.0.0 Use {@link Ext.Object#fromQueryString Ext.Object.fromQueryString} instead
+ * By default, the `valueOf` method is inherited by every object descended from `Object`. Every built-
+ * in core object overrides this method to return an appropriate value. If an object has no primitive
+ * value, `valueOf` returns the object itself, which is displayed as:
+ *
+ *     [object Object]
+ *
+ * You can use `valueOf` within your own code to convert a built-in object into a primitive value.
+ * When you create a custom object, you can override `Object.valueOf` to call a custom method instead
+ * of the default `Object` method.
+ *
+ * You can create a function to be called in place of the default `valueOf` method. Your function must
+ * take no arguments.
+ *
+ * Suppose you have an object type `myNumberType` and you want to create a `valueOf` method for it.
+ * The following code assigns a user-defined function to the object's valueOf method:
+ *
+ *     myNumberType.prototype.valueOf = new Function(functionText)
+ *
+ * With the preceding code in place, any time an object of type `myNumberType` is used in a context
+ * where it is to be represented as a primitive value, JavaScript automatically calls the function
+ * defined in the preceding code.
+ *
+ * An object's `valueOf` method is usually invoked by JavaScript, but you can invoke it yourself as
+ * follows:
+ *
+ *     myNumber.valueOf()
+ *
+ * Note: Objects in string contexts convert via the `toString` method, which is different from
+ * `String` objects converting to string primitives using `valueOf`. All objects have a string
+ * conversion, if only `"[object type]"`. But many objects do not convert to number, boolean, or
+ * function.
+ *
+ * @return {Object} Returns value of the object or the object itself.
  */
-Ext.urlDecode = function() {
-    return Ext.Object.fromQueryString.apply(Ext.Object, arguments);
-};
 
-})();
-
+//Properties + +/** + * @property constructor + * Specifies the function that creates an object's prototype. + * + * Returns a reference to the Object function that created the instance's prototype. Note that the + * value of this property is a reference to the function itself, not a string containing the + * function's name, but it isn't read only (except for primitive Boolean, Number or String values: 1, + * true, "read-only"). + * + * All objects inherit a `constructor` property from their `prototype`: + * + * o = new Object // or o = {} in JavaScript 1.2 + * o.constructor == Object + * a = new Array // or a = [] in JavaScript 1.2 + * a.constructor == Array + * n = new Number(3) + * n.constructor == Number + * + * Even though you cannot construct most HTML objects, you can do comparisons. For example, + * + * document.constructor == Document + * document.form3.constructor == Form + * + * The following example creates a prototype, `Tree`, and an object of that type, theTree. The example then displays the `constructor` property for the object `theTree`. + * + * function Tree(name) { + * this.name = name; + * } + * theTree = new Tree("Redwood"); + * console.log("theTree.constructor is " + theTree.constructor); + * + * This example displays the following output: + * + * theTree.constructor is function Tree(name) { + * this.name = name; + * } + * + * The following example shows how to modify constructor value of generic objects. Only true, 1 and + * "test" variable constructors will not be changed. This example explains that is not always so safe + * to believe in constructor function. + * + * function Type(){}; + * var types = [ + * new Array, [], + * new Boolean, true, + * new Date, + * new Error, + * new Function, function(){}, + * Math, + * new Number, 1, + * new Object, {}, + * new RegExp, /(?:)/, + * new String, "test" + * ]; + * for(var i = 0; i < types.length; i++){ + * types[i].constructor = Type; + * types[i] = [types[i].constructor, types[i] instanceof Type, types[i].toString()]; + * }; + * alert(types.join("\n")); + */