Skip to content
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

Closed
wants to merge 1 commit into from
Closed

v4 - Unification JS style in _jQueryInterface #17531

wants to merge 1 commit into from

Conversation

vsn4ik
Copy link
Contributor

@vsn4ik vsn4ik commented Sep 8, 2015

No description provided.

@@ -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)
Copy link
Collaborator

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
Copy link
Member

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.

Copy link
Member

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

Copy link
Member

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.

@mdo
Copy link
Member

mdo commented Oct 29, 2016

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.

@Johann-S
Copy link
Member

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

@bardiharborow
Copy link
Member

bardiharborow commented Oct 30, 2016

Advise against merging. Removing $element causes more cycles and a slightly larger file size. There are a few style fixes which are okay, but I believe those those are fixed in my style/linting PR anyway (#21005).

@mdo
Copy link
Member

mdo commented Nov 25, 2016

Closing out then. Holler if we need to re-open or do anything else here <3.

@mdo mdo closed this Nov 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants