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

Creates attributes with undefined value #10

Open
hybridwebdev opened this issue Nov 26, 2017 · 0 comments
Open

Creates attributes with undefined value #10

hybridwebdev opened this issue Nov 26, 2017 · 0 comments

Comments

@hybridwebdev
Copy link

hybridwebdev commented Nov 26, 2017

So I've found an issue and wondering if you can point me in the right direction.
Say for example you do something like this:
var rules = $.stylesheet('.selector', {margin-top, padding-top, padding-bottom});
And do a dump of rules, if the selector did not have values set for any of the passed in css attributes, then those fields will be blank. Eg:
console.log(rules);
then you'll see
margin-top:'undefined', padding-top:'undefined', padding-bottom:'undefined',
It's not a huge deal, but it means if you're concerned about clean code, then you have to iterate through the object and do a type check/remove undefined fields. So what I'm wondering, is where I'd need to look in the script to fix this issue. The desired result would be to not have the fields returned in the object if they have no value. Eg the above example would result in:
{}

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

1 participant