@@ -57,7 +57,7 @@ function testWidth( val ) {

equal( jQuery(window).width(), document.documentElement.clientWidth, "Window width is equal to width reported by window/document." );

QUnit.expectJqData( $div[0], "olddisplay" );
QUnit.expectJqData( this, $div[0], "olddisplay" );
}

test("width()", function() {
@@ -110,7 +110,7 @@ function testHeight( val ) {

equal( jQuery(window).height(), document.documentElement.clientHeight, "Window width is equal to width reported by window/document." );

QUnit.expectJqData( $div[0], "olddisplay" );
QUnit.expectJqData( this, $div[0], "olddisplay" );
}

test("height()", function() {
@@ -134,28 +134,27 @@ test("height(Function(args))", function() {
});

test("innerWidth()", function() {
expect(6);
expect( 6 );

var $div, div,
winWidth = jQuery( window ).width(),
docWidth = jQuery( document ).width();
$win = jQuery( window ),
$doc = jQuery( document );

equal(jQuery(window).innerWidth(), winWidth, "Test on window");
equal(jQuery(document).innerWidth(), docWidth, "Test on document");
equal( jQuery( window ).innerWidth(), $win.width(), "Test on window" );
equal( jQuery( document ).innerWidth(), $doc.width(), "Test on document" );

$div = jQuery("#nothiddendiv");
// set styles
$div = jQuery( "#nothiddendiv" );
$div.css({
"margin": 10,
"border": "2px solid #fff",
"width": 30
});

equal($div.innerWidth(), 30, "Test with margin and border");
$div.css("padding", "20px");
equal($div.innerWidth(), 70, "Test with margin, border and padding");
equal( $div.innerWidth(), 30, "Test with margin and border" );
$div.css( "padding", "20px" );
equal( $div.innerWidth(), 70, "Test with margin, border and padding" );
$div.hide();
equal($div.innerWidth(), 70, "Test hidden div");
equal( $div.innerWidth(), 70, "Test hidden div" );

// reset styles
$div.css({ "display": "", "border": "", "padding": "", "width": "", "height": "" });
@@ -166,32 +165,31 @@ test("innerWidth()", function() {
equal( div.innerWidth(), 0, "Make sure that disconnected nodes are handled." );

div.remove();
QUnit.expectJqData( $div[0], "olddisplay" );
QUnit.expectJqData( this, $div[ 0 ], "olddisplay" );
});

test("innerHeight()", function() {
expect(6);
expect( 6 );

var $div, div,
winHeight = jQuery( window ).height(),
docHeight = jQuery( document ).height();
$win = jQuery( window ),
$doc = jQuery( document );

equal(jQuery(window).innerHeight(), winHeight, "Test on window");
equal(jQuery(document).innerHeight(), docHeight, "Test on document");
equal( jQuery( window ).innerHeight(), $win.height(), "Test on window" );
equal( jQuery( document ).innerHeight(), $doc.height(), "Test on document" );

$div = jQuery("#nothiddendiv");
// set styles
$div = jQuery( "#nothiddendiv" );
$div.css({
"margin": 10,
"border": "2px solid #fff",
"height": 30
});

equal($div.innerHeight(), 30, "Test with margin and border");
$div.css("padding", "20px");
equal($div.innerHeight(), 70, "Test with margin, border and padding");
equal( $div.innerHeight(), 30, "Test with margin and border" );
$div.css( "padding", "20px" );
equal( $div.innerHeight(), 70, "Test with margin, border and padding" );
$div.hide();
equal($div.innerHeight(), 70, "Test hidden div");
equal( $div.innerHeight(), 70, "Test hidden div" );

// reset styles
$div.css({ "display": "", "border": "", "padding": "", "width": "", "height": "" });
@@ -202,35 +200,35 @@ test("innerHeight()", function() {
equal( div.innerHeight(), 0, "Make sure that disconnected nodes are handled." );

div.remove();
QUnit.expectJqData( $div[0], "olddisplay" );
QUnit.expectJqData( this, $div[ 0 ], "olddisplay" );
});

test("outerWidth()", function() {
expect(11);
expect( 11 );

var $div, div,
winWidth = jQuery( window ).width(),
docWidth = jQuery( document ).width();

equal( jQuery( window ).outerWidth(), winWidth, "Test on window without margin option" );
equal( jQuery( window ).outerWidth( true ), winWidth, "Test on window with margin option" );
equal( jQuery( document ).outerWidth(), docWidth, "Test on document without margin option" );
equal( jQuery( document ).outerWidth( true ), docWidth, "Test on document with margin option" );

$div = jQuery("#nothiddendiv");
$div.css("width", 30);

equal($div.outerWidth(), 30, "Test with only width set");
$div.css("padding", "20px");
equal($div.outerWidth(), 70, "Test with padding");
$div.css("border", "2px solid #fff");
equal($div.outerWidth(), 74, "Test with padding and border");
$div.css("margin", "10px");
equal($div.outerWidth(), 74, "Test with padding, border and margin without margin option");
$div.css("position", "absolute");
equal($div.outerWidth(true), 94, "Test with padding, border and margin with margin option");
$win = jQuery( window ),
$doc = jQuery( document );

equal( jQuery( window ).outerWidth(), $win.width(), "Test on window without margin option" );
equal( jQuery( window ).outerWidth( true ), $win.width(), "Test on window with margin option" );
equal( jQuery( document ).outerWidth(), $doc.width(), "Test on document without margin option" );
equal( jQuery( document ).outerWidth( true ), $doc.width(), "Test on document with margin option" );

$div = jQuery( "#nothiddendiv" );
$div.css( "width", 30 );

equal( $div.outerWidth(), 30, "Test with only width set" );
$div.css( "padding", "20px" );
equal( $div.outerWidth(), 70, "Test with padding" );
$div.css( "border", "2px solid #fff" );
equal( $div.outerWidth(), 74, "Test with padding and border" );
$div.css( "margin", "10px" );
equal( $div.outerWidth(), 74, "Test with padding, border and margin without margin option" );
$div.css( "position", "absolute" );
equal( $div.outerWidth( true ), 94, "Test with padding, border and margin with margin option" );
$div.hide();
equal($div.outerWidth(true), 94, "Test hidden div with padding, border and margin with margin option");
equal( $div.outerWidth( true ), 94, "Test hidden div with padding, border and margin with margin option" );

// reset styles
$div.css({ "position": "", "display": "", "border": "", "padding": "", "width": "", "height": "" });
@@ -241,7 +239,7 @@ test("outerWidth()", function() {
equal( div.outerWidth(), 0, "Make sure that disconnected nodes are handled." );

div.remove();
QUnit.expectJqData( $div[0], "olddisplay" );
QUnit.expectJqData( this, $div[ 0 ], "olddisplay" );
});

test("child of a hidden elem (or unconnected node) has accurate inner/outer/Width()/Height() see #9441 #9300", function() {
@@ -353,31 +351,30 @@ test("box-sizing:border-box child of a hidden elem (or unconnected node) has acc
});

test("outerHeight()", function() {
expect(11);
expect( 11 );

var $div, div,
winHeight = jQuery( window ).height(),
docHeight = jQuery( document ).height();


equal( jQuery( window ).outerHeight(), winHeight, "Test on window without margin option" );
equal( jQuery( window ).outerHeight( true ), winHeight, "Test on window with margin option" );
equal( jQuery( document ).outerHeight(), docHeight, "Test on document without margin option" );
equal( jQuery( document ).outerHeight( true ), docHeight, "Test on document with margin option" );

$div = jQuery("#nothiddendiv");
$div.css("height", 30);

equal($div.outerHeight(), 30, "Test with only width set");
$div.css("padding", "20px");
equal($div.outerHeight(), 70, "Test with padding");
$div.css("border", "2px solid #fff");
equal($div.outerHeight(), 74, "Test with padding and border");
$div.css("margin", "10px");
equal($div.outerHeight(), 74, "Test with padding, border and margin without margin option");
equal($div.outerHeight(true), 94, "Test with padding, border and margin with margin option");
$win = jQuery( window ),
$doc = jQuery( document );

equal( jQuery( window ).outerHeight(), $win.height(), "Test on window without margin option" );
equal( jQuery( window ).outerHeight( true ), $win.height(), "Test on window with margin option" );
equal( jQuery( document ).outerHeight(), $doc.height(), "Test on document without margin option" );
equal( jQuery( document ).outerHeight( true ), $doc.height(), "Test on document with margin option" );

$div = jQuery( "#nothiddendiv" );
$div.css( "height", 30 );

equal( $div.outerHeight(), 30, "Test with only width set" );
$div.css( "padding", "20px" );
equal( $div.outerHeight(), 70, "Test with padding" );
$div.css( "border", "2px solid #fff" );
equal( $div.outerHeight(), 74, "Test with padding and border" );
$div.css( "margin", "10px" );
equal( $div.outerHeight(), 74, "Test with padding, border and margin without margin option" );
equal( $div.outerHeight( true ), 94, "Test with padding, border and margin with margin option" );
$div.hide();
equal($div.outerHeight(true), 94, "Test hidden div with padding, border and margin with margin option");
equal( $div.outerHeight( true ), 94, "Test hidden div with padding, border and margin with margin option" );

// reset styles
$div.css({ "display": "", "border": "", "padding": "", "width": "", "height": "" });
@@ -388,7 +385,7 @@ test("outerHeight()", function() {
equal( div.outerHeight(), 0, "Make sure that disconnected nodes are handled." );

div.remove();
QUnit.expectJqData( $div[0], "olddisplay" );
QUnit.expectJqData( this, $div[ 0 ], "olddisplay" );
});

test("passing undefined is a setter #5571", function() {
@@ -418,8 +415,8 @@ test( "getters on non elements should return null", function() {
test("setters with and without box-sizing:border-box", function(){
expect(20);

// Support: Firefox<29, Android 2.3 (Prefixed box-sizing versions).
var el_bb = jQuery("<div style='width:114px;height:114px;margin:5px;padding:3px;border:4px solid white;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;'>test</div>").appendTo("#qunit-fixture"),
// Support: Android 2.3 (-webkit-box-sizing).
var el_bb = jQuery("<div style='width:114px;height:114px;margin:5px;padding:3px;border:4px solid white;-webkit-box-sizing:border-box;box-sizing:border-box;'>test</div>").appendTo("#qunit-fixture"),
el = jQuery("<div style='width:100px;height:100px;margin:5px;padding:3px;border:4px solid white;'>test</div>").appendTo("#qunit-fixture"),
expected = 100;

@@ -455,4 +452,16 @@ testIframe( "dimensions/documentLarge", "window vs. large document", function( j
ok( jQuery( document ).width() > jQuery( window ).width(), "document width is larger than window width" );
});

test( "allow modification of coordinates argument (gh-1848)", 1, function() {
var element = jQuery( "<div/>" ).appendTo( "#qunit-fixture" );

element.offset(function( index, coords ) {
coords.top = 100;

return coords;
});

equal( element.offset().top, 100, "coordinates are modified" );
});

})();
@@ -45,7 +45,7 @@ test("show() basic", 2, function() {
// Clean up the detached node
div.remove();

QUnit.expectJqData(hiddendiv, "olddisplay");
QUnit.expectJqData( this, hiddendiv, "olddisplay" );
});

test("show()", 27, function () {
@@ -92,7 +92,7 @@ test("show()", 27, function () {
});

// Tolerate data from show()/hide()
QUnit.expectJqData(div, "olddisplay");
QUnit.expectJqData( this, div, "olddisplay" );

// #show-tests * is set display: none in CSS
jQuery("#qunit-fixture").append("<div id='show-tests'><div><p><a href='#'></a></p><code></code><pre></pre><span></span></div><table><thead><tr><th></th></tr></thead><tbody><tr><td></td></tr></tbody></table><ul><li></li></ul></div><table id='test-table'></table>");
@@ -200,7 +200,7 @@ test("Persist correct display value", function() {

clock.tick( 300 );

QUnit.expectJqData($span, "olddisplay");
QUnit.expectJqData( this, $span, "olddisplay" );
});

test("animate(Hash, Object, Function)", function() {
@@ -1077,7 +1077,8 @@ test("jQuery.show('fast') doesn't clear radio buttons (bug #1095)", function ()
test( "interrupt toggle", function() {
expect( 24 );

var longDuration = 2000,
var env = this,
longDuration = 2000,
shortDuration = 500,
remaining = 0,
$elems = jQuery(".chain-test"),
@@ -1094,7 +1095,7 @@ test( "interrupt toggle", function() {
jQuery.data( this, "startVal", jQuery( this ).css( prop ) );

// Expect olddisplay data from our .hide() call below
QUnit.expectJqData( this, "olddisplay" );
QUnit.expectJqData( env, this, "olddisplay" );
});

// Interrupt a hiding toggle
@@ -1499,7 +1500,8 @@ test( "User supplied callback called after show when fx off (#8892)", 2, functio
test( "animate should set display for disconnected nodes", function() {
expect( 18 );

var methods = {
var env = this,
methods = {
toggle: [ 1 ],
slideToggle: [],
fadeIn: [],
@@ -1520,9 +1522,9 @@ test( "animate should set display for disconnected nodes", function() {
strictEqual( $divNone.show()[ 0 ].style.display, "block", "show() should change display if it already set to none" );
strictEqual( $divInline.show()[ 0 ].style.display, "inline", "show() should not change display if it already set" );

QUnit.expectJqData( $divTest[ 0 ], "olddisplay" );
QUnit.expectJqData( $divEmpty[ 0 ], "olddisplay" );
QUnit.expectJqData( $divNone[ 0 ], "olddisplay" );
QUnit.expectJqData( env, $divTest[ 0 ], "olddisplay" );
QUnit.expectJqData( env, $divEmpty[ 0 ], "olddisplay" );
QUnit.expectJqData( env, $divNone[ 0 ], "olddisplay" );

jQuery.each( methods, function( name, opt ) {
jQuery.each([
@@ -1537,7 +1539,7 @@ test( "animate should set display for disconnected nodes", function() {
var callback = [function () {
strictEqual( this.style.display, "block", "set display to block with " + name );

QUnit.expectJqData( this, "olddisplay" );
QUnit.expectJqData( env, this, "olddisplay" );

}];
jQuery.fn[ name ].apply( this, opt.concat( callback ) );
@@ -583,6 +583,17 @@ test("namespace-only event binding is a no-op", function(){
.off("whoops");
});

test("Empty namespace is ignored", function(){
expect( 1 );

jQuery("#firstp")
.on( "meow.", function( e ) {
equal( e.namespace, "", "triggered a namespace-less meow event" );
})
.trigger("meow.")
.off("meow.");
});

test("on(), with same function", function() {
expect(2);

@@ -992,6 +1003,7 @@ test("trigger() bubbling", function() {
equal( win, 4, "doc bubble" );

// manually clean up events from elements outside the fixture
jQuery(window).off("click");
jQuery(document).off("click");
jQuery("html, body, #qunit-fixture").off("click");
});
@@ -1417,7 +1429,7 @@ test("Submit event can be stopped (#11049)", function() {
form.remove();
});

// Test beforeunload event only if it supported (i.e. not Opera)
// Test beforeunload event only if it supported.
// Support: iOS 7+, Android<4.0
// iOS & old Android have the window.onbeforeunload field but don't support the beforeunload
// handler making it impossible to feature-detect the support.
@@ -2036,7 +2048,7 @@ test("Non DOM element events", function() {
ok( true, "Event on non-DOM object triggered" );
});

jQuery(o).trigger("nonelementobj");
jQuery(o).trigger("nonelementobj").off("nonelementobj");
});

test("inline handler returning false stops default", function() {
@@ -2381,6 +2393,25 @@ test("hover event no longer special since 1.9", function() {
.off("hover");
});

test( "event object properties on natively-triggered event", function() {
expect( 3 );

var link = document.createElement( "a" ),
$link = jQuery( link ),
evt = document.createEvent( "MouseEvents" );

// IE9+ requires element to be in the body before it will dispatch
$link.appendTo( "body" ).on( "click", function( e ) {
// Not trying to assert specific values here, just ensure the property exists
equal( "detail" in e, true, "has .detail" );
equal( "cancelable" in e, true, "has .cancelable" );
equal( "bubbles" in e, true, "has .bubbles" );
});
evt.initEvent( "click", true, true );
link.dispatchEvent( evt );
$link.off( "click" ).remove();
});

test("fixHooks extensions", function() {
expect( 2 );

@@ -2413,6 +2444,27 @@ test("fixHooks extensions", function() {
jQuery.event.fixHooks.click = saved;
});

test( "drag/drop events copy mouse-related event properties (gh-1925, gh-2009)", function() {
expect( 4 );

var $fixture = jQuery( "<div id='drag-fixture'></div>" ).appendTo( "body" );

$fixture.on( "dragmove", function( evt ) {
ok( "pageX" in evt, "checking for pageX property on dragmove" );
ok( "pageY" in evt, "checking for pageY property on dragmove" );
});
fireNative( $fixture[ 0 ], "dragmove" );

$fixture.on( "drop", function( evt ) {
ok( "pageX" in evt, "checking for pageX property on drop" );
ok( "pageY" in evt, "checking for pageY property on drop" );
});

fireNative( $fixture[ 0 ], "drop" );

$fixture.unbind( "dragmove drop" ).remove();
});

test( "focusin using non-element targets", function() {
expect( 2 );

@@ -2431,32 +2483,26 @@ testIframeWithCallback( "focusin from an iframe", "event/focusinCrossFrame.html"

var input = jQuery( frameDoc ).find( "#frame-input" );

if ( input.length ) {
// Create a focusin handler on the parent; shouldn't affect the iframe's fate
jQuery ( "body" ).on( "focusin.iframeTest", function() {
ok( false, "fired a focusin event in the parent document" );
});

input.on( "focusin", function() {
ok( true, "fired a focusin event in the iframe" );
});
// Create a focusin handler on the parent; shouldn't affect the iframe's fate
jQuery ( "body" ).on( "focusin.iframeTest", function() {
ok( false, "fired a focusin event in the parent document" );
});

// Avoid a native event; Chrome can't force focus to another frame
input.trigger( "focusin" );
input.on( "focusin", function() {
ok( true, "fired a focusin event in the iframe" );
});

// Must manually remove handler to avoid leaks in our data store
input.remove();
// Avoid a native event; Chrome can't force focus to another frame
input.trigger( "focusin" );

// Be sure it was removed; nothing should happen
input.trigger( "focusin" );
// Must manually remove handler to avoid leaks in our data store
input.remove();

// Remove body handler manually since it's outside the fixture
jQuery( "body" ).off( "focusin.iframeTest" );
// Be sure it was removed; nothing should happen
input.trigger( "focusin" );

} else {
// Opera 12 (pre-Blink) doesn't select anything
ok( true, "SOFTFAIL: no focus event fired in the iframe" );
}
// Remove body handler manually since it's outside the fixture
jQuery( "body" ).off( "focusin.iframeTest" );
});

testIframeWithCallback( "jQuery.ready promise", "event/promiseReady.html", function( isOk ) {
@@ -2661,7 +2707,7 @@ if ( !(/firefox/i.test( window.navigator.userAgent )) ) {
$text = jQuery("#text1"),
$radio = jQuery("#radio1").trigger("focus");

// IE6-10 fire focus/blur events asynchronously; this is the resulting mess.
// IE8-10 fire focus/blur events asynchronously; this is the resulting mess.
// IE's browser window must be topmost for this to work properly!!
stop();
$radio[0].focus();
@@ -486,6 +486,23 @@ test( "html(String) with HTML5 (Bug #6485)", function() {
equal( jQuery("#qunit-fixture").children().children().children().length, 1, "Make sure nested HTML5 elements can hold children." );
});

test( "html(String) tag-hyphenated elements (Bug #1987)", function() {

expect( 27 );

jQuery.each( "thead tbody tfoot colgroup caption tr th td".split(" "), function( i, name ) {
var j = jQuery("<" + name + "-d></" + name + "-d><" + name + "-d></" + name + "-d>");
ok( j[0], "Create a tag-hyphenated element" );
ok( jQuery.nodeName(j[0], name.toUpperCase() + "-D"), "Hyphenated node name" );
ok( jQuery.nodeName(j[1], name.toUpperCase() + "-D"), "Hyphenated node name" );
});

var j = jQuery("<tr-multiple-hyphens><td-with-hyphen>text</td-with-hyphen></tr-multiple-hyphens>");
ok( jQuery.nodeName(j[0], "TR-MULTIPLE-HYPHENS"), "Tags with multiple hypens" );
ok( jQuery.nodeName(j.children()[0], "TD-WITH-HYPHEN"), "Tags with multiple hypens" );
equal( j.children().text(), "text", "Tags with multple hypens behave normally" );
});

test( "IE8 serialization bug", function() {

expect( 2 );
@@ -2434,3 +2451,28 @@ test( "Validate creation of multiple quantities of certain elements (#13818)", 4
});
});
});

asyncTest( "Insert script with data-URI (gh-1887)", 1, function() {
Globals.register( "testFoo" );
Globals.register( "testSrcFoo" );

var script = document.createElement( "script" ),
fixture = document.getElementById( "qunit-fixture" );

script.src = "data:text/javascript,testSrcFoo = 'foo';";

fixture.appendChild( script );

jQuery( fixture ).append( "<script src=\"data:text/javascript,testFoo = 'foo';\"></script>" );

setTimeout(function() {
if ( window[ "testSrcFoo" ] === "foo" ) {
strictEqual( window[ "testFoo" ], window[ "testSrcFoo" ], "data-URI script executed" );

} else {
ok( true, "data-URI script is not supported by this environment" );
}

start();
});
});
@@ -462,9 +462,9 @@ testIframe("offset/body", "body", function( $ ) {
test("chaining", function() {
expect(3);
var coords = { "top": 1, "left": 1 };
equal( jQuery("#absolute-1").offset(coords).selector, "#absolute-1", "offset(coords) returns jQuery object" );
equal( jQuery("#non-existent").offset(coords).selector, "#non-existent", "offset(coords) with empty jQuery set returns jQuery object" );
equal( jQuery("#absolute-1").offset(undefined).selector, "#absolute-1", "offset(undefined) returns jQuery object (#5571)" );
equal( jQuery("#absolute-1").offset(coords).jquery, jQuery.fn.jquery, "offset(coords) returns jQuery object" );
equal( jQuery("#non-existent").offset(coords).jquery, jQuery.fn.jquery, "offset(coords) with empty jQuery set returns jQuery object" );
equal( jQuery("#absolute-1").offset(undefined).jquery, jQuery.fn.jquery, "offset(undefined) returns jQuery object (#5571)" );
});

test("offsetParent", function(){
@@ -531,4 +531,28 @@ test("fractions (see #7730 and #7885)", function() {
div.remove();
});

test("iframe scrollTop/Left (see gh-1945)", function() {
expect( 2 );

var ifDoc = jQuery( "#iframe" )[ 0 ].contentDocument;

// iPhone resize the iframe by its content
// meaning it's not possible to scroll the iframe only its parent element
if ( /iphone os/i.test( navigator.userAgent ) ) {
equal( true, true, "iPhone doesn't scroll the iframes" );
equal( true, true, "iPhone doesn't scroll the iframes" );

} else {
// Tests scrollTop/Left with iframes
jQuery( "#iframe" ).css( "width", "50px" ).css( "height", "50px" );
ifDoc.write( "<div style='width: 1000px; height: 1000px;'></div>" );

jQuery( ifDoc ).scrollTop( 200 );
jQuery( ifDoc ).scrollLeft( 500 );

equal( jQuery( ifDoc ).scrollTop(), 200, "$($('#iframe')[0].contentDocument).scrollTop()" );
equal( jQuery( ifDoc ).scrollLeft(), 500, "$($('#iframe')[0].contentDocument).scrollLeft()" );
}
});

})();
@@ -30,7 +30,7 @@ test("id", function() {
t( "ID Selector w/ Element", "body#body", ["body"] );
t( "ID Selector w/ Element", "ul#first", [] );
t( "ID selector with existing ID descendant", "#firstp #simon1", ["simon1"] );
t( "ID selector with non-existant descendant", "#firstp #foobar", [] );
t( "ID selector with non-existent descendant", "#firstp #foobar", [] );
t( "ID selector using UTF8", "#台北Táiběi", ["台北Táiběi"] );
t( "Multiple ID selectors using UTF8", "#台北Táiběi, #台北", ["台北Táiběi","台北"] );
t( "Descendant ID selector using UTF8", "div #台北", ["台北"] );
@@ -55,7 +55,7 @@ test("id", function() {

t( "ID Selector on Form with an input that has a name of 'id'", "#lengthtest", ["lengthtest"] );

t( "ID selector with non-existant ancestor", "#asdfasdf #foobar", [] ); // bug #986
t( "ID selector with non-existent ancestor", "#asdfasdf #foobar", [] ); // bug #986

t( "Underscore ID", "#types_all", ["types_all"] );
t( "Dash ID", "#qunit-fixture", ["qunit-fixture"] );
@@ -138,7 +138,7 @@ test( "child and adjacent", function() {

nothiddendiv = document.getElementById("nothiddendiv");

t( "Non-existant ancestors", ".fototab > .thumbnails > a", [] );
t( "Non-existent ancestors", ".fototab > .thumbnails > a", [] );
});

test("attributes", function() {
@@ -110,7 +110,7 @@ test("jQuery.param() Constructed prop values", function() {
});

test("serialize()", function() {
expect(5);
expect(6);

// Add html5 elements only for serialize because selector can't yet find them on non-html5 browsers
jQuery("#search").after(
@@ -139,10 +139,8 @@ test("serialize()", function() {
"action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&search=search&email=dave%40jquery.com&number=43&select1=&select2=3&select3=1&select3=2&select5=3&T3=%3F%0D%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=",
"Multiple form serialization as query string");

/* Temporarily disabled. Opera 10 has problems with form serialization.
equal( jQuery("#form, #testForm :input").serialize(),
"action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&search=search&email=dave%40jquery.com&number=43&select1=&select2=3&select3=1&select3=2&T3=%3F%0D%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=",
"action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&search=search&email=dave%40jquery.com&number=43&select1=&select2=3&select3=1&select3=2&select5=3&T3=%3F%0D%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=",
"Mixed form/input serialization as query string");
*/
jQuery("#html5email, #html5number").remove();
});
@@ -30,7 +30,7 @@ if ( jQuery.css ) {
});
}

// This test checkes CSP only for browsers with "Content-Security-Policy" header support
// This test checks CSP only for browsers with "Content-Security-Policy" header support
// i.e. no old WebKit or old Firefox
testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Security/CSP) restrictions",
"support/csp.php",
@@ -52,13 +52,16 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
userAgent = window.navigator.userAgent;

if ( /chrome/i.test( userAgent ) ) {
// Catches Chrome on Android as well (i.e. the default
// Android browser on Android >= 4.4).
expected = {
"ajax": true,
"boxSizingReliable": true,
"checkClone": true,
"checkOn": true,
"clearCloneStyle": true,
"cors": true,
"createHTMLDocument": true,
"focusinBubbles": false,
"noCloneChecked": true,
"optDisabled": true,
@@ -67,46 +70,15 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
"radioValue": true,
"reliableMarginRight": true
};
} else if ( /opera.*version\/12\.1/i.test( userAgent ) ) {
expected = {
"ajax": true,
"boxSizingReliable": true,
"checkClone": true,
"checkOn": true,
"clearCloneStyle": true,
"cors": true,
"focusinBubbles": false,
"noCloneChecked": true,
"optDisabled": true,
"optSelected": true,
"pixelPosition": true,
"radioValue": false,
"reliableMarginRight": true
};
} else if ( /trident\/7\.0/i.test( userAgent ) ) {
expected = {
"ajax": true,
"boxSizingReliable": false,
"checkClone": true,
"checkOn": true,
"clearCloneStyle": false,
"cors": true,
"focusinBubbles": true,
"noCloneChecked": false,
"optDisabled": true,
"optSelected": false,
"pixelPosition": true,
"radioValue": false,
"reliableMarginRight": true
};
} else if ( /msie 10\.0/i.test( userAgent ) ) {
} else if ( /(msie 10\.0|trident\/7\.0)/i.test( userAgent ) ) {
expected = {
"ajax": true,
"boxSizingReliable": false,
"checkClone": true,
"checkOn": true,
"clearCloneStyle": false,
"cors": true,
"createHTMLDocument": true,
"focusinBubbles": true,
"noCloneChecked": false,
"optDisabled": true,
@@ -123,6 +95,7 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
"checkOn": true,
"clearCloneStyle": false,
"cors": false,
"createHTMLDocument": true,
"focusinBubbles": true,
"noCloneChecked": false,
"optDisabled": true,
@@ -131,14 +104,15 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
"radioValue": false,
"reliableMarginRight": true
};
} else if ( /7\.0(\.\d+|) safari/i.test( userAgent ) ) {
} else if ( /8.0(\.\d+|) safari/i.test( userAgent ) ) {
expected = {
"ajax": true,
"boxSizingReliable": true,
"checkClone": true,
"checkOn": true,
"clearCloneStyle": true,
"cors": true,
"createHTMLDocument": false,
"focusinBubbles": false,
"noCloneChecked": true,
"optDisabled": true,
@@ -147,14 +121,15 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
"radioValue": true,
"reliableMarginRight": true
};
} else if ( /6\.0(\.\d+|) safari/i.test( userAgent ) ) {
} else if ( /(6|7)\.0(\.\d+|) safari/i.test( userAgent ) ) {
expected = {
"ajax": true,
"boxSizingReliable": true,
"checkClone": true,
"checkOn": true,
"clearCloneStyle": true,
"cors": true,
"createHTMLDocument": true,
"focusinBubbles": false,
"noCloneChecked": true,
"optDisabled": true,
@@ -163,46 +138,49 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
"radioValue": true,
"reliableMarginRight": true
};
} else if ( /5\.1(\.\d+|) safari/i.test( userAgent ) ) {
} else if ( /firefox/i.test( userAgent ) ) {
expected = {
"ajax": true,
"boxSizingReliable": true,
"checkClone": false,
"checkOn": false,
"checkClone": true,
"checkOn": true,
"clearCloneStyle": true,
"cors": true,
"createHTMLDocument": true,
"focusinBubbles": false,
"noCloneChecked": true,
"optDisabled": true,
"optSelected": true,
"pixelPosition": false,
"pixelPosition": true,
"radioValue": true,
"reliableMarginRight": true
};
} else if ( /firefox/i.test( userAgent ) ) {
} else if ( /iphone os 8/i.test( userAgent ) ) {
expected = {
"ajax": true,
"boxSizingReliable": true,
"checkClone": true,
"checkOn": true,
"clearCloneStyle": true,
"cors": true,
"createHTMLDocument": false,
"focusinBubbles": false,
"noCloneChecked": true,
"optDisabled": true,
"optSelected": true,
"pixelPosition": true,
"pixelPosition": false,
"radioValue": true,
"reliableMarginRight": true
};
} else if ( /iphone os (?:6|7)_/i.test( userAgent ) ) {
} else if ( /iphone os (6|7)/i.test( userAgent ) ) {
expected = {
"ajax": true,
"boxSizingReliable": true,
"checkClone": true,
"checkOn": true,
"clearCloneStyle": true,
"cors": true,
"createHTMLDocument": true,
"focusinBubbles": false,
"noCloneChecked": true,
"optDisabled": true,
@@ -211,37 +189,39 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
"radioValue": true,
"reliableMarginRight": true
};
} else if ( /android 2\.3/i.test( userAgent ) ) {
} else if ( /android 4\.[0-3]/i.test( userAgent ) ) {
expected = {
"ajax": true,
"boxSizingReliable": true,
"checkClone": true,
"checkClone": false,
"checkOn": false,
"clearCloneStyle": false,
"clearCloneStyle": true,
"cors": true,
"createHTMLDocument": true,
"focusinBubbles": false,
"noCloneChecked": true,
"optDisabled": false,
"optDisabled": true,
"optSelected": true,
"pixelPosition": false,
"radioValue": true,
"reliableMarginRight": false
"reliableMarginRight": true
};
} else if ( /android 4\.[0-3]/i.test( userAgent ) ) {
} else if ( /android 2\.3/i.test( userAgent ) ) {
expected = {
"ajax": true,
"boxSizingReliable": true,
"checkClone": false,
"checkClone": true,
"checkOn": false,
"clearCloneStyle": true,
"clearCloneStyle": false,
"cors": true,
"createHTMLDocument": true,
"focusinBubbles": false,
"noCloneChecked": true,
"optDisabled": true,
"optDisabled": false,
"optSelected": true,
"pixelPosition": false,
"radioValue": true,
"reliableMarginRight": true
"reliableMarginRight": false
};
}

@@ -148,6 +148,36 @@ test( "wrapAll(String)", function() {

});

test( "wrapAll(Function)", 5, function() {
var prev = jQuery( "#firstp" )[ 0 ].previousSibling,
p = jQuery( "#firstp,#first" )[ 0 ].parentNode,
result = jQuery( "#firstp,#first" ).wrapAll(function() {
return "<div class='red'><div class='tmp'></div></div>";
});

equal( result.parent().length, 1, "Check for wrapping of on-the-fly html" );
ok( jQuery( "#first" ).parent().parent().is( ".red" ), "Check if wrapper has class 'red'" );
ok( jQuery( "#firstp" ).parent().parent().is( ".red" ), "Check if wrapper has class 'red'" );
ok( jQuery( "#first" ).parent().parent().parent().is( p ), "Correct Parent" );
strictEqual( jQuery( "#first" ).parent().parent()[ 0 ].previousSibling, prev, "Correct Previous Sibling" );
});

test( "wrapAll(Function) check execution characteristics", 3, function() {
var i = 0;

jQuery( "non-existent" ).wrapAll(function() {
i++;
return "";
});

ok( !i, "should not execute function argument if target element does not exist" );

jQuery( "#firstp" ).wrapAll(function( index ) {
strictEqual( this, jQuery( "#firstp" )[ 0 ], "context must be the first found element" );
strictEqual( index, undefined, "index argument should not be included in function execution" );
});
});

test( "wrapAll(Element)", function() {

expect( 3 );