Made it so that you can set the text value of elements to numbers (in addition to...
[jquery.git] / src / jquery / jquery.js
index e846e4d..8e370f8 100644 (file)
@@ -565,7 +565,7 @@ jQuery.fn = jQuery.prototype = {
         * @cat DOM/Attributes
         */
        text: function(e) {
-               if ( typeof e == "string" )
+               if ( typeof e != "object" && e != null )
                        return this.empty().append( document.createTextNode( e ) );
 
                var t = "";
@@ -811,7 +811,7 @@ jQuery.fn = jQuery.prototype = {
 
        /**
         * Searches for all elements that match the specified expression.
-        
+        * 
         * This method is a good way to find additional descendant
         * elements with which to process.
         *
@@ -1666,11 +1666,15 @@ jQuery.extend({
        unique: function(first) {
                var r = [], num = jQuery.mergeNum++;
 
-               for ( var i = 0, fl = first.length; i < fl; i++ )
-                       if ( num != first[i].mergeNum ) {
-                               first[i].mergeNum = num;
-                               r.push(first[i]);
-                       }
+               try {
+                       for ( var i = 0, fl = first.length; i < fl; i++ )
+                               if ( num != first[i].mergeNum ) {
+                                       first[i].mergeNum = num;
+                                       r.push(first[i]);
+                               }
+               } catch(e) {
+                       r = first;
+               }
 
                return r;
        },