Skip to content

Commit

Permalink
Allow hyphenated property names in $.style()
Browse files Browse the repository at this point in the history
Otherwise setting CSS variables is impossible!
  • Loading branch information
LeaVerou committed Mar 16, 2017
1 parent cf2b6bc commit 986b620
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 6 deletions.
11 changes: 10 additions & 1 deletion bliss.js
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,16 @@ $.Element.prototype = {
$.setProps = {
// Set a bunch of inline CSS styles
style: function (val) {
$.extend(this.style, val);
for (var property in val) {
if (property in this.style) {
// camelCase versions
this.style[property] = val[property];
}
else {
// This way we can set CSS Variables too and use normal property names
this.style.setProperty(property, val[property]);
}
}
},

// Set a bunch of attributes
Expand Down

0 comments on commit 986b620

Please sign in to comment.