Fixed an issue with parentNode being accessed in attr() on disconnected DOM elements.
[jquery.git] / test / unit / core.js
index 1ec3487..8483361 100644 (file)
@@ -383,7 +383,7 @@ test("index(Object)", function() {
 });
 
 test("attr(String)", function() {
-       expect(26);
+       expect(27);
        equals( jQuery('#text1').attr('value'), "Test", 'Check for value attribute' );
        equals( jQuery('#text1').attr('value', "Test2").attr('defaultValue'), "Test", 'Check for defaultValue attribute' );
        equals( jQuery('#text1').attr('type'), "text", 'Check for type attribute' );
@@ -407,6 +407,8 @@ test("attr(String)", function() {
        jQuery('<a id="tAnchor5"></a>').attr('href', '#5').appendTo('#main'); // using innerHTML in IE causes href attribute to be serialized to the full path
        equals( jQuery('#tAnchor5').attr('href'), "#5", 'Check for non-absolute href (an anchor)' );
 
+       equals( jQuery("<option/>").attr("selected"), false, "Check selected attribute on disconnected element." );
+
 
        // Related to [5574] and [5683]
        var body = document.body, $body = jQuery(body);
@@ -1352,7 +1354,7 @@ test("val(String/Number)", function() {
 });
 
 test("html(String)", function() {
-       expect(13);
+       expect(17);
        
        jQuery.scriptorder = 0;
        
@@ -1381,6 +1383,10 @@ test("html(String)", function() {
        equals( $div.html( 5 ).html(), '5', 'Setting a number as html' );
        equals( $div.html( 0 ).html(), '0', 'Setting a zero as html' );
 
+       reset();
+
+       jQuery("#main").html('<script type="something/else">ok( false, "Non-script evaluated." );</script><script type="text/javascript">ok( true, "text/javascript is evaluated." );</script><script>ok( true, "No type is evaluated." );</script><div><script type="text/javascript">ok( true, "Inner text/javascript is evaluated." );</script><script>ok( true, "Inner No type is evaluated." );</script><script type="something/else">ok( false, "Non-script evaluated." );</script></div>');
+
        stop();
 
        jQuery("#main").html('<script type="text/javascript">ok( true, "jQuery().html().evalScripts() Evals Scripts Twice in Firefox, see #975" );</script>');
@@ -1407,11 +1413,14 @@ test("filter()", function() {
 });
 
 test("closest()", function() {
-       expect(4);
+       expect(6);
        isSet( jQuery("body").closest("body").get(), q("body"), "closest(body)" );
        isSet( jQuery("body").closest("html").get(), q("html"), "closest(html)" );
        isSet( jQuery("body").closest("div").get(), [], "closest(div)" );
        isSet( jQuery("#main").closest("span,#html").get(), q("html"), "closest(span,#html)" );
+
+       isSet( jQuery("div:eq(1)").closest("div:first").get(), [], "closest(div:first)" );
+       isSet( jQuery("div").closest("body:first div:last").get(), q("divWithNoTabIndex"), "closest(body:first div:last)" );
 });
 
 test("not()", function() {