Fixed a bug in .dir() where it would return non-element nodes.
[jquery.git] / src / core.js
index 3fb59f8..969f3d4 100644 (file)
@@ -509,14 +509,16 @@ jQuery.extend({
 
                // If we want to remove a specific section of the element's data
                if ( name ) {
-                       // Remove the section of cache data
-                       delete jQuery.cache[ id ][ name ];
-
-                       // If we've removed all the data, remove the element's cache
-                       name = "";
-                       for ( name in jQuery.cache[ id ] ) break;
-                       if ( !name )
-                               jQuery.removeData( elem );
+                       if ( jQuery.cache[ id ] ) {
+                               // Remove the section of cache data
+                               delete jQuery.cache[ id ][ name ];
+
+                               // If we've removed all the data, remove the element's cache
+                               name = "";
+                               for ( name in jQuery.cache[ id ] ) break;
+                               if ( !name )
+                                       jQuery.removeData( elem );
+                       }
 
                // Otherwise, we want to remove all of the element's data
                } else {
@@ -1018,7 +1020,7 @@ jQuery.each({
        next: "jQuery.nth(a,2,'nextSibling')",
        prev: "jQuery.nth(a,2,'previousSibling')",
        nextAll: "jQuery.dir(a,'nextSibling')",
-       prevtAll: "jQuery.dir(a,'previousSibling')",
+       prevAll: "jQuery.dir(a,'previousSibling')",
        siblings: "jQuery.sibling(a.parentNode.firstChild,a)",
        children: "jQuery.sibling(a.firstChild)",
        contents: "jQuery.nodeName(a,'iframe')?a.contentDocument||a.contentWindow.document:jQuery.makeArray(a.childNodes)"