Skip to content

Commit 4295e65

Browse files
committed
Docs: Add descriptions for .andSelf() and .size() deprecations
Ref #89 Ref #60 Ref #62
1 parent 683b9b3 commit 4295e65

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/core.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,6 @@ jQuery.sub = function() {
132132

133133
// The number of elements contained in the matched element set
134134
jQuery.fn.size = function() {
135-
migrateWarn( "jQuery.fn.size is deprecated; use the length property" );
135+
migrateWarn( "jQuery.fn.size() is deprecated; use the .length property" );
136136
return this.length;
137137
};

warnings.md

+12
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,15 @@ $(document).ajaxStart(function(){ $("#status").text("Ajax started"); });
166166

167167
**Solution**: If you are creating HTML that absolutely requires leading text, use `$.parseHTML` and pass the results to `$()`.
168168

169+
### JQMIGRATE: jQuery.fn.andSelf() replaced by jQuery.fn.addBack()
170+
171+
**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.
172+
173+
**Solution**: Replace any use of `.andSelf()` with `.addBack()`.
174+
175+
### JQMIGRATE: jQuery.fn.size() is deprecated; use the .length property
176+
177+
**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.
178+
179+
**Solution**: Replace any use of `.size()` with `.length`.
180+

0 commit comments

Comments
 (0)