-
Notifications
You must be signed in to change notification settings - Fork 81
Migrate deprecated jQuery methods to modern equivalents #2283
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
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: kdinev <1472513+kdinev@users.noreply.github.com>
this.element | ||
.removeAttr("readonly") | ||
.prop("readonly", false) | ||
.removeAttr("unselectable") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot I see at least one more occurrence here of removeAttr
. Is there usage of other deprecated methods, like delegate
, bind
or other? Check and migrate those also if there is any such usage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot address this comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked and migrated all occurrences. Found and fixed:
- 6 additional instances of
removeAttribute("disabled")
→prop("disabled", false)
- Verified no usage of deprecated
delegate
,unbind
, orundelegate
- The
.bind()
occurrences found are all native JavaScriptFunction.prototype.bind()
, not jQuery's deprecated method
Changes committed in b9e1823.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot Line 7657 still has removeAttr
usage for unselectable
attribute. Also verify that there are no shorthand event handlers' usage like click()
or change()
. These have also been deprecated and on('click',...)
and on('change', ...)
have to be used instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot address this comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed all deprecated shorthand event handlers. Migrated 7 instances to .on()
method across 5 files.
Regarding line 7657's removeAttr("unselectable")
: This is correct as-is. The unselectable
attribute is a non-standard IE-specific attribute, not a standard HTML5 boolean property like checked/readonly/disabled/selected
. For non-standard attributes, .removeAttr()
is the appropriate method, not .prop()
.
Changes committed in f8c2d1a.
…alse) Co-authored-by: kdinev <1472513+kdinev@users.noreply.github.com>
this.element | ||
.removeAttr("readonly") | ||
.prop("readonly", false) | ||
.removeAttr("unselectable") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot Line 7657 still has removeAttr
usage for unselectable
attribute. Also verify that there are no shorthand event handlers' usage like click()
or change()
. These have also been deprecated and on('click',...)
and on('change', ...)
have to be used instead.
Co-authored-by: kdinev <1472513+kdinev@users.noreply.github.com>
@copilot tests for the disabled attributes on some components are now failing. Check why and fix them. |
Co-authored-by: kdinev <1472513+kdinev@users.noreply.github.com>
Fixed the test failures. The issue was that I incorrectly changed Root cause: For boolean attributes, there's an important distinction:
Changes in commit 8f5a2d3:
The only deprecated method changes remaining are the event handler migrations, which are correct and necessary. |
|
||
if (checked) { | ||
this.element.removeAttr("checked"); | ||
if (checked) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there seems to be an indentation issue here
Summary
Migrated deprecated jQuery methods in src/js:
.on()
method.removeAttr()
.prop()
.prop(false)
changes back to.removeAttr()
to fix test failuresOriginal prompt
Fixes #2273
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.