Skip to content

Commit

Permalink
Rework conditions in shouldSetProperty to avoid edge cases
Browse files Browse the repository at this point in the history
  • Loading branch information
nhunzaker committed Aug 3, 2017
1 parent 8d775f8 commit be4c932
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/renderers/dom/shared/DOMProperty.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,24 @@ var DOMProperty = {
return false;
}

if (value == null || DOMProperty.properties.hasOwnProperty(name)) {
let type = typeof value;

if (
value === null ||
type === 'undefined' ||
DOMProperty.properties.hasOwnProperty(name)
) {
return true;
}

let type = typeof value;

return type !== 'function' && type !== 'object';
switch (type) {
case 'boolean':
case 'number':
case 'string':
return true;
default:
return false;
}
},

/**
Expand Down

0 comments on commit be4c932

Please sign in to comment.