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

Breaks when minified #55

Closed
ozairabbas opened this issue Jul 23, 2014 · 8 comments
Closed

Breaks when minified #55

ozairabbas opened this issue Jul 23, 2014 · 8 comments

Comments

@ozairabbas
Copy link

Brakes at 'prevTabIndex is not defined at link'

Can you please add the minified version

@isteven
Copy link
Owner

isteven commented Jul 23, 2014

hi @ozairabbas ,

May I know which minifier did you use? Have you tried to use http://jscompress.com?

@isteven isteven changed the title Brakes when minified Breaks when minified Jul 25, 2014
@isteven isteven closed this as completed Jul 29, 2014
@msepahvand
Copy link

I just ran into the same problem, I'm using the ASP.NET web optimizations minification and bundling package (MVC5), I've included dozens of other angular libraries and they all seem to work fine, keeps giving an error on 'prevTabIndex', any ideas? Just skimming through thr code for thr directive it seems to be written minification safe.

@isteven isteven reopened this Aug 4, 2014
@msepahvand
Copy link

This is peculiar, I just ran a small test with the same asp.net minifier and everything worked fine, I'll take another look at it when I get home.

@isteven
Copy link
Owner

isteven commented Aug 4, 2014

I've manually checked the code.. looks ok to me. I suggest to minify it manually if possible.

Btw make sure that you get the latest version.

@rockstardev
Copy link

Just to add that I'm also using ASP.NET minification (System.Web.Optimization) and I have 0 problems with this component. It's probably some of the JS components that you are using that's causing the problem - I've had quite few issues when combining Jquery, angular and different angular components in single bundles (some just don't play nicely with each other).

@msepahvand
Copy link

There IS a slight problem though, I just figured it out. I was bundling this directive along with my own scripts, and I always code in <strict mode>, that in combination with some poor formatting in the directive code was making the bundler unhappy, inspecting the network request for the bundle I noticed this:

Minification failed. Returning unminified contents.
(760,25-37): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: prevTabIndex
(756,21-33): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: prevTabIndex
(777,25-37): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: prevTabIndex
(773,21-33): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: prevTabIndex
(738,21-24): run-time error JS1294: Strict-mode does not allow ++ or -- on certain objects: ctr
(735,17-20): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: ctr
(710,13-28): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: genRandomString
(694,33-37): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: temp
(669,17-28): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: helperIndex
(634,17-27): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: targetsArr
(614,25-42): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: helperItemsLength
(611,31-32): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: i
(611,100-101): run-time error JS1294: Strict-mode does not allow ++ or -- on certain objects: i
(596,21-38): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: helperItemsLength
(595,21-32): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: helperItems
(551,17-26): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: clickedEl
(492,29-32): run-time error JS1294: Strict-mode does not allow ++ or -- on certain objects: ctr
(466,17-20): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: ctr
(424,17-29): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: prevTabIndex
(349,49-64): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: inputModelIndex
(355,49-64): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: inputModelIndex
(368,49-64): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: inputModelIndex
(375,49-64): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: inputModelIndex
(417,21-36): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: inputModelIndex
(290,17-22): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: index
(135,13-30): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: helperItemsLength
(134,13-24): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: helperItems
(133,13-25): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: prevTabIndex

The code is riddled with implicitly defined variables, Tbh I personally never understood this practice, I mean your code will most probably work fine but Jesus it will look hideous. Inspecting the JsHint warnings in Visual Studio gives you more of an insight, for example:
<Assignment to an implictly declared global variable genRandomString>.

In my case the 2 workarounds were:

  1. Stop using <strict-mode>.
  2. Clean up the few global variables, and scoping issues.

I opted the latter, only took about 5/6 minutes thanks to JsHint.

HTH.

@isteven
Copy link
Owner

isteven commented Aug 5, 2014

Hi @ElDuderino87 ,

Thanks for pointing this out. Will consider using strict mode for the next release.

@msepahvand
Copy link

@isteven You're most welcome. Thank you for the awesome directive :).

@isteven isteven closed this as completed Aug 5, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants