css: iOS doesn't allow writing "style" property
This commit is contained in:
parent
4132e9aa6b
commit
7999102fa8
2 changed files with 18 additions and 2 deletions
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
- bug fixes
|
||||
- session/state file upload sometimes failing silently
|
||||
- regression breaking the app for iOS
|
||||
|
||||
## 0.27.1
|
||||
|
||||
|
|
|
|||
|
|
@ -564,8 +564,23 @@ class Widget extends EventEmitter {
|
|||
scopedCss = scopeCss(css, prefix),
|
||||
unScopedCss = ''
|
||||
|
||||
dummyDOM.style = css
|
||||
unScopedCss = dummyDOM.getAttribute('style') || ''
|
||||
try {
|
||||
|
||||
dummyDOM.style = css
|
||||
unScopedCss = dummyDOM.getAttribute('style') || ''
|
||||
|
||||
} catch(err) {
|
||||
|
||||
// fallback for browser that don't allow assigning "style" property
|
||||
this.getProp('css')
|
||||
.replace(/\{[^\}]*\}/g, '')
|
||||
.replace(/^[^@#\.]*\:.*/gm, (m) => {
|
||||
unScopedCss += m[m.length - 1] === ';' ? m : m + ';'
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue