Skip to content

Commit 857b2d2

Browse files
committed
fix: 🐛 don't load VCSSOM in non-browser environments
1 parent 9b8197a commit 857b2d2

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

addon/vcssom.js

+5-9
Original file line numberDiff line numberDiff line change
@@ -61,28 +61,25 @@ exports.addon = function (renderer) {
6161
require('./__dev__/warnOnMissingDependencies')('cssom', renderer, ['createRule']); // cssom
6262
}
6363

64+
// VCSSOM support only browser environment.
65+
if (!renderer.client) return;
66+
6467
var kebab = renderer.kebab;
6568

6669
function VRule (rule, decl) {
6770
this.rule = rule;
6871
this.decl = decl;
6972
}
70-
7173
VRule.prototype.diff = function (newDecl) {
7274
var oldDecl = this.decl;
7375
var style = this.rule.style;
7476
var property;
75-
7677
for (property in oldDecl)
7778
if (newDecl[property] === undefined)
7879
style.removeProperty(property);
79-
80-
for (property in newDecl) {
81-
if (newDecl[property] !== oldDecl[property]) {
80+
for (property in newDecl)
81+
if (newDecl[property] !== oldDecl[property])
8282
style.setProperty(kebab(property), newDecl[property]);
83-
}
84-
}
85-
8683
this.decl = newDecl;
8784
};
8885

@@ -98,7 +95,6 @@ exports.addon = function (renderer) {
9895
*/
9996
this.tree = {};
10097
}
101-
10298
VSheet.prototype.diff = function (newTree) {
10399
var sh = renderer.sh.sheet;
104100
var msh = renderer.msh.sheet;

0 commit comments

Comments
 (0)