]> source.dussan.org Git - jquery.git/commitdiff
jquery core: Closes #3737. Fixed a possible null dereference.
authorAriel Flesler <aflesler@gmail.com>
Thu, 25 Dec 2008 21:20:41 +0000 (21:20 +0000)
committerAriel Flesler <aflesler@gmail.com>
Thu, 25 Dec 2008 21:20:41 +0000 (21:20 +0000)
src/core.js

index 5a098bebd4327324dd8b5d08a50194763e968744..b8b207b71ed2359d6b94fd656cbb8d26883a4bf6 100644 (file)
@@ -1016,12 +1016,14 @@ jQuery.extend({
                
                if ( fragment ) {
                        for ( var i = 0; ret[i]; i++ ) {
-                               if ( jQuery.nodeName( ret[i], "script" ) ) {
-                                       ret[i].parentNode.removeChild( ret[i] );
+                               elem = ret[i];
+                               if ( jQuery.nodeName( elem, "script" ) ) {
+                                       if( elem.parentNode )
+                                               elem.parentNode.removeChild( elem );
                                } else {
-                                       if ( ret[i].nodeType === 1 )
-                                               ret = jQuery.merge( ret, ret[i].getElementsByTagName("script"));
-                                       fragment.appendChild( ret[i] );
+                                       if ( elem.nodeType === 1 )
+                                               ret = jQuery.merge( ret, elem.getElementsByTagName("script"));
+                                       fragment.appendChild( elem );
                                }
                        }