Add the ability to receive multiple css values from an object #716

merged 2 commits into from Sep 13, 2013

3 participants


This code adds the ability to fn.css() to get an array as a first input argument to read multiple css values from a DOM element. It returns a key/value map.

(this feature was also added to jQuery in v.1.9)


Ah, didn't see this pull request. I'll look into it! :)


I like the addition, but I think the implementation is quite repetitive. This probably better implemented treating a single string as a one item array, and using one code path.

I though about that too but in this case we would probably end up treating arrays with one element and the string property the same way and return the value instead of the string value. If I give an array to css() then I expect an object to be returned rather than a string (even if my given array just has one entry) WDYT?


There should be tests that prove that the resulting object doesn't contain properties that weren't given as part of the array to css(), even though an element might have these properties set.

In other words, a test that shows only requested properties are returned, not all.

@visiongeist visiongeist modified test for css([])
if css value is set on the dom element but not requested by the callee then the value must not be contained in the return object of fn.css()
@madrobby madrobby merged commit f54fd17 into madrobby:master Sep 13, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment