mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Core: Make back compat disabled by default
Closes gh-2250
This commit is contained in:
parent
969d182963
commit
ac8b1e4eee
20
tests/lib/bootstrap.js
vendored
20
tests/lib/bootstrap.js
vendored
@ -25,9 +25,9 @@ requirejs.config( {
|
|||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// Create a module that disables back compat for UI modules
|
// Create a module that enables back compat for UI modules
|
||||||
define( "jquery-no-back-compat", [ "jquery" ], function( $ ) {
|
define( "jquery-back-compat", [ "jquery" ], function( $ ) {
|
||||||
$.uiBackCompat = false;
|
$.uiBackCompat = true;
|
||||||
|
|
||||||
return $;
|
return $;
|
||||||
} );
|
} );
|
||||||
@ -53,10 +53,12 @@ function requireModules( dependencies, callback, modules ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load a set of test file along with the required test infrastructure
|
// Load a set of test file along with the required test infrastructure
|
||||||
function requireTests( dependencies, noBackCompat ) {
|
function requireTests( dependencies, options ) {
|
||||||
var preDependencies = [
|
|
||||||
|
var backCompat = !!( options && options.backCompat ),
|
||||||
|
preDependencies = [
|
||||||
"lib/qunit",
|
"lib/qunit",
|
||||||
noBackCompat ? "jquery-no-back-compat" : "jquery",
|
backCompat ? "jquery-back-compat" : "jquery",
|
||||||
"jquery-simulate"
|
"jquery-simulate"
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -136,7 +138,7 @@ function migrateUrl() {
|
|||||||
// - data-widget: A widget to load test modules for
|
// - data-widget: A widget to load test modules for
|
||||||
// - Automatically loads common, core, events, methods, and options
|
// - Automatically loads common, core, events, methods, and options
|
||||||
// - data-deprecated: Loads the deprecated test modules for a widget
|
// - data-deprecated: Loads the deprecated test modules for a widget
|
||||||
// - data-no-back-compat: Set $.uiBackCompat to false
|
// - data-back-compat: Set $.uiBackCompat to `true`
|
||||||
( function() {
|
( function() {
|
||||||
|
|
||||||
// Find the script element
|
// Find the script element
|
||||||
@ -154,7 +156,7 @@ function migrateUrl() {
|
|||||||
}
|
}
|
||||||
var widget = script.getAttribute( "data-widget" );
|
var widget = script.getAttribute( "data-widget" );
|
||||||
var deprecated = !!script.getAttribute( "data-deprecated" );
|
var deprecated = !!script.getAttribute( "data-deprecated" );
|
||||||
var noBackCompat = !!script.getAttribute( "data-no-back-compat" );
|
var backCompat = !!script.getAttribute( "data-back-compat" );
|
||||||
|
|
||||||
if ( widget ) {
|
if ( widget ) {
|
||||||
modules = modules.concat( [
|
modules = modules.concat( [
|
||||||
@ -177,7 +179,7 @@ function migrateUrl() {
|
|||||||
modules.unshift( "ui/jquery-patch" );
|
modules.unshift( "ui/jquery-patch" );
|
||||||
}
|
}
|
||||||
|
|
||||||
requireTests( modules, noBackCompat );
|
requireTests( modules, { backCompat: backCompat } );
|
||||||
} )();
|
} )();
|
||||||
|
|
||||||
} )();
|
} )();
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<script src="../../../external/requirejs/require.js"></script>
|
<script src="../../../external/requirejs/require.js"></script>
|
||||||
<script src="../../lib/css.js" data-modules="core button"></script>
|
<script src="../../lib/css.js" data-modules="core button"></script>
|
||||||
<script src="../../lib/bootstrap.js" data-widget="button" data-no-back-compat="true"></script>
|
<script src="../../lib/bootstrap.js" data-widget="button"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<script src="../../../external/requirejs/require.js"></script>
|
<script src="../../../external/requirejs/require.js"></script>
|
||||||
<script src="../../lib/css.js" data-modules="core button dialog"></script>
|
<script src="../../lib/css.js" data-modules="core button dialog"></script>
|
||||||
<script src="../../lib/bootstrap.js" data-widget="dialog" data-no-back-compat="true"></script>
|
<script src="../../lib/bootstrap.js" data-widget="dialog"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
@ -6,8 +6,7 @@
|
|||||||
|
|
||||||
<script src="../../../external/requirejs/require.js"></script>
|
<script src="../../../external/requirejs/require.js"></script>
|
||||||
<script src="../../lib/css.js" data-modules="core"></script>
|
<script src="../../lib/css.js" data-modules="core"></script>
|
||||||
<script src="../../lib/bootstrap.js" data-widget="droppable"
|
<script src="../../lib/bootstrap.js" data-widget="droppable"></script>
|
||||||
data-no-back-compat="true"></script>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
@ -29,9 +29,9 @@ QUnit.test( "markup structure", function( assert ) {
|
|||||||
assert.hasClasses( tabs[ 2 ], "ui-tabs-tab" );
|
assert.hasClasses( tabs[ 2 ], "ui-tabs-tab" );
|
||||||
|
|
||||||
// DEPRECATED
|
// DEPRECATED
|
||||||
assert.hasClasses( tabs[ 0 ], "ui-tab" );
|
assert.lacksClasses( tabs[ 0 ], "ui-tab" );
|
||||||
assert.hasClasses( tabs[ 1 ], "ui-tab" );
|
assert.lacksClasses( tabs[ 1 ], "ui-tab" );
|
||||||
assert.hasClasses( tabs[ 2 ], "ui-tab" );
|
assert.lacksClasses( tabs[ 2 ], "ui-tab" );
|
||||||
|
|
||||||
assert.equal( tabs.length, 3, "There are exactly three tabs" );
|
assert.equal( tabs.length, 3, "There are exactly three tabs" );
|
||||||
assert.hasClasses( anchors[ 0 ], "ui-tabs-anchor" );
|
assert.hasClasses( anchors[ 0 ], "ui-tabs-anchor" );
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<script src="../../../external/requirejs/require.js"></script>
|
<script src="../../../external/requirejs/require.js"></script>
|
||||||
<script src="../../lib/css.js" data-modules="core tooltip"></script>
|
<script src="../../lib/css.js" data-modules="core tooltip"></script>
|
||||||
<script src="../../lib/bootstrap.js" data-widget="tooltip" data-no-back-compat="true"></script>
|
<script src="../../lib/bootstrap.js" data-widget="tooltip"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
@ -273,7 +273,7 @@ if ( $.expr && $.expr.pseudos && $.expr.pseudos.animated ) {
|
|||||||
} )( $.expr.pseudos.animated );
|
} )( $.expr.pseudos.animated );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $.uiBackCompat !== false ) {
|
if ( $.uiBackCompat === true ) {
|
||||||
$.extend( $.effects, {
|
$.extend( $.effects, {
|
||||||
|
|
||||||
// Saves a set of properties in a data storage
|
// Saves a set of properties in a data storage
|
||||||
@ -759,7 +759,7 @@ $.fn.extend( {
|
|||||||
// as toggle can be either show or hide depending on element state
|
// as toggle can be either show or hide depending on element state
|
||||||
args.mode = modes.shift();
|
args.mode = modes.shift();
|
||||||
|
|
||||||
if ( $.uiBackCompat !== false && !defaultMode ) {
|
if ( $.uiBackCompat === true && !defaultMode ) {
|
||||||
if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) {
|
if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) {
|
||||||
|
|
||||||
// Call the core method to track "olddisplay" properly
|
// Call the core method to track "olddisplay" properly
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var effect;
|
var effect;
|
||||||
if ( $.uiBackCompat !== false ) {
|
if ( $.uiBackCompat === true ) {
|
||||||
effect = $.effects.define( "transfer", function( options, done ) {
|
effect = $.effects.define( "transfer", function( options, done ) {
|
||||||
$( this ).transfer( options, done );
|
$( this ).transfer( options, done );
|
||||||
} );
|
} );
|
||||||
|
@ -287,7 +287,7 @@ $.widget( "ui.button", {
|
|||||||
} );
|
} );
|
||||||
|
|
||||||
// DEPRECATED
|
// DEPRECATED
|
||||||
if ( $.uiBackCompat !== false ) {
|
if ( $.uiBackCompat === true ) {
|
||||||
|
|
||||||
// Text and Icons options
|
// Text and Icons options
|
||||||
$.widget( "ui.button", $.ui.button, {
|
$.widget( "ui.button", $.ui.button, {
|
||||||
|
@ -930,7 +930,7 @@ $.widget( "ui.dialog", {
|
|||||||
|
|
||||||
// DEPRECATED
|
// DEPRECATED
|
||||||
// TODO: switch return back to widget declaration at top of file when this is removed
|
// TODO: switch return back to widget declaration at top of file when this is removed
|
||||||
if ( $.uiBackCompat !== false ) {
|
if ( $.uiBackCompat === true ) {
|
||||||
|
|
||||||
// Backcompat for dialogClass option
|
// Backcompat for dialogClass option
|
||||||
$.widget( "ui.dialog", $.ui.dialog, {
|
$.widget( "ui.dialog", $.ui.dialog, {
|
||||||
|
@ -463,7 +463,7 @@ $.ui.ddmanager = {
|
|||||||
|
|
||||||
// DEPRECATED
|
// DEPRECATED
|
||||||
// TODO: switch return back to widget declaration at top of file when this is removed
|
// TODO: switch return back to widget declaration at top of file when this is removed
|
||||||
if ( $.uiBackCompat !== false ) {
|
if ( $.uiBackCompat === true ) {
|
||||||
|
|
||||||
// Backcompat for activeClass and hoverClass options
|
// Backcompat for activeClass and hoverClass options
|
||||||
$.widget( "ui.droppable", $.ui.droppable, {
|
$.widget( "ui.droppable", $.ui.droppable, {
|
||||||
|
@ -1113,7 +1113,7 @@ $.ui.plugin.add( "resizable", "ghost", {
|
|||||||
|
|
||||||
// DEPRECATED
|
// DEPRECATED
|
||||||
// TODO: remove after 1.12
|
// TODO: remove after 1.12
|
||||||
if ( $.uiBackCompat !== false && typeof that.options.ghost === "string" ) {
|
if ( $.uiBackCompat === true && typeof that.options.ghost === "string" ) {
|
||||||
|
|
||||||
// Ghost option
|
// Ghost option
|
||||||
that.ghost.addClass( this.options.ghost );
|
that.ghost.addClass( this.options.ghost );
|
||||||
|
@ -554,7 +554,7 @@ $.widget( "ui.spinner", {
|
|||||||
|
|
||||||
// DEPRECATED
|
// DEPRECATED
|
||||||
// TODO: switch return back to widget declaration at top of file when this is removed
|
// TODO: switch return back to widget declaration at top of file when this is removed
|
||||||
if ( $.uiBackCompat !== false ) {
|
if ( $.uiBackCompat === true ) {
|
||||||
|
|
||||||
// Backcompat for spinner html extension points
|
// Backcompat for spinner html extension points
|
||||||
$.widget( "ui.spinner", $.ui.spinner, {
|
$.widget( "ui.spinner", $.ui.spinner, {
|
||||||
|
@ -909,7 +909,7 @@ $.widget( "ui.tabs", {
|
|||||||
|
|
||||||
// DEPRECATED
|
// DEPRECATED
|
||||||
// TODO: Switch return back to widget declaration at top of file when this is removed
|
// TODO: Switch return back to widget declaration at top of file when this is removed
|
||||||
if ( $.uiBackCompat !== false ) {
|
if ( $.uiBackCompat === true ) {
|
||||||
|
|
||||||
// Backcompat for ui-tab class (now ui-tabs-tab)
|
// Backcompat for ui-tab class (now ui-tabs-tab)
|
||||||
$.widget( "ui.tabs", $.ui.tabs, {
|
$.widget( "ui.tabs", $.ui.tabs, {
|
||||||
|
@ -505,7 +505,7 @@ $.widget( "ui.tooltip", {
|
|||||||
|
|
||||||
// DEPRECATED
|
// DEPRECATED
|
||||||
// TODO: Switch return back to widget declaration at top of file when this is removed
|
// TODO: Switch return back to widget declaration at top of file when this is removed
|
||||||
if ( $.uiBackCompat !== false ) {
|
if ( $.uiBackCompat === true ) {
|
||||||
|
|
||||||
// Backcompat for tooltipClass option
|
// Backcompat for tooltipClass option
|
||||||
$.widget( "ui.tooltip", $.ui.tooltip, {
|
$.widget( "ui.tooltip", $.ui.tooltip, {
|
||||||
|
Loading…
Reference in New Issue
Block a user