Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/jquery/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,14 @@ if ( jQueryVersionSince( "3.3.0" ) ) {
"jQuery.isWindow() is deprecated"
);

migratePatchAndWarnFunc( jQuery, "now", Date.now, "now",
"jQuery.now() is deprecated; use Date.now()"
);

migratePatchAndWarnFunc( jQuery, "camelCase", jQuery.camelCase, "camelCase",
"jQuery.camelCase() is deprecated"
);

// Bind a function to a context, optionally partially applying any
// arguments.
// jQuery.proxy is deprecated to promote standards (specifically Function#bind)
Expand Down
29 changes: 29 additions & 0 deletions test/unit/jquery/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,35 @@ QUnit[ jQueryVersionSince( "3.3.0" ) ? "test" : "skip" ]( "jQuery.isWindow", fun
} );
} );

QUnit[ jQueryVersionSince( "3.3.0" ) ? "test" : "skip" ]( "jQuery.now", function( assert ) {
assert.expect( 2 );

expectWarning( assert, "now", 1, function() {
assert.ok( typeof jQuery.now() === "number", "jQuery.now is a function" );
} );
} );

QUnit[ jQueryVersionSince( "3.3.0" ) ? "test" : "skip" ]( "jQuery.camelCase()", function( assert ) {

var tests = {
"foo-bar": "fooBar",
"foo-bar-baz": "fooBarBaz",
"girl-u-want": "girlUWant",
"the-4th-dimension": "the-4thDimension",
"-o-tannenbaum": "OTannenbaum",
"-moz-illa": "MozIlla",
"-ms-take": "msTake"
};

assert.expect( 8 );

expectWarning( assert, "now", 7, function() {
jQuery.each( tests, function( key, val ) {
assert.equal( jQuery.camelCase( key ), val, "Converts: " + key + " => " + val );
} );
} );
} );

QUnit.test( "jQuery.unique", function( assert ) {
assert.expect( 2 );

Expand Down
12 changes: 12 additions & 0 deletions warnings.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,18 @@ This is _not_ a warning, but a console log message the plugin shows when it firs

**Solution**: Replace any use of `.size()` with `.length`.

### \[now\] JQMIGRATE: jQuery.now() is deprecated; use Date.now

**Cause:** The `jQuery.now()` method was a simple alias for `Date.now()`, which is now supported in all browsers supported by jQuery 3.0.

**Solution:** Replace any calls to `jQuery.now()` with `Date.now()`.

### \[camelCase\] JQMIGRATE: jQuery.camelCase() is deprecated

**Cause:** The `jQuery.camelCase()` method was a utility to convert dashed strings like `"background-color"` into camel-cased strings like `"backgroundColor"`. This method was never documented and is now deprecated.

**Solution:** Use a custom utility.

### \[data-camelCase\] JQMIGRATE: jQuery.data() always sets/gets camelCased names

**Cause:** The page is attempting to set or get a jQuery data item using kebab case, e.g. `my-data`, when a `my-data` item has been set directly on the jQuery data object. jQuery 3.0 always exclusively uses camel case, e.g., `myData`, when it accesses data items via the `.data()` API and does not find kebab case data in that object.
Expand Down
Loading