});
test("selector state", function() {
- expect(30);
+ expect(31);
var test;
test = jQuery("#main").eq(0);
equals( test.selector, "#main.slice(0,1)", "#main eq Selector" );
equals( test.context, document, "#main eq Context" );
+
+ var d = "<div />";
+ equals(
+ jQuery(d).appendTo(jQuery(d)).selector,
+ jQuery(d).appendTo(d).selector,
+ "manipulation methods make same selector for jQuery objects"
+ );
});
test("browser", function() {
document.body.appendChild( iframe );
try {
- var body = jQuery(iframe).contents().find("body")[0];
+ var body = jQuery(iframe).contents()[0];
ok( !jQuery.isXMLDoc( body ), "Iframe body element" );
} catch(e){
- ok( false, "Iframe body element" );
+ ok( false, "Iframe body element exception" );
}
document.body.removeChild( iframe );
}
test("jQuery('html')", function() {
- expect(8);
+ expect(13);
reset();
jQuery.foo = false;
jQuery("body").append("<script>jQuery.foo='test';</script>");
ok( jQuery.foo, "Executing a scripts contents in the right context" );
+ // Test multi-line HTML
+ var div = jQuery("<div>\r\nsome text\n<p>some p</p>\nmore text\r\n</div>")[0];
+ equals( div.nodeName.toUpperCase(), "DIV", "Make sure we're getting a div." );
+ equals( div.firstChild.nodeType, 3, "Text node." );
+ equals( div.lastChild.nodeType, 3, "Text node." );
+ equals( div.childNodes[1].nodeType, 1, "Paragraph." );
+ equals( div.childNodes[1].firstChild.nodeType, 3, "Paragraph text." );
+
reset();
ok( jQuery("<link rel='stylesheet'/>")[0], "Creating a link" );
test("jQuery('html', context)", function() {
expect(1);
- var $div = jQuery("<div/>");
+ var $div = jQuery("<div/>")[0];
var $span = jQuery("<span/>", $div);
equals($span.length, 1, "Verify a span created with a div context works, #1763");
});