Fixed #1419 where IE failed with .text() on an XML node. This is part of a series...
authorDavid Serduke <davidserduke@gmail.com>
Wed, 5 Dec 2007 05:01:46 +0000 (05:01 +0000)
committerDavid Serduke <davidserduke@gmail.com>
Wed, 5 Dec 2007 05:01:46 +0000 (05:01 +0000)
src/core.js
test/unit/core.js

index 0f27425..23c1b79 100644 (file)
@@ -917,7 +917,8 @@ jQuery.extend({
        clean: function( elems, context ) {
                var ret = [];
                context = context || document;
-               if (!context.createElement) 
+               // !context.createElement fails in IE with an error but returns typeof 'object'
+               if (typeof context.createElement == 'undefined') 
                        context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
 
                jQuery.each(elems, function(i, elem){
index d69696a..5f2f81a 100644 (file)
@@ -173,7 +173,19 @@ test("$('html', context)", function() {
 
        var $div = $("<div/>");
        var $span = $("<span/>", $div);
-       equals($span.length, 1, "Verify a span created with a div context works");
+       equals($span.length, 1, "Verify a span created with a div context works, #1763");
+});
+
+test("$(selector, xml).text(str) - Loaded via XML document", function() {
+       expect(2);
+       stop();
+       $.get('data/dashboard.xml', function(xml) { 
+               // tests for #1419 where IE was a problem
+               equals( $("tab:first", xml).text(), "blabla", "Verify initial text correct" );
+               $("tab:first", xml).text("newtext");
+               equals( $("tab:first", xml).text(), "newtext", "Verify new text correct" );
+               start();
+       });
 });
 
 test("length", function() {
@@ -355,8 +367,8 @@ if ( !isLocal ) {
               $('tab', xml).each(function() {
                     titles.push($(this).attr('title'));
               });
-              ok( titles[0] == 'Location', 'attr() in XML context: Check first title' );
-              ok( titles[1] == 'Users', 'attr() in XML context: Check second title' );
+              equals( titles[0], 'Location', 'attr() in XML context: Check first title' );
+              equals( titles[1], 'Users', 'attr() in XML context: Check second title' );
               start();
         });
     });