Skip to content

Commit ac8b1e4

Browse files
authored
Core: Make back compat disabled by default
Closes gh-2250
1 parent 969d182 commit ac8b1e4

File tree

15 files changed

+28
-27
lines changed

15 files changed

+28
-27
lines changed

tests/lib/bootstrap.js

+11-9
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ requirejs.config( {
2525
}
2626
} );
2727

28-
// Create a module that disables back compat for UI modules
29-
define( "jquery-no-back-compat", [ "jquery" ], function( $ ) {
30-
$.uiBackCompat = false;
28+
// Create a module that enables back compat for UI modules
29+
define( "jquery-back-compat", [ "jquery" ], function( $ ) {
30+
$.uiBackCompat = true;
3131

3232
return $;
3333
} );
@@ -53,10 +53,12 @@ function requireModules( dependencies, callback, modules ) {
5353
}
5454

5555
// Load a set of test file along with the required test infrastructure
56-
function requireTests( dependencies, noBackCompat ) {
57-
var preDependencies = [
56+
function requireTests( dependencies, options ) {
57+
58+
var backCompat = !!( options && options.backCompat ),
59+
preDependencies = [
5860
"lib/qunit",
59-
noBackCompat ? "jquery-no-back-compat" : "jquery",
61+
backCompat ? "jquery-back-compat" : "jquery",
6062
"jquery-simulate"
6163
];
6264

@@ -136,7 +138,7 @@ function migrateUrl() {
136138
// - data-widget: A widget to load test modules for
137139
// - Automatically loads common, core, events, methods, and options
138140
// - data-deprecated: Loads the deprecated test modules for a widget
139-
// - data-no-back-compat: Set $.uiBackCompat to false
141+
// - data-back-compat: Set $.uiBackCompat to `true`
140142
( function() {
141143

142144
// Find the script element
@@ -154,7 +156,7 @@ function migrateUrl() {
154156
}
155157
var widget = script.getAttribute( "data-widget" );
156158
var deprecated = !!script.getAttribute( "data-deprecated" );
157-
var noBackCompat = !!script.getAttribute( "data-no-back-compat" );
159+
var backCompat = !!script.getAttribute( "data-back-compat" );
158160

159161
if ( widget ) {
160162
modules = modules.concat( [
@@ -177,7 +179,7 @@ function migrateUrl() {
177179
modules.unshift( "ui/jquery-patch" );
178180
}
179181

180-
requireTests( modules, noBackCompat );
182+
requireTests( modules, { backCompat: backCompat } );
181183
} )();
182184

183185
} )();

tests/unit/button/button.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<script src="../../../external/requirejs/require.js"></script>
88
<script src="../../lib/css.js" data-modules="core button"></script>
9-
<script src="../../lib/bootstrap.js" data-widget="button" data-no-back-compat="true"></script>
9+
<script src="../../lib/bootstrap.js" data-widget="button"></script>
1010
</head>
1111
<body>
1212

tests/unit/dialog/dialog.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<script src="../../../external/requirejs/require.js"></script>
88
<script src="../../lib/css.js" data-modules="core button dialog"></script>
9-
<script src="../../lib/bootstrap.js" data-widget="dialog" data-no-back-compat="true"></script>
9+
<script src="../../lib/bootstrap.js" data-widget="dialog"></script>
1010
</head>
1111
<body>
1212

tests/unit/droppable/droppable.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66

77
<script src="../../../external/requirejs/require.js"></script>
88
<script src="../../lib/css.js" data-modules="core"></script>
9-
<script src="../../lib/bootstrap.js" data-widget="droppable"
10-
data-no-back-compat="true"></script>
9+
<script src="../../lib/bootstrap.js" data-widget="droppable"></script>
1110
</head>
1211
<body>
1312

tests/unit/tabs/core.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ QUnit.test( "markup structure", function( assert ) {
2929
assert.hasClasses( tabs[ 2 ], "ui-tabs-tab" );
3030

3131
// DEPRECATED
32-
assert.hasClasses( tabs[ 0 ], "ui-tab" );
33-
assert.hasClasses( tabs[ 1 ], "ui-tab" );
34-
assert.hasClasses( tabs[ 2 ], "ui-tab" );
32+
assert.lacksClasses( tabs[ 0 ], "ui-tab" );
33+
assert.lacksClasses( tabs[ 1 ], "ui-tab" );
34+
assert.lacksClasses( tabs[ 2 ], "ui-tab" );
3535

3636
assert.equal( tabs.length, 3, "There are exactly three tabs" );
3737
assert.hasClasses( anchors[ 0 ], "ui-tabs-anchor" );

tests/unit/tooltip/tooltip.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<script src="../../../external/requirejs/require.js"></script>
88
<script src="../../lib/css.js" data-modules="core tooltip"></script>
9-
<script src="../../lib/bootstrap.js" data-widget="tooltip" data-no-back-compat="true"></script>
9+
<script src="../../lib/bootstrap.js" data-widget="tooltip"></script>
1010
</head>
1111
<body>
1212

ui/effect.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ if ( $.expr && $.expr.pseudos && $.expr.pseudos.animated ) {
273273
} )( $.expr.pseudos.animated );
274274
}
275275

276-
if ( $.uiBackCompat !== false ) {
276+
if ( $.uiBackCompat === true ) {
277277
$.extend( $.effects, {
278278

279279
// Saves a set of properties in a data storage
@@ -759,7 +759,7 @@ $.fn.extend( {
759759
// as toggle can be either show or hide depending on element state
760760
args.mode = modes.shift();
761761

762-
if ( $.uiBackCompat !== false && !defaultMode ) {
762+
if ( $.uiBackCompat === true && !defaultMode ) {
763763
if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) {
764764

765765
// Call the core method to track "olddisplay" properly

ui/effects/effect-transfer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"use strict";
3434

3535
var effect;
36-
if ( $.uiBackCompat !== false ) {
36+
if ( $.uiBackCompat === true ) {
3737
effect = $.effects.define( "transfer", function( options, done ) {
3838
$( this ).transfer( options, done );
3939
} );

ui/widgets/button.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ $.widget( "ui.button", {
287287
} );
288288

289289
// DEPRECATED
290-
if ( $.uiBackCompat !== false ) {
290+
if ( $.uiBackCompat === true ) {
291291

292292
// Text and Icons options
293293
$.widget( "ui.button", $.ui.button, {

ui/widgets/dialog.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,7 @@ $.widget( "ui.dialog", {
930930

931931
// DEPRECATED
932932
// TODO: switch return back to widget declaration at top of file when this is removed
933-
if ( $.uiBackCompat !== false ) {
933+
if ( $.uiBackCompat === true ) {
934934

935935
// Backcompat for dialogClass option
936936
$.widget( "ui.dialog", $.ui.dialog, {

ui/widgets/droppable.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ $.ui.ddmanager = {
463463

464464
// DEPRECATED
465465
// TODO: switch return back to widget declaration at top of file when this is removed
466-
if ( $.uiBackCompat !== false ) {
466+
if ( $.uiBackCompat === true ) {
467467

468468
// Backcompat for activeClass and hoverClass options
469469
$.widget( "ui.droppable", $.ui.droppable, {

ui/widgets/resizable.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,7 @@ $.ui.plugin.add( "resizable", "ghost", {
11131113

11141114
// DEPRECATED
11151115
// TODO: remove after 1.12
1116-
if ( $.uiBackCompat !== false && typeof that.options.ghost === "string" ) {
1116+
if ( $.uiBackCompat === true && typeof that.options.ghost === "string" ) {
11171117

11181118
// Ghost option
11191119
that.ghost.addClass( this.options.ghost );

ui/widgets/spinner.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ $.widget( "ui.spinner", {
554554

555555
// DEPRECATED
556556
// TODO: switch return back to widget declaration at top of file when this is removed
557-
if ( $.uiBackCompat !== false ) {
557+
if ( $.uiBackCompat === true ) {
558558

559559
// Backcompat for spinner html extension points
560560
$.widget( "ui.spinner", $.ui.spinner, {

ui/widgets/tabs.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,7 @@ $.widget( "ui.tabs", {
909909

910910
// DEPRECATED
911911
// TODO: Switch return back to widget declaration at top of file when this is removed
912-
if ( $.uiBackCompat !== false ) {
912+
if ( $.uiBackCompat === true ) {
913913

914914
// Backcompat for ui-tab class (now ui-tabs-tab)
915915
$.widget( "ui.tabs", $.ui.tabs, {

ui/widgets/tooltip.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ $.widget( "ui.tooltip", {
505505

506506
// DEPRECATED
507507
// TODO: Switch return back to widget declaration at top of file when this is removed
508-
if ( $.uiBackCompat !== false ) {
508+
if ( $.uiBackCompat === true ) {
509509

510510
// Backcompat for tooltipClass option
511511
$.widget( "ui.tooltip", $.ui.tooltip, {

0 commit comments

Comments
 (0)