-
-
Notifications
You must be signed in to change notification settings - Fork 70
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
Code cleanup, DRY #104
Comments
As far as I know the package is used in setups which still support IE 11, where the There's no other reason for that. |
Ok... But still code could be optimized using array
UPD. same problem with https://github.com/jsdom/cssstyle/blob/master/lib/allProperties.js where is also 500 lines of duplicated code |
@fatfisz hmm... is there a case for using this package in a browser? AFAIK this package is meant to be used in a nodejs environment only - as to replicate existing functionality you get in a browser. I don't know why we would try to support IE. |
I honestly don't remember right now and for me it's not something super important, so I don't think we have to support IE. IMO we can just wait until someone complains and even then only add a note to README about the need to polyfill One thing though: with changes such as this that don't really add any new functionality and are only about a perceived optimization, I'd love to have some benchmarks or some clear goals for the project, e.g. if the project aims to be as small as possible or if it aims to be as fast as possible. With all that said, my gut feeling tells me that the best optimization is to put everything into |
@fatfisz @jsakas BTW. found another huge overhead -
|
@sirian Good find, could you make a separate PR for that? Adding "lib" to "files" in |
Updated PR #105 using Set constructor |
@sirian I have merged your changes into master to reduce the file size, but then realized that they are overwritten when running the download script Oversight on my part (its late) so we need to fix this script to use new Set syntax I can publish a new version of the package. This probably means that webkit and default properties will end up being the same file again. |
Look at
https://github.com/jsdom/cssstyle/blob/master/lib/allExtraProperties.js
https://github.com/jsdom/cssstyle/blob/master/lib/allProperties.js
Why not simply pass all of them in Set constructor? Or at least use loop
UPD. or using arrays
These 2 files now takes 30kb of code. And 50% of this size is overhead of repeated 250 times
allExtraProperties.add()
and 500 timesextraProperties.add()
The text was updated successfully, but these errors were encountered: