Skip to content

Commit

Permalink
fix: 🐛 don't load VCSSOM in non-browser environments
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Mar 22, 2019
1 parent 9b8197a commit 857b2d2
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions addon/vcssom.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,28 +61,25 @@ exports.addon = function (renderer) {
require('./__dev__/warnOnMissingDependencies')('cssom', renderer, ['createRule']); // cssom
}

// VCSSOM support only browser environment.
if (!renderer.client) return;

var kebab = renderer.kebab;

function VRule (rule, decl) {
this.rule = rule;
this.decl = decl;
}

VRule.prototype.diff = function (newDecl) {
var oldDecl = this.decl;
var style = this.rule.style;
var property;

for (property in oldDecl)
if (newDecl[property] === undefined)
style.removeProperty(property);

for (property in newDecl) {
if (newDecl[property] !== oldDecl[property]) {
for (property in newDecl)
if (newDecl[property] !== oldDecl[property])
style.setProperty(kebab(property), newDecl[property]);
}
}

this.decl = newDecl;
};

Expand All @@ -98,7 +95,6 @@ exports.addon = function (renderer) {
*/
this.tree = {};
}

VSheet.prototype.diff = function (newTree) {
var sh = renderer.sh.sheet;
var msh = renderer.msh.sheet;
Expand Down

0 comments on commit 857b2d2

Please sign in to comment.