Skip to content

Commit

Permalink
Core: Remove deprecated jQuery APIs
Browse files Browse the repository at this point in the history
Fixes gh-4056
Closes gh-4364
  • Loading branch information
mgol committed Apr 29, 2019
1 parent 6f2fae7 commit 58f0c00
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 497 deletions.
4 changes: 0 additions & 4 deletions src/css.js
Expand Up @@ -199,10 +199,6 @@ jQuery.extend( {
}
},

// Add in properties whose names you wish to fix before
// setting or getting the value
cssProps: {},

// Get and set the style property on a DOM Node
style: function( elem, name, value, extra ) {

Expand Down
9 changes: 4 additions & 5 deletions src/css/finalPropName.js
@@ -1,7 +1,6 @@
define( [
"../var/document",
"../core"
], function( document, jQuery ) {
"../var/document"
], function( document ) {

"use strict";

Expand All @@ -24,9 +23,9 @@ function vendorPropName( name ) {
}
}

// Return a potentially-mapped jQuery.cssProps or vendor prefixed property
// Return a potentially-mapped vendor prefixed property
function finalPropName( name ) {
var final = jQuery.cssProps[ name ] || vendorProps[ name ];
var final = vendorProps[ name ];

if ( final ) {
return final;
Expand Down
24 changes: 0 additions & 24 deletions src/deprecated.js
Expand Up @@ -71,28 +71,4 @@ jQuery.holdReady = function( hold ) {
jQuery.ready( true );
}
};
jQuery.isArray = Array.isArray;
jQuery.parseJSON = JSON.parse;
jQuery.nodeName = nodeName;
jQuery.isFunction = isFunction;
jQuery.isWindow = isWindow;
jQuery.camelCase = cssCamelCase;
jQuery.type = toType;

jQuery.now = Date.now;

jQuery.isNumeric = function( obj ) {

// As of jQuery 3.0, isNumeric is limited to
// strings and numbers (primitives or objects)
// that can be coerced to finite numbers (gh-2662)
var type = jQuery.type( obj );
return ( type === "number" || type === "string" ) &&

// parseFloat NaNs numeric-cast false positives ("")
// ...but misinterprets leading-number strings, particularly hex literals ("0x...")
// subtraction forces infinities to NaN
!isNaN( obj - parseFloat( obj ) );
};

} );
27 changes: 0 additions & 27 deletions test/unit/css.js
Expand Up @@ -1108,23 +1108,6 @@ QUnit.test( "box model properties incorrectly returning % instead of px, see #10
assert.equal( el2.css( "marginLeft" ), "100px", "css('marginLeft') returning incorrect pixel value, see #12088" );
} );

QUnit.test( "jQuery.cssProps behavior, (bug #8402)", function( assert ) {
assert.expect( 2 );

var div = jQuery( "<div>" ).appendTo( document.body ).css( {
"position": "absolute",
"top": 0,
"left": 10
} );
jQuery.cssProps.top = "left";
assert.equal( div.css( "top" ), "10px", "the fixed property is used when accessing the computed style" );
div.css( "top", "100px" );
assert.equal( div[ 0 ].style.left, "100px", "the fixed property is used when setting the style" );

// cleanup jQuery.cssProps
jQuery.cssProps.top = undefined;
} );

QUnit.test( "widows & orphans #8936", function( assert ) {

var $p = jQuery( "<p>" ).appendTo( "#qunit-fixture" );
Expand Down Expand Up @@ -1713,13 +1696,6 @@ QUnit.test( "Do not throw on frame elements from css method (#15098)", function(
( function() {
var vendorPrefixes = [ "Webkit", "Moz", "ms" ];

function resetCssPropsFor( name ) {
delete jQuery.cssProps[ name ];
jQuery.each( vendorPrefixes, function( index, prefix ) {
delete jQuery.cssProps[ prefix + name[ 0 ].toUpperCase() + name.slice( 1 ) ];
} );
}

QUnit.test( "Don't default to a cached previously used wrong prefixed name (gh-2015)", function( assert ) {

// Note: this test needs a property we know is only supported in a prefixed version
Expand Down Expand Up @@ -1753,9 +1729,6 @@ QUnit.test( "Do not throw on frame elements from css method (#15098)", function(

assert.expect( !!appearanceName + !!transformName + 1 );

resetCssPropsFor( "appearance" );
resetCssPropsFor( "transform" );

elem = jQuery( "<div/>" )
.css( {
msAppearance: "none",
Expand Down
11 changes: 10 additions & 1 deletion test/unit/data.js
Expand Up @@ -755,6 +755,7 @@ QUnit.test( ".data supports interoperable hyphenated/camelCase get/set of proper

QUnit.test( ".data supports interoperable removal of hyphenated/camelCase properties", function( assert ) {
var div = jQuery( "<div/>", { id: "hyphened" } ).appendTo( "#qunit-fixture" ),
rdashAlpha = /-([a-z])/g,
datas = {
"non-empty": "a string",
"empty-string": "",
Expand All @@ -773,11 +774,19 @@ QUnit.test( ".data supports interoperable removal of hyphenated/camelCase proper

assert.expect( 27 );

function fcamelCase( all, letter ) {
return letter.toUpperCase();
}

jQuery.each( datas, function( key, val ) {
div.data( key, val );

assert.deepEqual( div.data( key ), val, "get: " + key );
assert.deepEqual( div.data( jQuery.camelCase( key ) ), val, "get: " + jQuery.camelCase( key ) );
assert.deepEqual(
div.data( key.replace( rdashAlpha, fcamelCase ) ),
val,
"get: " + key.replace( rdashAlpha, fcamelCase )
);

div.removeData( key );

Expand Down

0 comments on commit 58f0c00

Please sign in to comment.