Skip to content

Commit

Permalink
fix: apply workaround to pass tests in Safari 10
Browse files Browse the repository at this point in the history
  • Loading branch information
web-padawan committed Jun 10, 2019
1 parent 88ae284 commit 4fddea4
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/vaadin-rich-text-editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,29 @@
];
}

/**
* @protected
*/
attributeChangedCallback(prop, oldVal, newVal) {
super.attributeChangedCallback(prop, oldVal, newVal);
// Needed until Edge has CSS Custom Properties (present in Edge Preview)
/* istanbul ignore if */
if (/^(readonly|disabled|theme)$/.test(prop)) {
// iOS 10.3 Safari has an issue with repainting shadow root element styles when a host attribute changes.
// Need this workaround (toggle any inline css property on and off) until we drop iOS 10.
const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;

/* istanbul ignore if */
if (isIOS && this.shadowRoot && parseInt(navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/)[1], 10)) {
const WEBKIT_PROPERTY = '-webkit-backface-visibility';
this.shadowRoot.querySelectorAll('*').forEach(el => {
el.style[WEBKIT_PROPERTY] = 'visible';
el.style[WEBKIT_PROPERTY] = '';
});
}
}
}

ready() {
super.ready();

Expand Down

0 comments on commit 4fddea4

Please sign in to comment.