mattdesl / dom-css

fast dom CSS styling
MIT License
152 stars 13 forks source link

removing 'use strict'; line #5

Closed HenrikJoreteg closed 9 years ago

HenrikJoreteg commented 9 years ago

hey, thanks for this module, super handy! Just ran into a confusing issue where it would say each wasn't defined in chrome when using this with webpack module hot loading. Presumably it's because webpack will use eval to isolate code blocks during dev builds and according to this: http://whereswalden.com/2011/01/10/new-es5-strict-mode-support-new-vars-created-by-strict-mode-eval-code-are-local-to-that-code-only/ that means eval'ed use strict code can't create variable outside of its scope.

Additionally weird is that the error would only appear with devtools closed.

All that said, here was the end result:

https://cloudup.com/cwzFJUJo8sH

Anyway, if there wasn't a particular reason for having the 'use strict' statement here, i figured i'd offer to remove it since this resolved the issue for me and possibly someone else using webpack would have similar issues.

mattdesl commented 9 years ago

Hmm that's weird. It was added as an optimization for V8 but I'm not sure it even really applies, and 99% confident it is a premature optimization anyways.

But you will probably see the same pattern crop up in other modules here and there. Maybe there's something webpack can do to fix..?

Merged. Good to hear these modules are working with webpack! :+1: