Skip to content

bootstrap-dropdown.js clearMenus() needs ; at the end #3057

@englishextra

Description

@englishextra

bootstrap-dropdown.js when minified with JSMin::minify produces error in Firefox error console saying clearMenus()needs ;

on line:

  clearMenus()
  !isActive && $parent.toggleClass('open')

if in source code this is corrected -- no error in minified version

Activity

fat

fat commented on Apr 15, 2012

@fat
Member

nope - that's a bug in jsmin. Probably should let @douglascrockford know about it though. thanks!

edit: The code had already been changed to an if when i suggested the jsmin issue be filed as a bug. Bootstrap and jsmin play very well together.

douglascrockford

douglascrockford commented on Apr 15, 2012

@douglascrockford

That is insanely stupid code. I am not going to dumb down JSMin for this case.

douglascrockford

douglascrockford commented on Apr 15, 2012

@douglascrockford

TC39 is considering the use of ! as an infix operator. This code will break in the future. Fix it now. Learn to use semicolons properly. ! is not intended to be a statement separator. ; is.

fat

fat commented on Apr 15, 2012

@fat
Member

i have learned to use them, that's why there isn't one present.

ghost

ghost commented on Apr 15, 2012

@ghost

i have learned to use them, that's why there isn't one present.

Zzzzing!

backspaces

backspaces commented on Apr 15, 2012

@backspaces

Any language with syntax arguments is clearly broken, compilers deal with this. Dart, I guess.

stephenhandley

stephenhandley commented on Apr 15, 2012

@stephenhandley
adrusi

adrusi commented on Apr 15, 2012

@adrusi

if you really wanted to get rid of the semicolons (though I really don't see the point of that, is it really that bad that it's worth worrying about it?), ! ... && in this context an be replaced with ... ||.

coolaj86

coolaj86 commented on Apr 15, 2012

@coolaj86

coffeescript ftw?

otherwise, if you're doing real javascript, do it right?

p.s. (I'm not a coffeescripter yet, but it looks more and more like the right tool every day)

zacstewart

zacstewart commented on Apr 15, 2012

@zacstewart

i have learned to use them, that's why there isn't one present.

Wow. I've read @fat's reasoning for not using semis, but when it comes to actual problems cropping up in the real world, why does "aesthetic" preference take precedence? Why write something like

!function( $ ){
...
}( jQuery )

just to avoid placing a semi a the end?

! is clearly not meant to do this job. It's a bool operator. Does the fact that the symbol looks prettier really matter?

I am well aware that you can hack your way around this and keep saying "nuh uh!" instead of admitting that it's ill conceived and improving, but seriously: making a snippy response like that just makes you look like an immature hipster smarting off to a battle worn professional. @douglascrockford is on the technical committee for fuck's sake.

dubcanada

dubcanada commented on Apr 15, 2012

@dubcanada

This has nothing to do with being a hipster, and I have no idea why anyone seems to think it does. The simple fact is this code runs on ALL browsers without issue. Regardless if the fact that X version of javascript somewhere in the Y future will stop supporting it (maybe) does NOT give a reason for a javascript minifier to NOT correctly minify it.

Also if Crockford thinks this is insanely stupid code and he is on the technical committee then why is this insanely stupid code even possible?

ghost

ghost commented on Apr 15, 2012

@ghost

I know who @douglascrockford is but who is this @fat fellow?

zacstewart

zacstewart commented on Apr 15, 2012

@zacstewart

Also if Crockford thinks this is insanely stupid code and he is on the technical committee then why is this insanely stupid code even possible?

Being on the technical committee in 2012 for a language initially created 16 years ago probably doesn't grant him authority to radically change things like that.

275 remaining items

greg0ire

greg0ire commented on May 25, 2013

@greg0ire
vpatryshev

vpatryshev commented on Jun 27, 2013

@vpatryshev

"The only true law is that which leads to freedom" (R.Bach)

Any style question starting with "why don't you..." has an easy answer: "because this is my style".

If you like semis, you use them; if you don't, you don't use them. What can be easier?

chrisharrison

chrisharrison commented on Jun 27, 2013

@chrisharrison

Vlad,

That would be perfectly true if this was just a style issue. And I'd be
100% behind you if that was the case. Unfortunately this is about much more
than styling. JavaScript needs the semicolons to function logically.
On 27 Jun 2013 06:02, "Vlad Patryshev" notifications@github.com wrote:

"The only true law is that which leads to freedom" (R.Bach)

Any style question starting with "why don't you..." has an easy answer:
"because this is my style".

If you like semis, you use them; if you don't, you don't use them. What
can be easier?


Reply to this email directly or view it on GitHubhttps://github.com//issues/3057#issuecomment-20083328
.

j1n6

j1n6 commented on Jun 30, 2013

@j1n6

There might be something else we want to focus on, leave the semicolons alone.

semicolons

MathRobin

MathRobin commented on Jul 24, 2013

@MathRobin

Please use semicolons. Readbility is important. Maybe, you, @fat, know how and when using semicolon but it's not the case for all. Rookies, kiddies and even experts could need semicolon to read the code. So, please, add it for readability...

torifat

torifat commented on Feb 24, 2014

@torifat

Why don't we just get rid of indentations too??? It's really OPTIONAL. And, also MINIMALISTIC.

All the current IDE's are doing it wrong. Either they should give diff background colors to the different scopes or show them AII (AUTO INDENT INSERTED).

locked and limited conversation to collaborators on Jun 10, 2014
added a commit that references this issue on Aug 14, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @dbarros@tantalor@stephenhandley@madrobby@jed

      Issue actions

        bootstrap-dropdown.js clearMenus() needs ; at the end · Issue #3057 · twbs/bootstrap