Skip to content

Commit 986b620

Browse files
committed
Allow hyphenated property names in $.style()
Otherwise setting CSS variables is impossible!
1 parent cf2b6bc commit 986b620

File tree

5 files changed

+25
-6
lines changed

5 files changed

+25
-6
lines changed

bliss.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,16 @@ $.Element.prototype = {
552552
$.setProps = {
553553
// Set a bunch of inline CSS styles
554554
style: function (val) {
555-
$.extend(this.style, val);
555+
for (var property in val) {
556+
if (property in this.style) {
557+
// camelCase versions
558+
this.style[property] = val[property];
559+
}
560+
else {
561+
// This way we can set CSS Variables too and use normal property names
562+
this.style.setProperty(property, val[property]);
563+
}
564+
}
556565
},
557566

558567
// Set a bunch of attributes

0 commit comments

Comments
 (0)