State Dev: Allow whitespace in state attributes

This commit is contained in:
Paulus Schoutsen 2017-01-30 00:12:54 -08:00
parent b9cf35cced
commit 7a4b6f7db9

View File

@ -149,8 +149,10 @@ Polymer({
handleSetState: function () { handleSetState: function () {
var attr; var attr;
var attrRaw = this._stateAttributes.replace(/^\s+|\s+$/g, '')
try { try {
attr = this._stateAttributes ? JSON.parse(this._stateAttributes) : {}; attr = attrRaw ?
JSON.parse(attrRaw) : {};
} catch (err) { } catch (err) {
/* eslint-disable no-alert */ /* eslint-disable no-alert */
alert('Error parsing JSON: ' + err); alert('Error parsing JSON: ' + err);