Skip to content

Docs: Clarify wording around deprecated/removed methods #208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
6 changes: 3 additions & 3 deletions src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ for ( findProp in oldFind ) {

// The number of elements contained in the matched element set
jQuery.fn.size = function() {
migrateWarn( "jQuery.fn.size() is deprecated; use the .length property" );
migrateWarn( "jQuery.fn.size() is deprecated and removed, use the .length property" );
return this.length;
};

Expand Down Expand Up @@ -94,6 +94,6 @@ migrateWarnProp( jQuery, "unique", jQuery.uniqueSort,

// Now jQuery.expr.pseudos is the standard incantation
migrateWarnProp( jQuery.expr, "filters", jQuery.expr.pseudos,
"jQuery.expr.filters is now jQuery.expr.pseudos" );
"jQuery.expr.filters is deprecated, use jQuery.expr.pseudos" );
migrateWarnProp( jQuery.expr, ":", jQuery.expr.pseudos,
"jQuery.expr[\":\"] is now jQuery.expr.pseudos" );
"jQuery.expr[':'] is deprecated, use jQuery.expr.pseudos" );
2 changes: 1 addition & 1 deletion src/traversing.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack;

jQuery.fn.andSelf = function() {
migrateWarn( "jQuery.fn.andSelf() replaced by jQuery.fn.addBack()" );
migrateWarn( "jQuery.fn.andSelf() is deprecated and removed, use jQuery.fn.addBack()" );
return oldSelf.apply( this, arguments );
};
10 changes: 5 additions & 5 deletions warnings.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ To allow developers to identify and fix compatibility issues when migrating olde

The production (compressed) version of the plugin does not generate warnings. To continue using jQuery code that has compatibility issues without making any changes and without console messages, simply include the production version in the file rather than the development version. See the [README](README.md) for download instructions.

All messages generated by this plugin start with the text "JQMIGRATE" for easy identification. The warning messages, causes, and remediation instructions are listed below.
All messages generated by this plugin start with the text "JQMIGRATE" for easy identification. The warning messages, causes, and remediation instructions are listed below. Items listed as **deprecated and removed** must be changed before the code will work properly without the Migrate plugin. Items listed as only **deprecated** are still supported by the current version but no longer considered a good practice, and may be removed in the future.

### JQMIGRATE: Migrate is installed, version X
### JQMIGRATE: Migrate is installed with logging active, version X
Expand Down Expand Up @@ -67,13 +67,13 @@ This is _not_ a warning, but a console log message the plugin shows when it firs

**Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0.

### JQMIGRATE: jQuery.fn.andSelf() replaced by jQuery.fn.addBack()
### JQMIGRATE: jQuery.fn.andSelf() is deprecated and removed, use jQuery.fn.addBack()

**Cause**: The `.andSelf()` method has been renamed to `.addBack()` as of jQuery 1.9 to better reflect its purpose of adding back the previous set of results. The old alias was removed in jQuery 3.0.

**Solution**: Replace any use of `.andSelf()` with `.addBack()`.

### JQMIGRATE: jQuery.fn.size() is deprecated; use the .length property
### JQMIGRATE: jQuery.fn.size() is deprecated and removed, use the .length property

**Cause**: The `.size()` method returns the number of elements in the current jQuery object, but duplicates the more-efficient `.length` property which provides the same functionality. As of jQuery 1.9 the `.length` property is the preferred way to retrieve this value. jQuery 3.0 no longer contains the `.size()` method.

Expand Down Expand Up @@ -167,8 +167,8 @@ See jQuery-ui [commit](https://github.com/jquery/jquery-ui/commit/c0093b599fcd58

**Solution**: Replace all uses of `jQuery.unique` with `jQuery.uniqueSort` which is the same function with a better name.

### JQMIGRATE: jQuery.expr[':'] is jQuery.expr.pseudos
### JQMIGRATE: jQuery.expr.filters is now jQuery.expr.pseudos
### JQMIGRATE: jQuery.expr[':'] is deprecated, use jQuery.expr.pseudos
### JQMIGRATE: jQuery.expr.filters is deprecated, use jQuery.expr.pseudos

**Cause:** The standard way to add new custom selectors through jQuery is `jQuery.expr.pseudos`. These two other aliases are deprecated, although they still work as of jQuery 3.0.

Expand Down