Skip to content

Commit 4b39a82

Browse files
committed
Fix #14340. Remove remnants of oldIE from unit tests. Close jquerygh-1425.
1 parent 2ace149 commit 4b39a82

File tree

10 files changed

+56
-131
lines changed

10 files changed

+56
-131
lines changed

test/data/testsuite.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* for testing opacity set in styles in IE */
21
ol#empty {
32
opacity: 0;
43
}

test/unit/attributes.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -590,8 +590,7 @@ test( "removeAttr(String)", function() {
590590
$first = jQuery("<div Case='mixed'></div>");
591591
equal( $first.attr("Case"), "mixed", "case of attribute doesn't matter" );
592592
$first.removeAttr("Case");
593-
// IE 6/7 return empty string here, not undefined
594-
ok( !$first.attr("Case"), "mixed-case attribute was removed" );
593+
equal( $first.attr( "Case" ), undefined, "mixed-case attribute was removed" );
595594
});
596595

597596
test( "removeAttr(String) in XML", function() {

test/unit/core.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,6 @@ test("isFunction", function() {
409409
// Firefox says this is a function
410410
ok( !jQuery.isFunction(obj), "Object Element" );
411411

412-
// IE says this is an object
413412
// Since 1.3, this isn't supported (#2968)
414413
//ok( jQuery.isFunction(obj.getAttribute), "getAttribute Function" );
415414

@@ -427,7 +426,6 @@ test("isFunction", function() {
427426
input.type = "text";
428427
document.body.appendChild( input );
429428

430-
// IE says this is an object
431429
// Since 1.3, this isn't supported (#2968)
432430
//ok( jQuery.isFunction(input.focus), "A default function property" );
433431

test/unit/css.js

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -700,29 +700,22 @@ test("widows & orphans #8936", function () {
700700

701701
var $p = jQuery("<p>").appendTo("#qunit-fixture");
702702

703-
if ( "widows" in $p[0].style ) {
704-
expect(4);
705-
$p.css({
706-
"widows": 0,
707-
"orphans": 0
708-
});
709-
710-
equal( $p.css("widows") || jQuery.style( $p[0], "widows" ), 0, "widows correctly start with value 0");
711-
equal( $p.css("orphans") || jQuery.style( $p[0], "orphans" ), 0, "orphans correctly start with value 0");
712-
713-
$p.css({
714-
"widows": 3,
715-
"orphans": 3
716-
});
703+
expect( 4 );
704+
$p.css({
705+
"widows": 0,
706+
"orphans": 0
707+
});
717708

718-
equal( $p.css("widows") || jQuery.style( $p[0], "widows" ), 3, "widows correctly set to 3");
719-
equal( $p.css("orphans") || jQuery.style( $p[0], "orphans" ), 3, "orphans correctly set to 3");
720-
} else {
709+
equal( $p.css( "widows" ) || jQuery.style( $p[0], "widows" ), 0, "widows correctly start with value 0" );
710+
equal( $p.css( "orphans" ) || jQuery.style( $p[0], "orphans" ), 0, "orphans correctly start with value 0" );
721711

722-
expect(1);
723-
ok( true, "jQuery does not attempt to test for style props that definitely don't exist in older versions of IE");
724-
}
712+
$p.css({
713+
"widows": 3,
714+
"orphans": 3
715+
});
725716

717+
equal( $p.css( "widows" ) || jQuery.style( $p[0], "widows" ), 3, "widows correctly set to 3" );
718+
equal( $p.css( "orphans" ) || jQuery.style( $p[0], "orphans" ), 3, "orphans correctly set to 3" );
726719

727720
$p.remove();
728721
});
@@ -761,12 +754,6 @@ test("can't get background-position in IE<9, see #10796", function() {
761754
}
762755
});
763756

764-
test("percentage properties for bottom and right in IE<9 should not be incorrectly transformed to pixels, see #11311", function() {
765-
expect( 1 );
766-
var div = jQuery("<div style='position: absolute; width: 1px; height: 20px; bottom:50%;'></div>").appendTo( "#qunit-fixture" );
767-
ok( window.getComputedStyle || div.css( "bottom" ) === "50%", "position properties get incorrectly transformed in IE<8, see #11311" );
768-
});
769-
770757
if ( jQuery.fn.offset ) {
771758
test("percentage properties for left and top should be transformed to pixels, see #9505", function() {
772759
expect( 2 );

test/unit/effects.js

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -355,17 +355,13 @@ test("animate table width/height", function() {
355355
test("animate table-row width/height", function() {
356356
expect(3);
357357
stop();
358-
var displayMode,
359-
tr = jQuery("#table")
358+
var tr = jQuery( "#table" )
360359
.attr({ "cellspacing": 0, "cellpadding": 0, "border": 0 })
361-
.html("<tr style='height:42px;'><td style='padding:0;'><div style='width:20px;height:20px;'></div></td></tr>")
362-
.find("tr");
363-
364-
// IE<8 uses "block" instead of the correct display type
365-
displayMode = tr.css("display") !== "table-row" ? "block" : "table-row";
360+
.html( "<tr style='height:42px;'><td style='padding:0;'><div style='width:20px;height:20px;'></div></td></tr>" )
361+
.find( "tr" );
366362

367363
tr.animate({ width: 10, height: 10 }, 100, function() {
368-
equal( jQuery(this).css("display"), displayMode, "display mode is correct" );
364+
equal( jQuery( this ).css( "display" ), "table-row", "display mode is correct" );
369365
equal( this.offsetWidth, 20, "width animated to shrink wrap point" );
370366
equal( this.offsetHeight, 20, "height animated to shrink wrap point" );
371367
start();
@@ -375,17 +371,13 @@ test("animate table-row width/height", function() {
375371
test("animate table-cell width/height", function() {
376372
expect(3);
377373
stop();
378-
var displayMode,
379-
td = jQuery("#table")
374+
var td = jQuery( "#table" )
380375
.attr({ "cellspacing": 0, "cellpadding": 0, "border": 0 })
381-
.html("<tr><td style='width:42px;height:42px;padding:0;'><div style='width:20px;height:20px;'></div></td></tr>")
382-
.find("td");
383-
384-
// IE<8 uses "block" instead of the correct display type
385-
displayMode = td.css("display") !== "table-cell" ? "block" : "table-cell";
376+
.html( "<tr><td style='width:42px;height:42px;padding:0;'><div style='width:20px;height:20px;'></div></td></tr>" )
377+
.find( "td" );
386378

387379
td.animate({ width: 10, height: 10 }, 100, function() {
388-
equal( jQuery(this).css("display"), displayMode, "display mode is correct" );
380+
equal( jQuery( this ).css( "display" ), "table-cell", "display mode is correct" );
389381
equal( this.offsetWidth, 20, "width animated to shrink wrap point" );
390382
equal( this.offsetHeight, 20, "height animated to shrink wrap point" );
391383
start();
@@ -990,16 +982,6 @@ jQuery.each({
990982
f_o = f( elem, "opacity" );
991983
}
992984

993-
// The only time an _empty_string_ will be matched is in IE
994-
// otherwise, the correct values will be tested as usual
995-
if ( f_o === "" ) {
996-
f_o = 1;
997-
}
998-
// See above
999-
if ( cur_o === "" ) {
1000-
cur_o = 1;
1001-
}
1002-
1003985
if ( t_o === "hide" || t_o === "show" ) {
1004986
equal( cur_o, f_o, "Opacity must be reset to " + f_o + ": " + cur_o );
1005987
}

test/unit/event.js

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -392,28 +392,15 @@ test("on bubbling, isDefaultPrevented", function() {
392392
$main = jQuery( "#qunit-fixture" ),
393393
fakeClick = function($jq) {
394394
// Use a native click so we don't get jQuery simulated bubbling
395-
if ( document.createEvent ) {
396-
var e = document.createEvent( "MouseEvents" );
397-
e.initEvent( "click", true, true );
398-
$jq[0].dispatchEvent(e);
399-
}
400-
else if ( $jq[0].click ) {
401-
$jq[0].click(); // IE
402-
}
395+
var e = document.createEvent( "MouseEvents" );
396+
e.initEvent( "click", true, true );
397+
$jq[ 0 ].dispatchEvent( e );
403398
};
404399
$anchor2.on( "click", function(e) {
405400
e.preventDefault();
406401
});
407-
$main.on("click", "#foo", function(e) {
408-
var orig = e.originalEvent;
409-
410-
if ( typeof(orig.defaultPrevented) === "boolean" || typeof(orig.returnValue) === "boolean" || orig["getPreventDefault"] ) {
411-
equal( e.isDefaultPrevented(), true, "isDefaultPrevented true passed to bubbled event" );
412-
413-
} else {
414-
// Opera < 11 doesn't implement any interface we can use, so give it a pass
415-
ok( true, "isDefaultPrevented not supported by this browser, test skipped" );
416-
}
402+
$main.on( "click", "#foo", function( e ) {
403+
equal( e.isDefaultPrevented(), true, "isDefaultPrevented true passed to bubbled event" );
417404
});
418405
fakeClick( $anchor2 );
419406
$anchor2.off( "click" );
@@ -1224,8 +1211,6 @@ test("trigger(eventObject, [data], [fn])", function() {
12241211
equal( event.isDefaultPrevented(), false, "default not prevented" );
12251212
});
12261213

1227-
// Explicitly introduce global variable for oldIE so QUnit doesn't complain if checking globals
1228-
window.onclick = undefined;
12291214
test(".trigger() bubbling on disconnected elements (#10489)", function() {
12301215
expect(2);
12311216

test/unit/manipulation.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ function testText( valueObj ) {
7777
equal( jQuery( j[ 0 ] ).text(), "hi!", "Check node,textnode,comment with text()" );
7878
equal( j[ 1 ].nodeValue, " there ", "Check node,textnode,comment with text()" );
7979

80-
// Blackberry 4.6 doesn't maintain comments in the DOM
81-
equal( jQuery("#nonnodes")[ 0 ].childNodes.length < 3 ? 8 : j[ 2 ].nodeType, 8, "Check node,textnode,comment with text()" );
80+
equal( j[ 2 ].nodeType, 8, "Check node,textnode,comment with text()" );
8281

8382
// Update multiple elements #11809
8483
expected = "New";

test/unit/offset.js

Lines changed: 23 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -181,16 +181,11 @@ testIframe("offset/absolute", "absolute", function( $ ) {
181181
testIframe("offset/relative", "relative", function( $ ) {
182182
expect(60);
183183

184-
var ie, tests;
185-
186-
// IE is collapsing the top margin of 1px; detect and adjust accordingly
187-
ie = $("#relative-1").offset().top === 6;
188-
189184
// get offset
190-
tests = [
191-
{ "id": "#relative-1", "top": ie ? 6 : 7, "left": 7 },
192-
{ "id": "#relative-1-1", "top": ie ? 13 : 15, "left": 15 },
193-
{ "id": "#relative-2", "top": ie ? 141 : 142, "left": 27 }
185+
var tests = [
186+
{ "id": "#relative-1", "top": 7, "left": 7 },
187+
{ "id": "#relative-1-1", "top": 15, "left": 15 },
188+
{ "id": "#relative-2", "top": 142, "left": 27 }
194189
];
195190
jQuery.each( tests, function() {
196191
equal( $( this["id"] ).offset().top, this["top"], "jQuery('" + this["id"] + "').offset().top" );
@@ -200,9 +195,9 @@ testIframe("offset/relative", "relative", function( $ ) {
200195

201196
// get position
202197
tests = [
203-
{ "id": "#relative-1", "top": ie ? 5 : 6, "left": 6 },
204-
{ "id": "#relative-1-1", "top": ie ? 4 : 5, "left": 5 },
205-
{ "id": "#relative-2", "top": ie ? 140 : 141, "left": 26 }
198+
{ "id": "#relative-1", "top": 6, "left": 6 },
199+
{ "id": "#relative-1-1", "top": 5, "left": 5 },
200+
{ "id": "#relative-2", "top": 141, "left": 26 }
206201
];
207202
jQuery.each( tests, function() {
208203
equal( $( this["id"] ).position().top, this["top"], "jQuery('" + this["id"] + "').position().top" );
@@ -244,17 +239,12 @@ testIframe("offset/relative", "relative", function( $ ) {
244239
testIframe("offset/static", "static", function( $ ) {
245240
expect( 80 );
246241

247-
var ie, tests;
248-
249-
// IE is collapsing the top margin of 1px; detect and adjust accordingly
250-
ie = $("#static-1").offset().top === 6;
251-
252242
// get offset
253-
tests = [
254-
{ "id": "#static-1", "top": ie ? 6 : 7, "left": 7 },
255-
{ "id": "#static-1-1", "top": ie ? 13 : 15, "left": 15 },
256-
{ "id": "#static-1-1-1", "top": ie ? 20 : 23, "left": 23 },
257-
{ "id": "#static-2", "top": ie ? 121 : 122, left: 7 }
243+
var tests = [
244+
{ "id": "#static-1", "top": 7, "left": 7 },
245+
{ "id": "#static-1-1", "top": 15, "left": 15 },
246+
{ "id": "#static-1-1-1", "top": 23, "left": 23 },
247+
{ "id": "#static-2", "top": 122, left: 7 }
258248
];
259249
jQuery.each( tests, function() {
260250
equal( $( this["id"] ).offset().top, this["top"], "jQuery('" + this["id"] + "').offset().top" );
@@ -264,10 +254,10 @@ testIframe("offset/static", "static", function( $ ) {
264254

265255
// get position
266256
tests = [
267-
{ "id": "#static-1", "top": ie ? 5 : 6, "left": 6 },
268-
{ "id": "#static-1-1", "top": ie ? 12 : 14, "left": 14 },
269-
{ "id": "#static-1-1-1", "top": ie ? 19 : 22, "left": 22 },
270-
{ "id": "#static-2", "top": ie ? 120 : 121, "left": 6 }
257+
{ "id": "#static-1", "top": 6, "left": 6 },
258+
{ "id": "#static-1-1", "top": 14, "left": 14 },
259+
{ "id": "#static-1-1-1", "top": 22, "left": 22 },
260+
{ "id": "#static-2", "top": 121, "left": 6 }
271261
];
272262
jQuery.each( tests, function() {
273263
equal( $( this["id"] ).position().top, this["top"], "jQuery('" + this["top"] + "').position().top" );
@@ -313,25 +303,22 @@ testIframe("offset/static", "static", function( $ ) {
313303
testIframe("offset/fixed", "fixed", function( $ ) {
314304
expect(34);
315305

316-
var ie, tests, $noTopLeft;
317-
318-
// IE is collapsing the top margin of 1px; detect and adjust accordingly
319-
ie = $("#fixed-1").position().top === 2;
306+
var tests, $noTopLeft;
320307

321308
tests = [
322309
{
323310
"id": "#fixed-1",
324311
"offsetTop": 1001,
325312
"offsetLeft": 1001,
326-
"positionTop": ie ? 2 : 0,
327-
"positionLeft": ie ? 2 : 0
313+
"positionTop": 0,
314+
"positionLeft": 0
328315
},
329316
{
330317
"id": "#fixed-2",
331318
"offsetTop": 1021,
332319
"offsetLeft": 1021,
333-
"positionTop": ie ? 22 : 20,
334-
"positionLeft": ie ? 22 : 20
320+
"positionTop": 20,
321+
"positionLeft": 20
335322
}
336323
];
337324

@@ -413,21 +400,10 @@ testIframe("offset/table", "table", function( $ ) {
413400
testIframe("offset/scroll", "scroll", function( $, win ) {
414401
expect(24);
415402

416-
// If we're going to bastardize the tests, let's just DO it
417-
var ie = /msie [678]/i.test( navigator.userAgent );
418-
419-
if ( ie ) {
420-
ok( true, "TestSwarm's iframe has hosed this test in oldIE, we surrender" );
421-
} else {
422-
equal( $("#scroll-1").offset().top, 7, "jQuery('#scroll-1').offset().top" );
423-
}
403+
equal( $("#scroll-1").offset().top, 7, "jQuery('#scroll-1').offset().top" );
424404
equal( $("#scroll-1").offset().left, 7, "jQuery('#scroll-1').offset().left" );
425405

426-
if ( ie ) {
427-
ok( true, "TestSwarm's iframe has hosed this test in oldIE, we surrender" );
428-
} else {
429-
equal( $("#scroll-1-1").offset().top, 11, "jQuery('#scroll-1-1').offset().top" );
430-
}
406+
equal( $("#scroll-1-1").offset().top, 11, "jQuery('#scroll-1-1').offset().top" );
431407
equal( $("#scroll-1-1").offset().left, 11, "jQuery('#scroll-1-1').offset().left" );
432408

433409
// scroll offset tests .scrollTop/Left

test/unit/selector.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ test("disconnected nodes - jQuery only", function() {
7474
});
7575

7676
testIframe("selector/html5_selector", "attributes - jQuery.attr", function( jQuery, window, document ) {
77-
expect( 35 );
77+
expect( 38 );
7878

7979
/**
8080
* Returns an array of elements with the given IDs
@@ -132,10 +132,10 @@ testIframe("selector/html5_selector", "attributes - jQuery.attr", function( jQue
132132
t( "Attribute Exists", "[indeterminate]", []);
133133
t( "Attribute Exists", "[ismap]", ["img1"]);
134134
t( "Attribute Exists", "[itemscope]", ["div1"]);
135-
// t( "Attribute Exists", "[loop]", ["video1"]); // IE 6/7 cannot differentiate here. loop is also used on img, input, and marquee tags as well as video/audio. getAttributeNode unfortunately also retrieves the property value.
135+
t( "Attribute Exists", "[loop]", ["video1"]);
136136
t( "Attribute Exists", "[multiple]", ["select1"]);
137137
t( "Attribute Exists", "[muted]", ["audio1"]);
138-
// t( "Attribute Exists", "[nohref]", ["area1"]); // IE 6/7 keep this set to false regardless of presence. The attribute node is not retrievable.
138+
t( "Attribute Exists", "[nohref]", ["area1"]);
139139
t( "Attribute Exists", "[noresize]", ["textarea1"]);
140140
t( "Attribute Exists", "[noshade]", ["hr1"]);
141141
t( "Attribute Exists", "[nowrap]", ["td1", "div1"]);
@@ -157,7 +157,8 @@ testIframe("selector/html5_selector", "attributes - jQuery.attr", function( jQue
157157
});
158158
t( "Enumerated attribute", "[spellcheck]", ["span1"]);
159159

160-
// t( "tabindex selector does not retrieve all elements in IE6/7(#8473)", "form, [tabindex]", ["form1", "text1"] ); // sigh, FF12 QSA mistakenly includes video elements even though they have no tabindex attribute (see https://bugzilla.mozilla.org/show_bug.cgi?id=618737)
160+
t( "tabindex selector does not retrieve all elements in IE6/7 (#8473)",
161+
"form, [tabindex]", [ "form1", "text1" ] );
161162
t( "Improperly named form elements do not interfere with form selections (#9570)", "form[name='formName']", ["form1"] );
162163
});
163164

test/unit/wrap.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ function testWrap( val ) {
4949
j = jQuery("#nonnodes").contents();
5050
j.wrap( val("<i></i>") );
5151

52-
// Blackberry 4.6 doesn't maintain comments in the DOM
5352
equal( jQuery("#nonnodes > i").length, jQuery("#nonnodes")[ 0 ].childNodes.length, "Check node,textnode,comment wraps ok" );
5453
equal( jQuery("#nonnodes > i").text(), j.text(), "Check node,textnode,comment wraps doesn't hurt text" );
5554

0 commit comments

Comments
 (0)