Fixed bug #178
[jquery.git] / src / jquery / jquery.js
index c3185bb..dca1867 100644 (file)
@@ -1171,7 +1171,7 @@ jQuery.fn = jQuery.prototype = {
                return this.each(function(){
                        var obj = this;
 
-                       if ( table && this.nodeName == "TABLE" && a[0].nodeName != "THEAD" ) {
+                       if ( table && this.nodeName.toUpperCase() == "TABLE" && a[0].nodeName.toUpperCase() != "THEAD" ) {
                                var tbody = this.getElementsByTagName("tbody");
 
                                if ( !tbody.length ) {
@@ -1218,7 +1218,20 @@ jQuery.fn = jQuery.prototype = {
 };
 
 /**
- *
+ * Extends the jQuery object itself. Can be used to add both static
+ * functions and plugin methods.
+ * 
+ * @example $.fn.extend({
+ *   check: function() {
+ *     this.each(function() { this.checked = true; });
+ *   ),
+ *   uncheck: function() {
+ *     this.each(function() { this.checked = false; });
+ *   }
+ * });
+ * $("input[@type=checkbox]").check();
+ * $("input[@type=radio]").uncheck();
+ * @desc Adds two plugin methods.
  *
  * @private
  * @name extend
@@ -1903,15 +1916,17 @@ jQuery.extend({
         */
        sibling: function(elem, pos, not) {
                var elems = [];
-
-               var siblings = elem.parentNode.childNodes;
-               for ( var i = 0; i < siblings.length; i++ ) {
-                       if ( not === true && siblings[i] == elem ) continue;
-
-                       if ( siblings[i].nodeType == 1 )
-                               elems.push( siblings[i] );
-                       if ( siblings[i] == elem )
-                               elems.n = elems.length - 1;
+               
+               if(elem) {
+                       var siblings = elem.parentNode.childNodes;
+                       for ( var i = 0; i < siblings.length; i++ ) {
+                               if ( not === true && siblings[i] == elem ) continue;
+       
+                               if ( siblings[i].nodeType == 1 )
+                                       elems.push( siblings[i] );
+                               if ( siblings[i] == elem )
+                                       elems.n = elems.length - 1;
+                       }
                }
 
                return jQuery.extend( elems, {