var
- /* eslint-disable max-len */
-
- // See https://github.com/eslint/eslint/issues/3229
- rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
-
- /* eslint-enable */
-
// Support: IE <=10 - 11, Edge 12 - 13 only
// In IE/Edge using regex groups here causes severe slowdowns.
// See https://connect.microsoft.com/IE/feedback/details/1736512/
jQuery.extend( {
htmlPrefilter: function( html ) {
- return html.replace( rxhtmlTag, "<$1></$2>" );
+ return html;
},
clone: function( elem, dataAndEvents, deepDataAndEvents ) {
}
wrapper.call( QUnit, title, function( assert ) {
var done = assert.async(),
- $iframe = supportjQuery( "<iframe/>" )
+ $iframe = supportjQuery( "<iframe></iframe>" )
.css( { position: "absolute", top: "0", left: "-600px", width: "500px" } )
.attr( { id: "qunit-fixture-iframe", src: url( fileName ) } );
<script>
var logUL = jQuery( "#log" );
function doLog( message, args ) {
- jQuery( "<li />").appendTo( logUL ).text( message + ': "' + Array.prototype.join.call( args, '" - "' ) + '"' );
+ jQuery( "<li></li>" ).appendTo( logUL ).text( message + ': "' + Array.prototype.join.call( args, '" - "' ) + '"' );
}
jQuery.ajax( "./data/badjson.js" , {
context: jQuery( "#success" ),
addGlobalEvents( "ajaxStart ajaxStop ajaxSend ajaxComplete ajaxError", assert )();
jQuery( document ).on( "ajaxStop", done );
- jQuery( "<div/>" ).load( baseURL + "404.txt", function() {
+ jQuery( "<div></div>" ).load( baseURL + "404.txt", function() {
assert.ok( true, "complete" );
} );
} );
return "Hello World";
}
} );
- jQuery( "<div/>" ).load( url( "name.html" ), function( responseText ) {
+ jQuery( "<div></div>" ).load( url( "name.html" ), function( responseText ) {
assert.strictEqual( jQuery( this ).html(), "Hello World", "Test div was filled with filtered data" );
assert.strictEqual( responseText, "Hello World", "Test callback receives filtered data" );
done();
QUnit.test( "jQuery.fn.load( String, Object, Function )", function( assert ) {
assert.expect( 2 );
var done = assert.async();
- jQuery( "<div />" ).load( url( "mock.php?action=echoHtml" ), {
+ jQuery( "<div></div>" ).load( url( "mock.php?action=echoHtml" ), {
"bar": "ok"
}, function() {
var $node = jQuery( this );
assert.expect( 2 );
var done = assert.async();
- jQuery( "<div />" ).load( url( "mock.php?action=echoHtml" ), "foo=3&bar=ok", function() {
+ jQuery( "<div></div>" ).load( url( "mock.php?action=echoHtml" ), "foo=3&bar=ok", function() {
var $node = jQuery( this );
assert.strictEqual( $node.find( "#method" ).text(), "GET", "Check method" );
assert.ok( $node.find( "#query" ).text().match( /foo=3&bar=ok/ ), "Check if a string of data is passed correctly" );
assert.equal( jQuery( "#area1" ).attr( "maxLength" ), "30", "Check for maxLength attribute" );
// using innerHTML in IE causes href attribute to be serialized to the full path
- jQuery( "<a/>" ).attr( {
+ jQuery( "<a></a>" ).attr( {
"id": "tAnchor5",
"href": "#5"
} ).appendTo( "#qunit-fixture" );
assert.equal( jQuery( "#tAnchor5" ).attr( "href" ), "#5", "Check for non-absolute href (an anchor)" );
- jQuery( "<a id='tAnchor6' href='#5' />" ).appendTo( "#qunit-fixture" );
+ jQuery( "<a id='tAnchor6' href='#5'></a>" ).appendTo( "#qunit-fixture" );
assert.equal( jQuery( "#tAnchor5" ).prop( "href" ), jQuery( "#tAnchor6" ).prop( "href" ), "Check for absolute href prop on an anchor" );
jQuery( "<script type='jquery/test' src='#5' id='scriptSrc'></script>" ).appendTo( "#qunit-fixture" );
assert.equal( $img.attr( "height" ), "53", "Retrieve height attribute on an element with display:none." );
// Check for style support
- styleElem = jQuery( "<div/>" ).appendTo( "#qunit-fixture" ).css( {
+ styleElem = jQuery( "<div></div>" ).appendTo( "#qunit-fixture" ).css( {
background: "url(UPPERlower.gif)"
} );
assert.ok( !!~styleElem.attr( "style" ).indexOf( "UPPERlower.gif" ), "Check style attribute getter" );
$a = jQuery( "<a href='#' onclick='something()'>Click</a>" ).appendTo( "#qunit-fixture" );
assert.equal( $a.attr( "onclick" ), "something()", "Retrieve ^on attribute without anonymous function wrapper." );
- assert.ok( jQuery( "<div/>" ).attr( "doesntexist" ) === undefined, "Make sure undefined is returned when no attribute is found." );
- assert.ok( jQuery( "<div/>" ).attr( "title" ) === undefined, "Make sure undefined is returned when no attribute is found." );
- assert.equal( jQuery( "<div/>" ).attr( "title", "something" ).attr( "title" ), "something", "Set the title attribute." );
+ assert.ok( jQuery( "<div></div>" ).attr( "doesntexist" ) === undefined, "Make sure undefined is returned when no attribute is found." );
+ assert.ok( jQuery( "<div></div>" ).attr( "title" ) === undefined, "Make sure undefined is returned when no attribute is found." );
+ assert.equal( jQuery( "<div></div>" ).attr( "title", "something" ).attr( "title" ), "something", "Set the title attribute." );
assert.ok( jQuery().attr( "doesntexist" ) === undefined, "Make sure undefined is returned when no element is there." );
- assert.equal( jQuery( "<div/>" ).attr( "value" ), undefined, "An unset value on a div returns undefined." );
+ assert.equal( jQuery( "<div></div>" ).attr( "value" ), undefined, "An unset value on a div returns undefined." );
assert.strictEqual( jQuery( "<select><option value='property'></option></select>" ).attr( "value" ), undefined, "An unset value on a select returns undefined." );
$form = jQuery( "#form" ).attr( "enctype", "multipart/form-data" );
assert.strictEqual( input.clone( true ).attr( "name", "test" )[ 0 ].name, "test", "Name attribute should be changed on cloned element" );
- div = jQuery( "<div id='tester' />" );
+ div = jQuery( "<div id='tester'></div>" );
div.attr( "id" );
assert.strictEqual( div.clone( true ).attr( "id", "test" )[ 0 ].id, "test", "Id attribute should be changed on cloned element" );
$input = jQuery( "<input type='checkbox'/>" ).attr( "checked", true );
assert.equal( $input.prop( "checked" ), true, "Setting checked updates property (verified by .prop)" );
assert.equal( $input[ 0 ].checked, true, "Setting checked updates property (verified by native property)" );
- $input = jQuery( "<option/>" ).attr( "selected", true );
+ $input = jQuery( "<option></option>" ).attr( "selected", true );
assert.equal( $input.prop( "selected" ), true, "Setting selected updates property (verified by .prop)" );
assert.equal( $input[ 0 ].selected, true, "Setting selected updates property (verified by native property)" );
assert.expect( 12 );
var $first;
- assert.equal( jQuery( "<div class='hello' />" ).removeAttr( "class" ).attr( "class" ), undefined, "remove class" );
+ assert.equal( jQuery( "<div class='hello'></div>" ).removeAttr( "class" ).attr( "class" ), undefined, "remove class" );
assert.equal( jQuery( "#form" ).removeAttr( "id" ).attr( "id" ), undefined, "Remove id" );
assert.equal( jQuery( "#foo" ).attr( "style", "position:absolute;" ).removeAttr( "style" ).attr( "style" ), undefined, "Check removing style attribute" );
assert.equal( jQuery( "#form" ).attr( "style", "position:absolute;" ).removeAttr( "style" ).attr( "style" ), undefined, "Check removing style attribute on a form" );
assert.equal( jQuery( "#select2" ).prop( "selectedIndex" ), 3, "Check for selectedIndex attribute" );
assert.equal( jQuery( "#foo" ).prop( "nodeName" ).toUpperCase(), "DIV", "Check for nodeName attribute" );
assert.equal( jQuery( "#foo" ).prop( "tagName" ).toUpperCase(), "DIV", "Check for tagName attribute" );
- assert.equal( jQuery( "<option/>" ).prop( "selected" ), false, "Check selected attribute on disconnected element." );
+ assert.equal( jQuery( "<option></option>" ).prop( "selected" ), false, "Check selected attribute on disconnected element." );
assert.equal( jQuery( "#listWithTabIndex" ).prop( "tabindex" ), 5, "Check retrieving tabindex" );
jQuery( "#text1" ).prop( "readonly", true );
function addOptions( $elem ) {
return $elem.append(
- jQuery( "<option/>" ).val( "a" ).text( "One" ),
- jQuery( "<option/>" ).val( "b" ).text( "Two" ),
- jQuery( "<option/>" ).val( "c" ).text( "Three" )
+ jQuery( "<option></option>" ).val( "a" ).text( "One" ),
+ jQuery( "<option></option>" ).val( "b" ).text( "Two" ),
+ jQuery( "<option></option>" ).val( "c" ).text( "Three" )
)
.find( "[value=a]" ).prop( "selected", true ).end()
.find( "[value=c]" ).prop( "selected", true ).end();
}
var $optgroup,
- $select = jQuery( "<select/>" );
+ $select = jQuery( "<select></select>" );
// Check select with options
addOptions( $select ).appendTo( "#qunit-fixture" );
$select.empty();
// Check select with optgroup
- $optgroup = jQuery( "<optgroup/>" );
+ $optgroup = jQuery( "<optgroup></optgroup>" );
addOptions( $optgroup ).appendTo( $select );
$select.find( "[value=b]" ).prop( "selected", true );
assert.equal( $button.val(), "foobar", "Value retrieval on a button does not return innerHTML" );
assert.equal( $button.val( "baz" ).html(), "text", "Setting the value does not change innerHTML" );
- assert.equal( jQuery( "<option/>" ).val( "test" ).attr( "value" ), "test", "Setting value sets the value attribute" );
+ assert.equal( jQuery( "<option></option>" ).val( "test" ).attr( "value" ), "test", "Setting value sets the value attribute" );
} );
QUnit.test( "val() with non-matching values on dropdown list", function( assert ) {
assert.equal( document.getElementById( "text1" ).value, "", "Check for modified (via val(null)) value of input element" );
var j,
- $select = jQuery( "<select multiple><option value='1'/><option value='2'/></select>" ),
+ $select = jQuery( "<select multiple><option value='1'></option><option value='2'></option></select>" ),
$select1 = jQuery( "#select1" );
$select1.val( valueObj( "3" ) );
QUnit.test( "select.val(space characters) (gh-2978)", function( assert ) {
assert.expect( 37 );
- var $select = jQuery( "<select/>" ).appendTo( "#qunit-fixture" ),
+ var $select = jQuery( "<select></select>" ).appendTo( "#qunit-fixture" ),
spaces = {
"\\t": {
html: "	",
j.addClass( valueObj( "asdf" ) );
assert.ok( j.hasClass( "asdf" ), "Check node,textnode,comment for addClass" );
- div = jQuery( "<div/>" );
+ div = jQuery( "<div></div>" );
div.addClass( valueObj( "test" ) );
assert.equal( div.attr( "class" ), "test", "Make sure there's no extra whitespace." );
assert.expect( 1 );
var area,
- map = jQuery( "<map />" );
+ map = jQuery( "<map></map>" );
- area = map.html( "<area shape='rect' coords='0,0,0,0' href='#' alt='a' />" ).find( "area" );
+ area = map.html( "<area shape='rect' coords='0,0,0,0' href='#' alt='a'></area>" ).find( "area" );
assert.equal( area.attr( "coords" ), "0,0,0,0", "did not retrieve coords correctly" );
} );
assert.expect( 1 );
try {
- jQuery( "<option/>" ).val();
+ jQuery( "<option></option>" ).val();
assert.ok( true );
} catch ( _ ) {
assert.ok( false );
QUnit.test( "attributes", function( assert ) {
assert.expect( 6 );
- var a = jQuery( "<a/>" ).appendTo( "#qunit-fixture" ),
+ var a = jQuery( "<a></a>" ).appendTo( "#qunit-fixture" ),
input = jQuery( "<input/>" ).appendTo( "#qunit-fixture" );
assert.strictEqual( a.attr( "foo", "bar" ).attr( "foo" ), "bar", ".attr getter/setter" );
QUnit.test( "css", function( assert ) {
assert.expect( 1 );
- var div = jQuery( "<div/>" ).appendTo( "#qunit-fixture" );
+ var div = jQuery( "<div></div>" ).appendTo( "#qunit-fixture" );
assert.strictEqual( div.css( "width", "50px" ).css( "width" ), "50px", ".css getter/setter" );
} );
QUnit.test( "show/hide", function( assert ) {
assert.expect( 2 );
- var div = jQuery( "<div/>" ).appendTo( "#qunit-fixture" );
+ var div = jQuery( "<div></div>" ).appendTo( "#qunit-fixture" );
div.hide();
assert.strictEqual( div.css( "display" ), "none", "div hidden" );
QUnit.test( "data", function( assert ) {
assert.expect( 4 );
- var elem = jQuery( "<div data-c='d'/>" ).appendTo( "#qunit-fixture" );
+ var elem = jQuery( "<div data-c='d'></div>" ).appendTo( "#qunit-fixture" );
assert.ok( !jQuery.hasData( elem[ 0 ] ), "jQuery.hasData - false" );
assert.strictEqual( elem.data( "a", "b" ).data( "a" ), "b", ".data getter/setter" );
assert.expect( 3 );
var elem = jQuery(
- "<div style='margin: 10px; padding: 7px; border: 2px solid black;' /> "
+ "<div style='margin: 10px; padding: 7px; border: 2px solid black;'></div> "
).appendTo( "#qunit-fixture" );
assert.strictEqual( elem.width( 50 ).width(), 50, ".width getter/setter" );
QUnit.test( "event", function( assert ) {
assert.expect( 1 );
- var elem = jQuery( "<div/>" ).appendTo( "#qunit-fixture" );
+ var elem = jQuery( "<div></div>" ).appendTo( "#qunit-fixture" );
elem
.on( "click", function() {
var child,
elem1 = jQuery( "<div><span></span></div>" ).appendTo( "#qunit-fixture" ),
- elem2 = jQuery( "<div/>" ).appendTo( "#qunit-fixture" );
+ elem2 = jQuery( "<div></div>" ).appendTo( "#qunit-fixture" );
assert.strictEqual( elem1.text( "foo" ).text(), "foo", ".html getter/setter" );
assert.strictEqual(
- elem1.html( "<span/>" ).html(),
+ elem1.html( "<span></span>" ).html(),
"<span></span>",
".html getter/setter"
);
assert.strictEqual( elem1.prepend( elem2 )[ 0 ].childNodes[ 0 ], elem2[ 0 ], ".prepend" );
child = elem1.find( "span" );
- child.after( "<a/>" );
- child.before( "<b/>" );
+ child.after( "<a></a>" );
+ child.before( "<b></b>" );
assert.strictEqual(
elem1.html(),
QUnit[ /jsdom\//.test( navigator.userAgent ) ? "skip" : "test" ]( "offset", function( assert ) {
assert.expect( 3 );
- var parent = jQuery( "<div style='position:fixed;top:20px;'/>" ).appendTo( "#qunit-fixture" ),
- elem = jQuery( "<div style='position:absolute;top:5px;'/>" ).appendTo( parent );
+ var parent = jQuery( "<div style='position:fixed;top:20px;'></div>" ).appendTo( "#qunit-fixture" ),
+ elem = jQuery( "<div style='position:absolute;top:5px;'></div>" ).appendTo( parent );
assert.strictEqual( elem.offset().top, 25, ".offset getter" );
assert.strictEqual( elem.position().top, 5, ".position getter" );
var elem, i,
obj = jQuery( "div" ),
- code = jQuery( "<code/>" ),
+ code = jQuery( "<code></code>" ),
img = jQuery( "<img/>" ),
- div = jQuery( "<div/><hr/><code/><b/>" ),
+ div = jQuery( "<div></div><hr/><code></code><b/>" ),
exec = false,
expected = 23,
attrObj = {
elem = jQuery( "\n\n<em>world</em>" )[ 0 ];
assert.equal( elem.nodeName.toLowerCase(), "em", "leading newlines" );
- elem = jQuery( "<div/>", attrObj );
+ elem = jQuery( "<div></div>", attrObj );
if ( jQuery.fn.width ) {
assert.equal( elem[ 0 ].style.width, "10px", "jQuery() quick setter width" );
assert.ok( jQuery( "<link rel='stylesheet'/>" )[ 0 ], "Creating a link" );
- assert.ok( !jQuery( "<script/>" )[ 0 ].parentNode, "Create a script" );
+ assert.ok( !jQuery( "<script></script>" )[ 0 ].parentNode, "Create a script" );
assert.ok( jQuery( "<input/>" ).attr( "type", "hidden" ), "Create an input and set the type." );
QUnit.test( "jQuery('html', context)", function( assert ) {
assert.expect( 1 );
- var $div = jQuery( "<div/>" )[ 0 ],
- $span = jQuery( "<span/>", $div );
+ var $div = jQuery( "<div></div>" )[ 0 ],
+ $span = jQuery( "<span></span>", $div );
assert.equal( $span.length, 1, "verify a span created with a div context works, #1763" );
} );
assert.equal( jQuery.parseHTML( "text" )[ 0 ].nodeType, 3, "Parsing text returns a text node" );
assert.equal( jQuery.parseHTML( "\t<div></div>" )[ 0 ].nodeValue, "\t", "Preserve leading whitespace" );
- assert.equal( jQuery.parseHTML( " <div/> " )[ 0 ].nodeType, 3, "Leading spaces are treated as text nodes (#11290)" );
+ assert.equal( jQuery.parseHTML( " <div></div> " )[ 0 ].nodeType, 3, "Leading spaces are treated as text nodes (#11290)" );
html = jQuery.parseHTML( "<div>test div</div>" );
assert.notEqual( $child.css( "width" ), "20px", "Retrieving a width percentage on the child of a hidden div returns percentage" );
assert.notEqual( $child.css( "height" ), "20px", "Retrieving a height percentage on the child of a hidden div returns percentage" );
- div = jQuery( "<div/>" );
+ div = jQuery( "<div></div>" );
// These should be "auto" (or some better value)
// temporarily provide "0px" for backwards compat
assert.equal( div.css( "width" ), "4px", "Width on disconnected node." );
assert.equal( div.css( "height" ), "4px", "Height on disconnected node." );
- div2 = jQuery( "<div style='display:none;'><input type='text' style='height:20px;'/><textarea style='height:20px;'/><div style='height:20px;'></div></div>" ).appendTo( "body" );
+ div2 = jQuery( "<div style='display:none;'><input type='text' style='height:20px;'/><textarea style='height:20px;'></textarea><div style='height:20px;'></div></div>" ).appendTo( "body" );
assert.equal( div2.find( "input" ).css( "height" ), "20px", "Height on hidden input." );
assert.equal( div2.find( "textarea" ).css( "height" ), "20px", "Height on hidden textarea." );
assert.equal( parseFloat( jQuery( "#nothiddendiv" ).css( "width" ) ), 0, "Test negative width set to 0" );
assert.equal( parseFloat( jQuery( "#nothiddendiv" ).css( "height" ) ), 0, "Test negative height set to 0" );
- assert.equal( jQuery( "<div style='display: none;'/>" ).css( "display" ), "none", "Styles on disconnected nodes" );
+ assert.equal( jQuery( "<div style='display: none;'></div>" ).css( "display" ), "none", "Styles on disconnected nodes" );
jQuery( "#floatTest" ).css( { "float": "right" } );
assert.equal( jQuery( "#floatTest" ).css( "float" ), "right", "Modified CSS float using \"float\": Assert float is right" );
assert.strictEqual( child.css( "x-fake" ), undefined, "Make sure undefined is returned from css(nonexistent)." );
- div = jQuery( "<div/>" ).css( { position: "absolute", "z-index": 1000 } ).appendTo( "#qunit-fixture" );
+ div = jQuery( "<div></div>" ).css( { position: "absolute", "z-index": 1000 } ).appendTo( "#qunit-fixture" );
assert.strictEqual( div.css( "z-index" ), "1000",
"Make sure that a string z-index is returned from css('z-index') (#14432)." );
} );
assert.expect( 1 );
var right,
- $container = jQuery( "<div/>" )
+ $container = jQuery( "<div></div>" )
.css( { position: "absolute", width: "400px", fontSize: "4px" } )
.appendTo( "#qunit-fixture" ),
- $el = jQuery( "<div/>" )
+ $el = jQuery( "<div></div>" )
.css( { position: "absolute", left: "50%", right: "50%" } )
.appendTo( $container );
assert.equal( div.css( "display" ), "none",
"A shown-while-detached div inside a visible div can be hidden by the CSS cascade" );
- span = jQuery( "<span class='hidden'/>" );
+ span = jQuery( "<span class='hidden'></span>" );
span.show().appendTo( "#qunit-fixture" );
assert.equal( span.css( "display" ), "none",
"A shown-while-detached span can be hidden by the CSS cascade" );
"A shown-while-detached cascade-hidden div is hidden after attachment" );
div.remove();
- span = jQuery( "<span class='hidden'/>" );
+ span = jQuery( "<span class='hidden'></span>" );
span.appendTo( "#qunit-fixture" ).detach().show().appendTo( "#qunit-fixture" );
assert.equal( span.css( "display" ), "none",
"A shown-while-detached cascade-hidden span is hidden after attachment" );
"A shown-while-detached inline-hidden div inside a visible div has default display " +
"after attachment" );
- span = jQuery( "<span style='display: none'/>" );
+ span = jQuery( "<span style='display: none'></span>" );
span.show();
assert.equal( span[ 0 ].style.display, "",
"show() updates inline style of a detached inline-hidden span" );
assert.equal( span.css( "display" ), "inline",
"A shown-while-detached inline-hidden span has default display after attachment" );
- div = jQuery( "<div style='display: inline'/>" );
+ div = jQuery( "<div style='display: inline'></div>" );
div.show().appendTo( "#qunit-fixture" );
assert.equal( div.css( "display" ), "inline",
"show() does not update inline style of a detached inline-visible div" );
div.remove();
- tr = jQuery( "<tr/>" );
+ tr = jQuery( "<tr></tr>" );
jQuery( "#table" ).append( tr );
tr.detach().hide().show();
assert.ok( !tr[ 0 ].style.display, "Not-hidden detached tr elements have no inline style" );
tr.remove();
- span = jQuery( "<span/>" ).hide().show();
+ span = jQuery( "<span></span>" ).hide().show();
assert.ok( !span[ 0 ].style.display, "Not-hidden detached span elements have no inline style" );
span.remove();
} );
QUnit.test( "show() after hide() should always set display to initial value (#14750)", function( assert ) {
assert.expect( 1 );
- var div = jQuery( "<div />" ),
+ var div = jQuery( "<div></div>" ),
fixture = jQuery( "#qunit-fixture" );
fixture.append( div );
assert.expect( 36 );
var i,
- $elems = jQuery( "<div/>" )
+ $elems = jQuery( "<div></div>" )
.appendTo( "#qunit-fixture" )
- .html( "<div data-expected-display='block'/>" +
- "<span data-expected-display='inline'/>" +
- "<ul><li data-expected-display='list-item'/></ul>" )
+ .html( "<div data-expected-display='block'></div>" +
+ "<span data-expected-display='inline'></span>" +
+ "<ul><li data-expected-display='list-item'></li></ul>" )
.find( "[data-expected-display]" );
$elems.each( function() {
assert.expect( 36 );
var i,
- $elems = jQuery( "<div/>" )
+ $elems = jQuery( "<div></div>" )
.appendTo( "#qunit-fixture" )
- .html( "<span class='block'/><div class='inline'/><div class='list-item'/>" )
+ .html( "<span class='block'></span><div class='inline'></div><div class='list-item'></div>" )
.children();
$elems.each( function() {
assert.expect( 96 );
var i,
- $elems = jQuery( "<div/>" )
+ $elems = jQuery( "<div></div>" )
.appendTo( "#qunit-fixture" )
- .html( "<span data-expected-display='block' style='display:block'/>" +
- "<span class='list-item' data-expected-display='block' style='display:block'/>" +
- "<div data-expected-display='inline' style='display:inline'/>" +
- "<div class='list-item' data-expected-display='inline' style='display:inline'/>" +
+ .html( "<span data-expected-display='block' style='display:block'></span>" +
+ "<span class='list-item' data-expected-display='block' style='display:block'></span>" +
+ "<div data-expected-display='inline' style='display:inline'></div>" +
+ "<div class='list-item' data-expected-display='inline' style='display:inline'></div>" +
"<ul>" +
- "<li data-expected-display='block' style='display:block'/>" +
- "<li class='inline' data-expected-display='block' style='display:block'/>" +
- "<li data-expected-display='inline' style='display:inline'/>" +
- "<li class='block' data-expected-display='inline' style='display:inline'/>" +
+ "<li data-expected-display='block' style='display:block'></li>" +
+ "<li class='inline' data-expected-display='block' style='display:block'></li>" +
+ "<li data-expected-display='inline' style='display:inline'></li>" +
+ "<li class='block' data-expected-display='inline' style='display:inline'></li>" +
"</ul>" )
.find( "[data-expected-display]" );
assert.expect( 72 );
var i,
- $elems = jQuery( "<div/>" )
+ $elems = jQuery( "<div></div>" )
.appendTo( "#qunit-fixture" )
- .html( "<div class='hidden' data-expected-display='block'/>" +
- "<div class='hidden' data-expected-display='block' style='display:none'/>" +
- "<span class='hidden' data-expected-display='inline'/>" +
- "<span class='hidden' data-expected-display='inline' style='display:none'/>" +
+ .html( "<div class='hidden' data-expected-display='block'></div>" +
+ "<div class='hidden' data-expected-display='block' style='display:none'></div>" +
+ "<span class='hidden' data-expected-display='inline'></span>" +
+ "<span class='hidden' data-expected-display='inline' style='display:none'></span>" +
"<ul>" +
- "<li class='hidden' data-expected-display='list-item'/>" +
- "<li class='hidden' data-expected-display='list-item' style='display:none'/>" +
+ "<li class='hidden' data-expected-display='list-item'></li>" +
+ "<li class='hidden' data-expected-display='list-item' style='display:none'></li>" +
"</ul>" )
.find( "[data-expected-display]" );
assert.expect( 84 );
var i,
- $elems = jQuery( "<div/>" )
+ $elems = jQuery( "<div></div>" )
.appendTo( "#qunit-fixture" )
- .html( "<span data-expected-display='inline' style='display:none'/>" +
- "<span class='list-item' data-expected-display='list-item' style='display:none'/>" +
- "<div data-expected-display='block' style='display:none'/>" +
- "<div class='list-item' data-expected-display='list-item' style='display:none'/>" +
+ .html( "<span data-expected-display='inline' style='display:none'></span>" +
+ "<span class='list-item' data-expected-display='list-item' style='display:none'></span>" +
+ "<div data-expected-display='block' style='display:none'></div>" +
+ "<div class='list-item' data-expected-display='list-item' style='display:none'></div>" +
"<ul>" +
- "<li data-expected-display='list-item' style='display:none'/>" +
- "<li class='block' data-expected-display='block' style='display:none'/>" +
- "<li class='inline' data-expected-display='inline' style='display:none'/>" +
+ "<li data-expected-display='list-item' style='display:none'></li>" +
+ "<li class='block' data-expected-display='block' style='display:none'></li>" +
+ "<li class='inline' data-expected-display='inline' style='display:none'></li>" +
"</ul>" )
.find( "[data-expected-display]" );
QUnit[ jQuery.find.compile && jQuery.fn.toggle ? "test" : "skip" ]( "detached toggle()", function( assert ) {
assert.expect( 6 );
- var detached = jQuery( "<p><a/><p>" ).find( "*" ).addBack(),
- hiddenDetached = jQuery( "<p><a/></p>" ).find( "*" ).addBack().css( "display", "none" ),
- cascadeHiddenDetached = jQuery( "<p><a/></p>" ).find( "*" ).addBack().addClass( "hidden" );
+ var detached = jQuery( "<p><a></a><p>" ).find( "*" ).addBack(),
+ hiddenDetached = jQuery( "<p><a></a></p>" ).find( "*" ).addBack().css( "display", "none" ),
+ cascadeHiddenDetached = jQuery( "<p><a></a></p>" ).find( "*" ).addBack().addClass( "hidden" );
detached.toggle();
detached.appendTo( "#qunit-fixture" );
QUnit.test( "box model properties incorrectly returning % instead of px, see #10639 and #12088", function( assert ) {
assert.expect( 2 );
- var container = jQuery( "<div/>" ).width( 400 ).appendTo( "#qunit-fixture" ),
- el = jQuery( "<div/>" ).css( { "width": "50%", "marginRight": "50%" } ).appendTo( container ),
- el2 = jQuery( "<div/>" ).css( { "width": "50%", "minWidth": "300px", "marginLeft": "25%" } ).appendTo( container );
+ var container = jQuery( "<div></div>" ).width( 400 ).appendTo( "#qunit-fixture" ),
+ el = jQuery( "<div></div>" ).css( { "width": "50%", "marginRight": "50%" } ).appendTo( container ),
+ el2 = jQuery( "<div></div>" ).css( { "width": "50%", "minWidth": "300px", "marginLeft": "25%" } ).appendTo( container );
assert.equal( el.css( "marginRight" ), "200px", "css('marginRight') returning % instead of px, see #10639" );
assert.equal( el2.css( "marginLeft" ), "100px", "css('marginLeft') returning incorrect pixel value, see #12088" );
assert.expect( 2 );
var span, div;
- span = jQuery( "<span/>" ).css( "background-image", "url(" + baseURL + "1x1.jpg)" );
+ span = jQuery( "<span></span>" ).css( "background-image", "url(" + baseURL + "1x1.jpg)" );
assert.notEqual( span.css( "background-image" ), null, "can't get background-image in IE<9, see #10254" );
- div = jQuery( "<div/>" ).css( "top", 10 );
+ div = jQuery( "<div></div>" ).css( "top", 10 );
assert.equal( div.css( "top" ), "10px", "can't get top in IE<9, see #8388" );
} );
} );
QUnit.test( "can't get background-position in IE<9, see #10796", function( assert ) {
- var div = jQuery( "<div/>" ).appendTo( "#qunit-fixture" ),
+ var div = jQuery( "<div></div>" ).appendTo( "#qunit-fixture" ),
units = [
"0 0",
"12px 12px",
};
for ( prop in gridProps ) {
- $div = jQuery( "<div/>" ).appendTo( "#qunit-fixture" );
+ $div = jQuery( "<div></div>" ).appendTo( "#qunit-fixture" );
$div.css( prop, 2 );
value = gridProps[ prop ];
QUnit.test( "Don't append px to CSS \"order\" value (#14049)", function( assert ) {
assert.expect( 1 );
- var $elem = jQuery( "<div/>" );
+ var $elem = jQuery( "<div></div>" );
$elem.css( "order", 2 );
assert.equal( $elem.css( "order" ), "2", "2 on order" );
resetCssPropsFor( "appearance" );
resetCssPropsFor( "transform" );
- elem = jQuery( "<div/>" )
+ elem = jQuery( "<div></div>" )
.css( {
msAppearance: "none",
appearance: "none",
QUnit.test( "Don't detect fake set properties on a node when caching the prefixed version", function( assert ) {
assert.expect( 1 );
- var elem = jQuery( "<div/>" ),
+ var elem = jQuery( "<div></div>" ),
style = elem[ 0 ].style;
style.MozFakeProperty = "old value";
elem.css( "fakeProperty", "new value" );
assert.expect( 4 );
var obj, jqobj,
- div = jQuery( "<div/>" );
+ div = jQuery( "<div></div>" );
div.data( { "test": "in", "test2": "in2" } );
assert.equal( div.data( "test" ), "in", "Verify setting an object in data" );
assert.expect( 2 );
- var div = jQuery( "<div/>", { id: "hyphened" } ).appendTo( "#qunit-fixture" ),
+ var div = jQuery( "<div></div>", { id: "hyphened" } ).appendTo( "#qunit-fixture" ),
test = {
"camelBar": "camelBar",
"hyphen-foo": "hyphen-foo"
assert.expect( 1 );
- var div = jQuery( "<div/>" );
+ var div = jQuery( "<div></div>" );
div.data( "foo-bar", "baz" );
var a, b;
- a = jQuery( "<div/>" ).appendTo( "#qunit-fixture" );
+ a = jQuery( "<div></div>" ).appendTo( "#qunit-fixture" );
a.attr( "data-long-param", "test" );
a.data( "long-param", { a: 2 } );
assert.deepEqual( a.data( "long-param" ), { a: 2 }, "data with property long-param was found, 1" );
- b = jQuery( "<div/>" ).appendTo( "#qunit-fixture" );
+ b = jQuery( "<div></div>" ).appendTo( "#qunit-fixture" );
b.attr( "data-long-param", "test" );
b.data( "long-param" );
QUnit.test( ".data supports interoperable hyphenated/camelCase get/set of properties with arbitrary non-null|NaN|undefined values", function( assert ) {
- var div = jQuery( "<div/>", { id: "hyphened" } ).appendTo( "#qunit-fixture" ),
+ var div = jQuery( "<div></div>", { id: "hyphened" } ).appendTo( "#qunit-fixture" ),
datas = {
"non-empty": {
key: "nonEmpty",
} );
QUnit.test( ".data supports interoperable removal of hyphenated/camelCase properties", function( assert ) {
- var div = jQuery( "<div/>", { id: "hyphened" } ).appendTo( "#qunit-fixture" ),
+ var div = jQuery( "<div></div>", { id: "hyphened" } ).appendTo( "#qunit-fixture" ),
rdashAlpha = /-([a-z])/g,
datas = {
"non-empty": "a string",
assert.expect( 2 );
var key,
- div = jQuery( "<div/>" );
+ div = jQuery( "<div></div>" );
div.data( "some", "data" );
assert.equal( div.data( "some" ), "data", "Data is added" );
div.removeData( "some" );
assert.expect( 1 );
var key,
- div = jQuery( "<div/>" );
+ div = jQuery( "<div></div>" );
div.data( "foo" );
assert.equal( jQuery.hasData( div[ 0 ] ), false, "No data exists after access" );
QUnit.test( "keys matching Object.prototype properties (gh-3256)", function( assert ) {
assert.expect( 2 );
- var div = jQuery( "<div/>" );
+ var div = jQuery( "<div></div>" );
assert.strictEqual( div.data( "hasOwnProperty" ), undefined,
"hasOwnProperty not matched (before forced data creation)" );
QUnit[ jQuery.fn.click ? "test" : "skip" ]( "Event aliases", function( assert ) {
// Explicitly skipping focus/blur events due to their flakiness
- var $elem = jQuery( "<div />" ).appendTo( "#qunit-fixture" ),
+ var $elem = jQuery( "<div></div>" ).appendTo( "#qunit-fixture" ),
aliases = ( "resize scroll click dblclick mousedown mouseup " +
"mousemove mouseover mouseout mouseenter mouseleave change " +
"select submit keydown keypress keyup contextmenu" ).split( " " );
QUnit.test( "table dimensions", function( assert ) {
assert.expect( 2 );
- var table = jQuery( "<table><colgroup><col/><col/></colgroup><tbody><tr><td></td><td>a</td></tr><tr><td></td><td>a</td></tr></tbody></table>" ).appendTo( "#qunit-fixture" ),
+ var table = jQuery( "<table><colgroup><col></col><col></col></colgroup><tbody><tr><td></td><td>a</td></tr><tr><td></td><td>a</td></tr></tbody></table>" ).appendTo( "#qunit-fixture" ),
tdElem = table.find( "td" ).first(),
colElem = table.find( "col" ).first().width( 300 );
assert.expect( 1 );
var offsetTop,
- element = jQuery( "<div/>" ).appendTo( "#qunit-fixture" );
+ element = jQuery( "<div></div>" ).appendTo( "#qunit-fixture" );
element.offset( function( index, coords ) {
coords.top = 100;
assert.expect( 2 );
- var $elem = jQuery( "<div style='width: 200px; height: 200px; transform: scale(2);' />" )
+ var $elem = jQuery( "<div style='width: 200px; height: 200px; transform: scale(2);'></div>" )
.appendTo( "#qunit-fixture" );
assert.equal( $elem.width(), 200, "Width ignores transforms" );
return old + adjustment;
};
},
- parent = jQuery( "<div/>" )
+ parent = jQuery( "<div></div>" )
.css( { position: "absolute", width: "1000px", height: "1000px" } )
.appendTo( "#qunit-fixture" ),
fraction = jQuery.support.boxSizingReliable() ?
borderWidth = 1,
padding = 2,
size = 100 + fraction,
- plainBox = jQuery( "<div />" )
+ plainBox = jQuery( "<div></div>" )
.css( {
"box-sizing": "content-box",
position: "absolute",
QUnit.test( "outerWidth/Height for table cells and textarea with border-box in IE 11 (gh-4102)", function( assert ) {
assert.expect( 5 );
- var $table = jQuery( "<table class='border-box' style='border-collapse: separate' />" ).appendTo( "#qunit-fixture" ),
- $thead = jQuery( "<thead />" ).appendTo( $table ),
- $firstTh = jQuery( "<th style='width: 200px;padding: 5px' />" ),
- $secondTh = jQuery( "<th style='width: 190px;padding: 5px' />" ),
- $thirdTh = jQuery( "<th style='width: 180px;padding: 5px' />" ),
+ var $table = jQuery( "<table class='border-box' style='border-collapse: separate'></table>" ).appendTo( "#qunit-fixture" ),
+ $thead = jQuery( "<thead></thead>" ).appendTo( $table ),
+ $firstTh = jQuery( "<th style='width: 200px;padding: 5px'></th>" ),
+ $secondTh = jQuery( "<th style='width: 190px;padding: 5px'></th>" ),
+ $thirdTh = jQuery( "<th style='width: 180px;padding: 5px'></th>" ),
// Support: Firefox 63, Edge 16-17, Android 8, iOS 7-11
// These browsers completely ignore the border-box and height settings
// Either way, what we're doing in css.js is correct
$td = jQuery( "<td style='height: 20px;padding: 5px;border: 1px solid;line-height:18px'>text</td>" ),
- $tbody = jQuery( "<tbody />" ).appendTo( $table ),
- $textarea = jQuery( "<textarea style='height: 0;padding: 2px;border: 1px solid;box-sizing: border-box' />" ).appendTo( "#qunit-fixture" );
+ $tbody = jQuery( "<tbody></tbody>" ).appendTo( $table ),
+ $textarea = jQuery( "<textarea style='height: 0;padding: 2px;border: 1px solid;box-sizing: border-box'></textarea>" ).appendTo( "#qunit-fixture" );
- jQuery( "<tr />" ).appendTo( $thead ).append( $firstTh );
- jQuery( "<tr />" ).appendTo( $thead ).append( $secondTh );
- jQuery( "<tr />" ).appendTo( $thead ).append( $thirdTh );
+ jQuery( "<tr></tr>" ).appendTo( $thead ).append( $firstTh );
+ jQuery( "<tr></tr>" ).appendTo( $thead ).append( $secondTh );
+ jQuery( "<tr></tr>" ).appendTo( $thead ).append( $thirdTh );
jQuery( "<tr><td></td></tr>" ).appendTo( $tbody ).append( $td );
assert.strictEqual( $firstTh.outerWidth(), 200, "First th has outerWidth 200." );
} );
this.clock.tick( 200 );
- $elem = jQuery( "<div />" );
+ $elem = jQuery( "<div></div>" );
$elem.show( 0, function() {
assert.ok( true, "Show callback with no duration" );
} );
QUnit.test( "hide hidden elements, with animation (bug #7141)", function( assert ) {
assert.expect( 4 );
- var div = jQuery( "<div id='bug7141' style='display:none'/>" ).appendTo( "#qunit-fixture" );
+ var div = jQuery( "<div id='bug7141' style='display:none'></div>" ).appendTo( "#qunit-fixture" );
assert.equal( div.css( "display" ), "none", "Element is initially hidden" );
div.hide( 10, function() {
assert.equal( div.css( "display" ), "none", "Element is hidden in .hide() callback" );
toggle: [ 1 ],
slideToggle: []
},
- $divEmpty = jQuery( "<div/>" ),
+ $divEmpty = jQuery( "<div></div>" ),
$divTest = jQuery( "<div>test</div>" ),
- $divNone = jQuery( "<div style='display: none;'/>" ),
- $divInline = jQuery( "<div style='display: inline;'/>" ),
+ $divNone = jQuery( "<div style='display: none;'></div>" ),
+ $divInline = jQuery( "<div style='display: inline;'></div>" ),
nullParentDisplay = $divEmpty.css( "display" ),
underFragmentDisplay = $divTest.css( "display" ),
clock = this.clock;
assert.expectJqData( env, $divNone[ 0 ], "olddisplay" );
jQuery.each( showMethods, function( name, opt ) {
- jQuery.fn[ name ].apply( jQuery( "<div/>" ), opt.concat( [ function() {
+ jQuery.fn[ name ].apply( jQuery( "<div></div>" ), opt.concat( [ function() {
assert.strictEqual( jQuery( this ).css( "display" ), nullParentDisplay,
"." + name + " block with null parentNode" );
} ] ) );
} ] ) );
} );
jQuery.each( toggleMethods, function( name, opt ) {
- jQuery.fn[ name ].apply( jQuery( "<div/>" ), opt.concat( [ function() {
+ jQuery.fn[ name ].apply( jQuery( "<div></div>" ), opt.concat( [ function() {
assert.strictEqual( jQuery( this ).css( "display" ), "none",
"." + name + " block with null parentNode" );
} ] ) );
assert.expect( 2 );
var clock = this.clock,
- fromStyleSheet = jQuery( "<span id='span-14824' />" ),
- fromStyleAttr = jQuery( "<span style='display: block;' />" );
+ fromStyleSheet = jQuery( "<span id='span-14824'></span>" ),
+ fromStyleAttr = jQuery( "<span style='display: block;'></span>" );
jQuery( "#qunit-fixture" ).append( fromStyleSheet, fromStyleAttr );
QUnit.test( "Display value is correct for disconnected nodes (trac-13310)", function( assert ) {
assert.expect( 3 );
- var div = jQuery( "<div/>" );
+ var div = jQuery( "<div></div>" );
assert.equal( div.css( "display", "inline" ).hide().show().appendTo( "body" ).css( "display" ), "inline", "Initialized display value has returned" );
div.remove();
var clock = this.clock;
- jQuery( "<span/><div style='display:inline' title='inline div'/>" ).each( function() {
+ jQuery( "<span></span><div style='display:inline' title='inline div'></div>" ).each( function() {
var completed, interrupted,
N = 100,
fixture = jQuery( "#qunit-fixture" ),
var cur, div,
obj = {};
- div = jQuery( "<div/>" ).on( "focusin.a", function( e ) {
+ div = jQuery( "<div></div>" ).on( "focusin.a", function( e ) {
assert.equal( e.type, cur, "Verify right single event was fired." );
} );
// manually clean up detached elements
div.remove();
- div = jQuery( "<div/>" ).on( "click mouseover", obj, function( e ) {
+ div = jQuery( "<div></div>" ).on( "click mouseover", obj, function( e ) {
assert.equal( e.type, cur, "Verify right multi event was fired." );
assert.equal( e.data, obj, "Make sure the data came in correctly." );
} );
// manually clean up detached elements
div.remove();
- div = jQuery( "<div/>" ).on( "focusin.a focusout.b", function( e ) {
+ div = jQuery( "<div></div>" ).on( "focusin.a focusout.b", function( e ) {
assert.equal( e.type, cur, "Verify right multi event was fired." );
} );
assert.expect( 27 );
var i = 0,
- div = jQuery( "<div/>" ).appendTo( "#qunit-fixture" ).on( "test", function() {
+ div = jQuery( "<div></div>" ).appendTo( "#qunit-fixture" ).on( "test", function() {
assert.ok( true, "Test event fired." );
} );
// Should trigger 4
div.off( "test" );
- div = jQuery( "<div/>" ).on( "test", function() {
+ div = jQuery( "<div></div>" ).on( "test", function() {
assert.ok( true, "Test event fired." );
} );
assert.expect( 1 );
var count = 0,
- elem = jQuery( "<a />" );
+ elem = jQuery( "<a></a>" );
elem.on( "mouseenter", function() {
count++;
} );
assert.expect( 1 );
var count = 0,
- elem = jQuery( "<a />" );
+ elem = jQuery( "<a></a>" );
elem.on( "pointerenter", function() {
count++;
} );
var $formByClone, $formByHTML,
$testForm = jQuery( "#testForm" ),
$fixture = jQuery( "#qunit-fixture" ),
- $wrapperDiv = jQuery( "<div/>" ).appendTo( $fixture );
+ $wrapperDiv = jQuery( "<div></div>" ).appendTo( $fixture );
function noSubmit( e ) {
e.preventDefault();
var $formByClone, $formByHTML,
$form = jQuery( "#form" ),
$fixture = jQuery( "#qunit-fixture" ),
- $wrapperDiv = jQuery( "<div/>" ).appendTo( $fixture );
+ $wrapperDiv = jQuery( "<div></div>" ).appendTo( $fixture );
function delegatedChange() {
assert.ok( true, "Make sure change event bubbles up." );
assert.expect( 28 );
var event,
- $parent = jQuery( "<div id='par' />" ).appendTo( "body" ),
+ $parent = jQuery( "<div id='par'></div>" ).appendTo( "body" ),
$child = jQuery( "<p id='child'>foo</p>" ).appendTo( $parent );
$parent.get( 0 ).style.display = "none";
QUnit.test( "events with type matching an Object.prototype property (gh-3256)", function( assert ) {
assert.expect( 1 );
- var elem = jQuery( "<div/>" ),
+ var elem = jQuery( "<div></div>" ),
eventFired = false;
elem.appendTo( "#qunit-fixture" );
function( assert ) {
assert.expect( 1 );
- var elem = jQuery( "<div/>" ),
+ var elem = jQuery( "<div></div>" ),
eventFired = false;
elem.appendTo( "#qunit-fixture" );
assert.expect( 2 );
var key,
- div = jQuery( "<div/>" ).appendTo( "#qunit-fixture" );
+ div = jQuery( "<div></div>" ).appendTo( "#qunit-fixture" );
div.on( "click", false );
div.on( "custom", function() {
assert.equal( $multipleElements.eq( 1 ).text(), expected, "text() updates multiple elements (#11809)" );
// Prevent memory leaks #11809
- $childDiv = jQuery( "<div/>" );
+ $childDiv = jQuery( "<div></div>" );
$childDiv.data( "leak", true );
- $parentDiv = jQuery( "<div/>" );
+ $parentDiv = jQuery( "<div></div>" );
$parentDiv.append( $childDiv );
$parentDiv.text( "Dry off" );
}
assert.strictEqual( e.message || e, undefined, message );
}
- jQuery( "<fieldset/>" ).appendTo( "#form" ).append( valueObj( "<legend id='legend'>test</legend>" ) );
+ jQuery( "<fieldset></fieldset>" ).appendTo( "#form" ).append( valueObj( "<legend id='legend'>test</legend>" ) );
assert.t( "Append legend", "#legend", [ "legend" ] );
- $map = jQuery( "<map/>" ).append( valueObj( "<area id='map01' shape='rect' coords='50,50,150,150' href='http://www.jquery.com/' alt='jQuery'>" ) );
+ $map = jQuery( "<map></map>" ).append( valueObj( "<area id='map01' shape='rect' coords='50,50,150,150' href='http://www.jquery.com/' alt='jQuery'>" ) );
assert.equal( $map[ 0 ].childNodes.length, 1, "The area was inserted." );
assert.equal( $map[ 0 ].firstChild.nodeName.toLowerCase(), "area", "The area was inserted." );
assert.ok( jQuery.parseHTML( "<" + name + "/>" ).length, name + " wrapped correctly" );
} );
- jQuery( "#table colgroup" ).append( valueObj( "<col/>" ) );
+ jQuery( "#table colgroup" ).append( valueObj( "<col></col>" ) );
assert.equal( jQuery( "#table colgroup col" ).length, 1, "Append col" );
jQuery( "#form" )
.append( valueObj( "<select id='appendSelect2'><option>Test</option></select>" ) );
assert.t( "Append Select", "#appendSelect1, #appendSelect2", [ "appendSelect1", "appendSelect2" ] );
- assert.equal( "Two nodes", jQuery( "<div />" ).append( "Two", " nodes" ).text(), "Appending two text nodes (#4011)" );
- assert.equal( jQuery( "<div />" ).append( "1", "", 3 ).text(), "13", "If median is false-like value, subsequent arguments should not be ignored" );
+ assert.equal( "Two nodes", jQuery( "<div></div>" ).append( "Two", " nodes" ).text(), "Appending two text nodes (#4011)" );
+ assert.equal( jQuery( "<div></div>" ).append( "1", "", 3 ).text(), "13", "If median is false-like value, subsequent arguments should not be ignored" );
// using contents will get comments regular, text, and comment nodes
j = jQuery( "#nonnodes" ).contents();
- d = jQuery( "<div/>" ).appendTo( "#nonnodes" ).append( j );
+ d = jQuery( "<div></div>" ).appendTo( "#nonnodes" ).append( j );
assert.equal( jQuery( "#nonnodes" ).length, 1, "Check node,textnode,comment append moved leaving just the div" );
assert.equal( d.contents().length, 3, "Check node,textnode,comment append works" );
$radioChecked.trigger( "click" );
$radioUnchecked[ 0 ].checked = false;
- jQuery( "<div/>" ).insertBefore( $radioParent ).append( $radioParent );
+ jQuery( "<div></div>" ).insertBefore( $radioParent ).append( $radioParent );
assert.equal( $radioChecked[ 0 ].checked, true, "Reappending radios uphold which radio is checked" );
assert.equal( $radioUnchecked[ 0 ].checked, false, "Reappending radios uphold not being checked" );
- assert.equal( jQuery( "<div/>" ).append( valueObj( "option<area/>" ) )[ 0 ].childNodes.length, 2, "HTML-string with leading text should be processed correctly" );
+ assert.equal( jQuery( "<div></div>" ).append( valueObj( "option<area></area>" ) )[ 0 ].childNodes.length, 2, "HTML-string with leading text should be processed correctly" );
}
QUnit.test( "append(String|Element|Array<Element>|jQuery)", function( assert ) {
jQuery( "#select1" ).appendTo( "#foo" );
assert.t( "Append select", "#foo select", [ "select1" ] );
- div = jQuery( "<div/>" ).on( "click", function() {
+ div = jQuery( "<div></div>" ).on( "click", function() {
assert.ok( true, "Running a cloned click." );
} );
div.appendTo( "#qunit-fixture, #moretests" );
jQuery( "#qunit-fixture div" ).last().trigger( "click" );
jQuery( "#moretests div" ).last().trigger( "click" );
- div = jQuery( "<div/>" ).appendTo( "#qunit-fixture, #moretests" );
+ div = jQuery( "<div></div>" ).appendTo( "#qunit-fixture, #moretests" );
assert.equal( div.length, 2, "appendTo returns the inserted elements" );
assert.ok( jQuery( "#qunit-fixture div" ).last().hasClass( "test" ), "appendTo element was modified after the insertion" );
assert.ok( jQuery( "#moretests div" ).last().hasClass( "test" ), "appendTo element was modified after the insertion" );
- div = jQuery( "<div/>" );
+ div = jQuery( "<div></div>" );
jQuery( "<span>a</span><b>b</b>" ).filter( "span" ).appendTo( div );
assert.equal( div.children().length, 1, "Make sure the right number of children were inserted." );
assert.expect( 2 );
var set;
- set = jQuery( "<div/>" ).before( "<span>test</span>" );
+ set = jQuery( "<div></div>" ).before( "<span>test</span>" );
assert.equal( set[ 0 ].nodeName.toLowerCase(), "div", "Insert before a disconnected node should be a no-op" );
assert.equal( set.length, 1, "Insert the element before the disconnected node. should be a no-op" );
} );
assert.expect( 2 );
- assert.equal( jQuery( "<input type='checkbox'/>" ).before( "<div/>" ).length, 1, "before() on disconnected node is no-op" );
- assert.equal( jQuery( "<input type='checkbox'/>" ).after( "<div/>" ).length, 1, "after() on disconnected node is no-op" );
+ assert.equal( jQuery( "<input type='checkbox'/>" ).before( "<div></div>" ).length, 1, "before() on disconnected node is no-op" );
+ assert.equal( jQuery( "<input type='checkbox'/>" ).after( "<div></div>" ).length, 1, "after() on disconnected node is no-op" );
} );
QUnit.test( "insert with .before() on disconnected node last", function( assert ) {
var expectedBefore = "This is a normal link: bugaYahoo";
- jQuery( "#yahoo" ).add( "<span/>" ).before( "<b>buga</b>" );
+ jQuery( "#yahoo" ).add( "<span></span>" ).before( "<b>buga</b>" );
assert.equal( jQuery( "#en" ).text(), expectedBefore, "Insert String before with disconnected node last" );
} );
var expectedBefore = "This is a normal link: bugaYahoo";
- jQuery( "<span/>" ).add( "#yahoo" ).before( "<b>buga</b>" );
+ jQuery( "<span></span>" ).add( "#yahoo" ).before( "<b>buga</b>" );
assert.equal( jQuery( "#en" ).text(), expectedBefore, "Insert String before with disconnected node first" );
} );
var expectedAfter = "This is a normal link: Yahoobuga";
- jQuery( "#yahoo" ).add( "<span/>" ).after( "<b>buga</b>" );
+ jQuery( "#yahoo" ).add( "<span></span>" ).after( "<b>buga</b>" );
assert.equal( jQuery( "#en" ).text(), expectedAfter, "Insert String after with disconnected node last" );
} );
var expectedAfter = "This is a normal link: Yahoobuga";
- jQuery( "<span/>" ).add( "#yahoo" ).after( "<b>buga</b>" );
+ jQuery( "<span></span>" ).add( "#yahoo" ).after( "<b>buga</b>" );
assert.equal( jQuery( "#en" ).text(), expectedAfter, "Insert String after with disconnected node first" );
} );
assert.expect( 2 );
- var set = jQuery( "<div/>" ).before( "<span>test</span>" );
+ var set = jQuery( "<div></div>" ).before( "<span>test</span>" );
assert.equal( set[ 0 ].nodeName.toLowerCase(), "div", "Insert after a disconnected node should be a no-op" );
assert.equal( set.length, 1, "Insert the element after the disconnected node should be a no-op" );
} );
jQuery( "#anchor1" ).contents().replaceWith( val( tmp ) );
assert.deepEqual( jQuery( "#anchor1" ).contents().get(), [ tmp ], "Replace text node with element" );
- tmp = jQuery( "<div/>" ).appendTo( "#qunit-fixture" ).on( "click", function() {
+ tmp = jQuery( "<div></div>" ).appendTo( "#qunit-fixture" ).on( "click", function() {
assert.ok( true, "Newly bound click run." );
} );
- y = jQuery( "<div/>" ).appendTo( "#qunit-fixture" ).on( "click", function() {
+ y = jQuery( "<div></div>" ).appendTo( "#qunit-fixture" ).on( "click", function() {
assert.ok( false, "Previously bound click run." );
} );
child = y.append( "<b>test</b>" ).find( "b" ).on( "click", function() {
y.trigger( "click" ); // Shouldn't be run
child.trigger( "click" ); // Shouldn't be run
- y = jQuery( "<div/>" ).appendTo( "#qunit-fixture" ).on( "click", function() {
+ y = jQuery( "<div></div>" ).appendTo( "#qunit-fixture" ).on( "click", function() {
assert.ok( false, "Previously bound click run." );
} );
child2 = y.append( "<u>test</u>" ).find( "u" ).on( "click", function() {
child2.trigger( "click" );
- set = jQuery( "<div/>" ).replaceWith( val( "<span>test</span>" ) );
+ set = jQuery( "<div></div>" ).replaceWith( val( "<span>test</span>" ) );
assert.equal( set[ 0 ].nodeName.toLowerCase(), "div", "No effect on a disconnected node." );
assert.equal( set.length, 1, "No effect on a disconnected node." );
assert.equal( set[ 0 ].childNodes.length, 0, "No effect on a disconnected node." );
child = jQuery( "#qunit-fixture" ).children().first();
- $div = jQuery( "<div class='pathological'/>" ).insertBefore( child );
+ $div = jQuery( "<div class='pathological'></div>" ).insertBefore( child );
$div.replaceWith( $div );
assert.deepEqual( jQuery( ".pathological", "#qunit-fixture" ).get(), $div.get(),
"Self-replacement" );
assert.expect( 25 );
- var $el = jQuery( "<div/><div/>" ).html( "<p>0</p>" ),
+ var $el = jQuery( "<div></div><div></div>" ).html( "<p>0</p>" ),
expectedHTML = $el.html(),
tests = {
"empty string": "",
};
jQuery.each( tests, function( label, input ) {
- $el.html( "<a/>" ).children().replaceWith( input );
+ $el.html( "<a></a>" ).children().replaceWith( input );
assert.strictEqual( $el.html(), "", "replaceWith(" + label + ")" );
- $el.html( "<b/>" ).children().replaceWith( function() { return input; } );
+ $el.html( "<b></b>" ).children().replaceWith( function() { return input; } );
assert.strictEqual( $el.html(), "", "replaceWith(function returning " + label + ")" );
- $el.html( "<i/>" ).children().replaceWith( function( i ) { return input; } );
+ $el.html( "<i></i>" ).children().replaceWith( function( i ) { return input; } );
assert.strictEqual( $el.html(), "", "replaceWith(other function returning " + label + ")" );
- $el.html( "<p/>" ).children().replaceWith( function( i ) {
+ $el.html( "<p></p>" ).children().replaceWith( function( i ) {
return i ?
input :
jQuery( this ).html( i + "" );
div.remove();
// Verify that cloned children can keep event listeners
- div = jQuery( "<div/>" ).append( [ document.createElement( "table" ), document.createElement( "table" ) ] );
+ div = jQuery( "<div></div>" ).append( [ document.createElement( "table" ), document.createElement( "table" ) ] );
div.find( "table" ).on( "click", function() {
assert.ok( true, "Bound event still exists." );
} );
div.remove();
// Test both html() and clone() for <embed> and <object> types
- div = jQuery( "<div/>" ).html( "<embed height='355' width='425' src='http://www.youtube.com/v/3KANI2dpXLw&hl=en'></embed>" );
+ div = jQuery( "<div></div>" ).html( "<embed height='355' width='425' src='http://www.youtube.com/v/3KANI2dpXLw&hl=en'></embed>" );
clone = div.clone( true );
assert.equal( clone.length, 1, "One element cloned" );
// this is technically an invalid object, but because of the special
// classid instantiation it is the only kind that IE has trouble with,
// so let's test with it too.
- div = jQuery( "<div/>" ).html( "<object height='355' width='425' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'> <param name='movie' value='http://www.youtube.com/v/3KANI2dpXLw&hl=en'> <param name='wmode' value='transparent'> </object>" );
+ div = jQuery( "<div></div>" ).html( "<object height='355' width='425' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'> <param name='movie' value='http://www.youtube.com/v/3KANI2dpXLw&hl=en'> <param name='wmode' value='transparent'> </object>" );
clone = div.clone( true );
assert.equal( clone.length, 1, "One element cloned" );
} )();
// and here's a valid one.
- div = jQuery( "<div/>" ).html( "<object height='355' width='425' type='application/x-shockwave-flash' data='http://www.youtube.com/v/3KANI2dpXLw&hl=en'> <param name='movie' value='http://www.youtube.com/v/3KANI2dpXLw&hl=en'> <param name='wmode' value='transparent'> </object>" );
+ div = jQuery( "<div></div>" ).html( "<object height='355' width='425' type='application/x-shockwave-flash' data='http://www.youtube.com/v/3KANI2dpXLw&hl=en'> <param name='movie' value='http://www.youtube.com/v/3KANI2dpXLw&hl=en'> <param name='wmode' value='transparent'> </object>" );
clone = div.clone( true );
assert.equal( clone.length, 1, "One element cloned" );
assert.equal( clone.html(), div.html(), "Element contents cloned" );
assert.equal( clone[ 0 ].nodeName.toUpperCase(), "DIV", "DIV element cloned" );
- div = jQuery( "<div/>" ).data( { "a": true } );
+ div = jQuery( "<div></div>" ).data( { "a": true } );
clone = div.clone( true );
assert.equal( clone.data( "a" ), true, "Data cloned." );
clone.data( "a", false );
div = jQuery( "<div></div>" ),
fixture = jQuery( "#qunit-fixture" );
- div.html( valueObj( "<div id='parent_1'><div id='child_1'/></div><div id='parent_2'/>" ) );
+ div.html( valueObj( "<div id='parent_1'><div id='child_1'></div></div><div id='parent_2'></div>" ) );
assert.equal( div.children().length, 2, "Found children" );
assert.equal( div.children().children().length, 1, "Found grandchild" );
actual = []; expected = [];
- tmp = jQuery( "<map/>" ).html( valueObj( "<area alt='area'/>" ) ).each( function() {
+ tmp = jQuery( "<map></map>" ).html( valueObj( "<area alt='area'></area>" ) ).each( function() {
expected.push( "AREA" );
actual.push( childNodeNames( this ) );
} );
assert.equal( expected.length, 1, "Expecting one parent" );
assert.deepEqual( actual, expected, "Found the inserted style element" );
- fixture.html( valueObj( "<select/>" ) );
+ fixture.html( valueObj( "<select></select>" ) );
jQuery( "#qunit-fixture select" ).html( valueObj( "<option>O1</option><option selected='selected'>O2</option><option>O3</option>" ) );
assert.equal( jQuery( "#qunit-fixture select" ).val(), "O2", "Selected option correct" );
assert.equal( j.html().replace( / xmlns="[^"]+"/g, "" ).toLowerCase(), "<b>bold</b>", "Check node,textnode,comment with html()" );
- $div = jQuery( "<div />" );
+ $div = jQuery( "<div></div>" );
assert.equal( $div.html( function( i, val ) {
assert.equal( val, "", "Make sure the incoming value is correct." );
return 0;
} ).html(), "0", "Setting a zero as html" );
- $div2 = jQuery( "<div/>" );
+ $div2 = jQuery( "<div></div>" );
insert = "<div>hello1</div>";
assert.equal( $div2.html( function( i, val ) {
assert.equal( val, "", "Make sure the incoming value is correct." );
QUnit.test( "jQuery.cleanData eliminates all private data (gh-2127)", function( assert ) {
assert.expect( 3 );
- var div = jQuery( "<div/>" ).appendTo( "#qunit-fixture" );
+ var div = jQuery( "<div></div>" ).appendTo( "#qunit-fixture" );
jQuery._data( div[ 0 ], "gh-2127", "testing" );
assert.expect( 3 );
var key,
- div = jQuery( "<div/>" );
+ div = jQuery( "<div></div>" );
div.data( "some", "data" );
assert.ok( !jQuery.isEmptyObject( jQuery.data( div[ 0 ] ) ), "Ensure some public data exists" );
// DOM manipulation fails if added text matches an Object method
var i,
- $f = jQuery( "<div />" ).appendTo( "#qunit-fixture" ),
+ $f = jQuery( "<div></div>" ).appendTo( "#qunit-fixture" ),
bad = [ "start-", "toString", "hasOwnProperty", "append", "here&there!", "-end" ];
for ( i = 0; i < bad.length; i++ ) {
var div;
try {
- div = jQuery( "<div/><hr/><code/><b/>" );
+ div = jQuery( "<div></div><hr/><code></code><b></b>" );
} catch ( e ) {}
assert.ok( div && div.jquery, "Created nodes safely, guarded against exceptions on safeChildNodes[ -1 ]" );
assert.expect( 5 );
- assert.strictEqual( jQuery( "<div/>" ).clone().addClass( "test" ).appendTo( "<div/>" ).end().end().hasClass( "test" ), false, "Check jQuery.fn.appendTo after jQuery.clone" );
- assert.strictEqual( jQuery( "<div/>" ).find( "p" ).end().addClass( "test" ).appendTo( "<div/>" ).end().end().hasClass( "test" ), false, "Check jQuery.fn.appendTo after jQuery.fn.find" );
- assert.strictEqual( jQuery( "<div/>" ).text( "test" ).addClass( "test" ).appendTo( "<div/>" ).end().end().hasClass( "test" ), false, "Check jQuery.fn.appendTo after jQuery.fn.text" );
- assert.strictEqual( jQuery( "<bdi/>" ).clone().addClass( "test" ).appendTo( "<div/>" ).end().end().hasClass( "test" ), false, "Check jQuery.fn.appendTo after clone html5 element" );
- assert.strictEqual( jQuery( "<p/>" ).appendTo( "<div/>" ).end().length, jQuery( "<p>test</p>" ).appendTo( "<div/>" ).end().length, "Elements created with createElement and with createDocumentFragment should be treated alike" );
+ assert.strictEqual( jQuery( "<div></div>" ).clone().addClass( "test" ).appendTo( "<div></div>" ).end().end().hasClass( "test" ), false, "Check jQuery.fn.appendTo after jQuery.clone" );
+ assert.strictEqual( jQuery( "<div></div>" ).find( "p" ).end().addClass( "test" ).appendTo( "<div></div>" ).end().end().hasClass( "test" ), false, "Check jQuery.fn.appendTo after jQuery.fn.find" );
+ assert.strictEqual( jQuery( "<div></div>" ).text( "test" ).addClass( "test" ).appendTo( "<div></div>" ).end().end().hasClass( "test" ), false, "Check jQuery.fn.appendTo after jQuery.fn.text" );
+ assert.strictEqual( jQuery( "<bdi></bdi>" ).clone().addClass( "test" ).appendTo( "<div></div>" ).end().end().hasClass( "test" ), false, "Check jQuery.fn.appendTo after clone html5 element" );
+ assert.strictEqual( jQuery( "<p></p>" ).appendTo( "<div></div>" ).end().length, jQuery( "<p>test</p>" ).appendTo( "<div></div>" ).end().length, "Elements created with createElement and with createDocumentFragment should be treated alike" );
} );
QUnit.test( "html() - script exceptions bubble (#11743)", function( assert ) {
"<script>QUnit.assert.ok( true, 'evaluated: inner no type' );</script>",
"</div>"
].join( "" ) );
- scriptsIn.appendTo( jQuery( "<div class='detached'/>" ) );
+ scriptsIn.appendTo( jQuery( "<div class='detached'></div>" ) );
objGlobal.ok = isOk;
scriptsOut = fixture.append( scriptsIn ).find( "script" );
if ( jQuery.ajax ) {
Globals.register( "testBar" );
- jQuery( "#qunit-fixture" ).append( "<script src='" + url( "mock.php?action=testbar" ) + "'/>" );
+ jQuery( "#qunit-fixture" ).append( "<script src='" + url( "mock.php?action=testbar" ) + "'></script>" );
assert.strictEqual( window.testBar, "bar", "Global script evaluation" );
} else {
assert.ok( true, "No jQuery.ajax" );
assert.equal( ( input.url || input ).slice( -1 ), expectedArgument, message );
expectedArgument++;
};
- jQuery( "#qunit-fixture" ).append( "<script src='1'/><script src='2'/>" );
+ jQuery( "#qunit-fixture" ).append( "<script src='1'></script><script src='2'></script>" );
assert.equal( expectedArgument, 3, "synchronous execution" );
message = "custom implementation";
jQuery.ajax = function( options ) {
assert.strictEqual( options, {}, "Unexpected call to jQuery.ajax" );
};
- jQuery( "#qunit-fixture" ).append( "<script src='3'/><script src='4'/>" );
+ jQuery( "#qunit-fixture" ).append( "<script src='3'></script><script src='4'></script>" );
jQuery.ajax = ajax;
jQuery._evalUrl = evalUrl;
invocations = 0,
done = assert.async(),
htmlPrefilter = jQuery.htmlPrefilter,
- fixture = jQuery( "<div/>" ).appendTo( "#qunit-fixture" ),
+ fixture = jQuery( "<div></div>" ).appendTo( "#qunit-fixture" ),
poison = "<script>jQuery.htmlPrefilter.assert.ok( false, 'script not executed' );</script>";
jQuery.htmlPrefilter = function( html ) {
expectedArgument = "A-" + poison + "B-" + poison + poison + "C-";
fixture.html( expectedArgument );
- expectedArgument = "D-" + poison + "E-" + "<del/><div>" + poison + poison + "</div>" + "F-";
+ expectedArgument = "D-" + poison + "E-" + "<del></del><div>" + poison + poison + "</div>" + "F-";
fixture.append( expectedArgument );
expectedArgument = poison;
var i = 0;
- jQuery( "<div/><div/>" ).before( function( index ) {
+ jQuery( "<div></div><div></div>" ).before( function( index ) {
assert.equal( index, i++, "Index should be correct" );
} );
thead: "<tr><td>thead</td></tr>",
tbody: "<tr><td>tbody</td></tr>",
tfoot: "<tr><td>tfoot</td></tr>",
- colgroup: "<col span='5' />",
+ colgroup: "<col span='5'></col>",
caption: "caption",
tr: "<td>tr</td>",
th: "th",
args.push( html );
} );
- jQuery.fn.append.apply( jQuery( "<div/>" ), args ).children().each( function( i ) {
+ jQuery.fn.append.apply( jQuery( "<div></div>" ), args ).children().each( function( i ) {
assert.ok( this.nodeName.toLowerCase() === results[ i ] );
} );
} );
QUnit.test( "Validate creation of multiple quantities of certain elements (#13818)", function( assert ) {
- assert.expect( 44 );
+ assert.expect( 22 );
var tags = [ "thead", "tbody", "tfoot", "colgroup", "col", "caption", "tr", "th", "td", "optgroup", "option" ];
jQuery.each( tags, function( index, tag ) {
- jQuery( "<" + tag + "/><" + tag + "/>" ).each( function() {
- assert.ok( this.nodeName.toLowerCase() === tag, tag + " empty elements created correctly" );
- } );
-
- jQuery( "<" + this + "></" + tag + "><" + tag + "></" + tag + ">" ).each( function() {
- assert.ok( this.nodeName.toLowerCase() === tag, tag + " elements with closing tag created correctly" );
+ jQuery( "<" + tag + "></" + tag + "><" + tag + "></" + tag + ">" ).each( function() {
+ assert.ok( this.nodeName.toLowerCase() === tag, tag + " elements created correctly" );
} );
} );
} );
table.appendChild( document.createElement( "tbody" ) );
document.getElementById( "qunit-fixture" ).appendChild( table );
- jQuery( table ).append( "<tfoot/>" );
+ jQuery( table ).append( "<tfoot></tfoot>" );
// Lowercase and replace spaces to remove possible browser inconsistencies
html = table.innerHTML.toLowerCase().replace( /\s/g, "" );
jQuery( table ).appendTo( "#qunit-fixture" );
- jQuery( "<col width='150'/>" ).prependTo( table );
+ jQuery( "<col width='150'></col>" ).prependTo( table );
assert.strictEqual( table.find( "td" ).width(), 150 );
} );
"</td></tr></thead>",
newRow = "<tr><td>added</td></tr>",
htmlExpected = htmlIn.replace( "</thead>", "</thead>" + newRow ),
- table = supportjQuery( "<table/>" ).html( htmlIn ).appendTo( "#qunit-fixture" )[ 0 ];
+ table = supportjQuery( "<table></table>" ).html( htmlIn ).appendTo( "#qunit-fixture" )[ 0 ];
jQuery( table ).append( newRow );
var htmlOut,
htmlIn = "<p>foo<!--<td>--></p>",
- $el = jQuery( "<div/>" );
+ $el = jQuery( "<div></div>" );
$el.html( htmlIn );
try {
jQuery( "#qunit-fixture" ).append(
- "<script src='" + url( "mock.php?action=error" ) + "'/>" );
+ "<script src='" + url( "mock.php?action=error" ) + "'></script>" );
assert.ok( true, "no error thrown from embedding script with unsuccessful-response src" );
} catch ( e ) {
throw e;
}
var supportsFixedPosition, supportsScroll, alwaysScrollable,
- forceScroll = supportjQuery( "<div/>" ).css( { width: 2000, height: 2000 } ),
+ forceScroll = supportjQuery( "<div></div>" ).css( { width: 2000, height: 2000 } ),
checkSupport = function( assert ) {
// Only run once
QUnit.test( "hidden (display: none) element", function( assert ) {
assert.expect( 4 );
- var node = jQuery( "<div style='display: none' />" ).appendTo( "#qunit-fixture" ),
+ var node = jQuery( "<div style='display: none'></div>" ).appendTo( "#qunit-fixture" ),
result = node.offset();
node.remove();
QUnit.test( "0 sized element", function( assert ) {
assert.expect( 4 );
- var node = jQuery( "<div style='margin: 5px; width: 0; height: 0' />" ).appendTo( "#qunit-fixture" ),
+ var node = jQuery( "<div style='margin: 5px; width: 0; height: 0'></div>" ).appendTo( "#qunit-fixture" ),
result = node.offset();
node.remove();
QUnit.test( "hidden (visibility: hidden) element", function( assert ) {
assert.expect( 4 );
- var node = jQuery( "<div style='margin: 5px; visibility: hidden' />" ).appendTo( "#qunit-fixture" ),
+ var node = jQuery( "<div style='margin: 5px; visibility: hidden'></div>" ).appendTo( "#qunit-fixture" ),
result = node.offset();
node.remove();
QUnit.test( "fractions (see #7730 and #7885)", function( assert ) {
assert.expect( 2 );
- jQuery( "body" ).append( "<div id='fractions'/>" );
+ jQuery( "body" ).append( "<div id='fractions'></div>" );
var result,
expected = { "top": 1000, "left": 1000 },
QUnit.test( "selectors with comma", function( assert ) {
assert.expect( 4 );
- var fixture = jQuery( "<div><h2><span/></h2><div><p><span/></p><p/></div></div>" );
+ var fixture = jQuery( "<div><h2><span></span></h2><div><p><span></span></p><p></p></div></div>" );
assert.equal( fixture.find( "h2, div p" ).filter( "p" ).length, 2, "has to find two <p>" );
assert.equal( fixture.find( "h2, div p" ).filter( "h2" ).length, 1, "has to find one <h2>" );
QUnit.test( "disconnected nodes", function( assert ) {
assert.expect( 1 );
- var $div = jQuery( "<div/>" );
+ var $div = jQuery( "<div></div>" );
assert.equal( $div.is( "div" ), true, "Make sure .is('nodeName') works on disconnected nodes." );
} );
assert.equal( jQuery( "#text2" ).index(), 2, "Returns the index of a child amongst its siblings" );
- assert.equal( jQuery( "<div/>" ).index(), -1, "Node without parent returns -1" );
+ assert.equal( jQuery( "<div></div>" ).index(), -1, "Node without parent returns -1" );
} );
QUnit.test( "index(Object|String|undefined)", function( assert ) {
obj = jQuery( "#qunit-fixture" ).has( jQuery( "#sndp" )[ 0 ] );
assert.deepEqual( obj.get(), q( "qunit-fixture" ), "Keeps elements that have the element as a descendant" );
- detached = jQuery( "<a><b><i/></b></a>" );
+ detached = jQuery( "<a><b><i></i></b></a>" );
assert.deepEqual( detached.has( detached.find( "i" )[ 0 ] ).get(), detached.get(), "...Even when detached" );
multipleParent = jQuery( "#qunit-fixture, #header" ).has( jQuery( "#sndp" )[ 0 ] );
obj = jQuery( "#qunit-fixture" ).has( "#sndp" );
assert.deepEqual( obj.get(), q( "qunit-fixture" ), "Keeps elements that have any element matching the selector as a descendant" );
- detached = jQuery( "<a><b><i/></b></a>" );
+ detached = jQuery( "<a><b><i></i></b></a>" );
assert.deepEqual( detached.has( "i" ).get(), detached.get(), "...Even when detached" );
multipleParent = jQuery( "#qunit-fixture, #header" ).has( "#sndp" );
simple = jQuery( "#qunit-fixture" ).has( jQuery( "#sndp" ) );
assert.deepEqual( simple.get(), q( "qunit-fixture" ), "Keeps elements that have any element in the jQuery list as a descendant" );
- detached = jQuery( "<a><b><i/></b></a>" );
+ detached = jQuery( "<a><b><i></i></b></a>" );
assert.deepEqual( detached.has( detached.find( "i" ) ).get(), detached.get(), "...Even when detached" );
multipleParent = jQuery( "#qunit-fixture, #header" ).has( jQuery( "#sndp" ) );
var set = q( "sndp", "en", "sap" );
assert.deepEqual( jQuery( "#en, #sndp" ).siblings().get(), set, "Check for unique results from siblings" );
assert.deepEqual( jQuery( "#option5a" ).siblings( "option[data-attr]" ).get(), q( "option5c" ), "Has attribute selector in siblings (#9261)" );
- assert.equal( jQuery( "<a/>" ).siblings().length, 0, "Detached elements have no siblings (#11370)" );
+ assert.equal( jQuery( "<a></a>" ).siblings().length, 0, "Detached elements have no siblings (#11370)" );
} );
QUnit[ jQuery.find.compile ? "test" : "skip" ]( "siblings([String])", function( assert ) {
assert.equal( jQuery( "div", ibody ).text(), "span text", "Make sure the correct div is still left after deletion in IFrame" );
- jQuery( "<table/>", ibody ).append( "<tr><td>cell</td></tr>" ).appendTo( ibody );
+ jQuery( "<table></table>", ibody ).append( "<tr><td>cell</td></tr>" ).appendTo( ibody );
jQuery( "table", ibody ).remove();
assert.equal( jQuery( "div", ibody ).length, 1, "Check for JS error on add and delete of a table in IFrame" );
assert.equal( contents.find( "span" ).text(), "Hello, Web Component!", "Find span in template and check its text" );
- jQuery( "<div id='templateTest' />" ).append(
+ jQuery( "<div id='templateTest'></div>" ).append(
jQuery( jQuery.map( contents, function( node ) {
return document.importNode( node, true );
} ) )
"Check elements from document"
);
- divs = jQuery( "<div/>" ).add( "#sndp" );
+ divs = jQuery( "<div></div>" ).add( "#sndp" );
assert.ok( divs[ 0 ].parentNode, "Sort with the disconnected node last (started with disconnected first)." );
} );
assert.expect( 3 );
var x,
- divs = jQuery( "#sndp" ).add( "<div/>" );
+ divs = jQuery( "#sndp" ).add( "<div></div>" );
assert.ok( !divs[ 1 ].parentNode, "Sort with the disconnected node last." );
assert.expect( 4 );
var x,
- tmp = jQuery( "<div/>" );
+ tmp = jQuery( "<div></div>" );
x = jQuery( [] )
.add(
assert.expect( 2 );
var x,
- tmp = jQuery( "<div/>" );
+ tmp = jQuery( "<div></div>" );
x = jQuery( [] ).add( jQuery( "<p id='x1'>xxx</p>" ).appendTo( tmp )[ 0 ] ).add( jQuery( "<p id='x2'>xxx</p>" ).appendTo( tmp )[ 0 ] );
assert.equal( x[ 0 ].id, "x1", "Check on-the-fly element1" );
cacheLength++;
}
- j = jQuery( "<label/>" ).wrap( val( "<li/>" ) );
+ j = jQuery( "<label></label>" ).wrap( val( "<li></li>" ) );
assert.equal(
j[ 0 ] .nodeName.toUpperCase(), "LABEL", "Element is a label"
);
);
// Wrap an element containing a text node
- j = jQuery( "<span/>" ).wrap( "<div>test</div>" );
+ j = jQuery( "<span></span>" ).wrap( "<div>test</div>" );
assert.equal(
j[ 0 ].previousSibling.nodeType, 3, "Make sure the previous node is a text element"
);
);
// Wrap an element with a jQuery set
- j = jQuery( "<span/>" ).wrap( jQuery( "<div></div>" ) );
+ j = jQuery( "<span></span>" ).wrap( jQuery( "<div></div>" ) );
assert.equal(
j[ 0 ].parentNode.nodeName.toLowerCase(), "div", "Wrapping works."
);
jQuery( this ).off();
} );
- j = jQuery( "<span/>" ).wrap( result );
+ j = jQuery( "<span></span>" ).wrap( result );
assert.equal(
j[ 0 ].parentNode.nodeName.toLowerCase(), "div", "Wrapping works."
);
assert.expect( 5 );
var num,
- div = jQuery( "<div/>" );
+ div = jQuery( "<div></div>" );
num = jQuery( "#first" ).children().length;
jQuery( "#first" ).wrapInner( document.getElementById( "empty" ) );
var num,
val = manipulationFunctionReturningObj,
- div = jQuery( "<div/>" );
+ div = jQuery( "<div></div>" );
num = jQuery( "#first" ).children().length;
jQuery( "#first" ).wrapInner( val( document.getElementById( "empty" ) ) );