Skip to content

Commit

Permalink
Prevent TypeError due to undefined property when parsing styles
Browse files Browse the repository at this point in the history
  • Loading branch information
mdholloway committed Jan 25, 2016
1 parent a792135 commit ecdae9f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/CSSStyleDeclaration.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ function parseStyles(s) {
parser.addListener("property", function(e) {
if (e.invalid) return; // Skip errors
result[e.property.text] = e.value.text;
if (e.important) result.important[e.property.text] = e.important;
if (e.important) {
result.important = {};
result.important[e.property.text] = e.important;
}
});
s = (''+s).replace(/^;/, '');
parser.parseStyleAttribute(s);
Expand Down

0 comments on commit ecdae9f

Please sign in to comment.