diff --git a/CHANGELOG.md b/CHANGELOG.md index 28fe3ab6..72f9a28d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,8 @@ ## 0.27.1 - bug fixes - - prevent error when resizing a widget and its clone(s) at the same time + - error when resizing a widget and its clone(s) at the same time + - error with non string css property ## 0.27.0 diff --git a/src/browser/js/app/widgets/common/widget.js b/src/browser/js/app/widgets/common/widget.js index 6703c3e1..7cee0b1c 100644 --- a/src/browser/js/app/widgets/common/widget.js +++ b/src/browser/js/app/widgets/common/widget.js @@ -18,10 +18,10 @@ var OSCProps = [ 'bypass' ] -var fallbackContainer +var dummyDOM DOM.ready(()=>{ - fallbackContainer = DOM.create('
') + dummyDOM = DOM.create('
') }) setTimeout(()=>{ @@ -151,7 +151,7 @@ class Widget extends EventEmitter { this.container._widget_instance = this this.setContainerStyles() } else { - this.container = fallbackContainer + this.container = dummyDOM } } @@ -559,16 +559,13 @@ class Widget extends EventEmitter { if (styles.includes('css')) { // css - var prefix = '#' + this.hash, - scopedCss = scopeCss(this.getProp('css'), prefix), + var css = String(this.getProp('css')), + prefix = '#' + this.hash, + scopedCss = scopeCss(css, prefix), unScopedCss = '' - this.getProp('css') - .replace(/\{[^\}]*\}/g, '') - .replace(/^@media.*/gm,'') - .replace(/^.*\:.*/gm, (m) => { - unScopedCss += m[m.length - 1] === ';' ? m : m + ';' - }) + dummyDOM.style = css + unScopedCss = dummyDOM.getAttribute('style') || '' if (scopedCss.indexOf('@keyframes') > -1) scopedCss = scopedCss.replace(new RegExp(prefix + '\\s+([0-9]+%|to|from)', 'g'), ' $1') if (scopedCss.indexOf('&') > -1) scopedCss = scopedCss.replace(new RegExp(prefix + '\\s&', 'g'), prefix)