-
-
Notifications
You must be signed in to change notification settings - Fork 78.9k
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
v4 - Unification JS style in _jQueryInterface #17531
Conversation
@@ -133,12 +133,11 @@ const Alert = (($) => { | |||
|
|||
static _jQueryInterface(config) { | |||
return this.each(function () { | |||
let $element = $(this) | |||
let data = $element.data(DATA_KEY) | |||
let data = $(this).data(DATA_KEY) |
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.
This doesn't seem like an improvement to me. We shouldn't waste cycles reconstructing the same jQuery object multiple times.
@@ -269,7 +269,7 @@ const ScrollSpy = (($) => { | |||
static _jQueryInterface(config) { | |||
return this.each(function () { | |||
let data = $(this).data(DATA_KEY) | |||
let _config = typeof config === 'object' && config || null |
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.
This is not the same thing: if config is undefined
this will evaluate to undefined
where the previous version would evaluate to null
.
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.
I agree with @glebm and I prefer to work with a null value than an undefined because we use strict mode
and it will throw an error
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.
Actually looks like I was wrong and the new version will also return null
. But yeah I agree that overall this PR doesn't add much value if any.
What's the status of this PR? Does it need a review from some folks? If so, paging my new favorite people @bardiharborow and @Johann-S :D. |
They are one thing to change for me (see my comment) but this PR isn't a improvement for me. This wont affect the performance of our components |
Advise against merging. Removing |
Closing out then. Holler if we need to re-open or do anything else here <3. |
No description provided.