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

[Ref #15881] Use Explicit JS Variable Declarations rather than Chained #15923

Merged
merged 1 commit into from Feb 26, 2015

Conversation

kkirsche
Copy link
Contributor

[Ref #15881] Use Explicit Values for javascript variables rather than chained ones.

From #15881 (comment)

This should help individuals who are not well versed with ASI (Automatic Semicolon Insertion)

[Ref twbs#15881] Use Explicit Values for javascript variables rather than chained ones.

From twbs#15881 (comment)
@kkirsche kkirsche changed the title [Ref #15881] Use Explicit JS Variable Values rather than Chained [Ref #15881] Use Explicit JS Variable Declarations rather than Chained Feb 25, 2015
@hnrch02 hnrch02 added the js label Feb 25, 2015
@hnrch02
Copy link
Collaborator

hnrch02 commented Feb 25, 2015

The things is, UglifyJS doesn't compress this to one assignment chain:

this.type = null, this.options = null, this.enabled = null, this.timeout = null, this.hoverState = null, this.$element = null

whereas Closure is smart enough to do this:

this.$element = this.hoverState = this.timeout = this.enabled = this.options = this.type = null

So we'd have a slight increase in file size but I guess it a) isn't much and b) wouldn't matter with gzip.

@cvrebert @XhmikosR What do you guys think?

@XhmikosR
Copy link
Member

Plus, with v4 uglify won't be used so this won't matter.

I'm personally in favor of readability.

@twbs-savage
Copy link

Tests passed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: CONFIRMED

Commit: 238be65
Build details: https://travis-ci.org/twbs-savage/bootstrap/builds/52164851

(Please note that this is a fully automated comment.)

hnrch02 added a commit that referenced this pull request Feb 26, 2015
[Ref #15881] Use Explicit JS Variable Declarations rather than Chained
@hnrch02 hnrch02 merged commit cac6cfc into twbs:master Feb 26, 2015
@kkirsche kkirsche deleted the useExplicitVariableDeclaration branch March 2, 2015 04:02
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.

None yet

4 participants