From e464aaf68e47eeec879fb6946ce3761dbf68bfaa Mon Sep 17 00:00:00 2001 From: "miherlosev@mail.ru" Date: Mon, 30 Nov 2015 10:17:57 +0300 Subject: [PATCH] fix wrong Browser.isWebKit calculation for Safari --- src/client/sandbox/shadow-ui.js | 4 ++-- src/client/utils/browser.js | 2 +- test/client/fixtures/sandbox/shadow-ui-test.js | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/client/sandbox/shadow-ui.js b/src/client/sandbox/shadow-ui.js index c45180167..276d7005b 100644 --- a/src/client/sandbox/shadow-ui.js +++ b/src/client/sandbox/shadow-ui.js @@ -2,7 +2,7 @@ import INTERNAL_PROPS from '../../processing/dom/internal-properties'; import SandboxBase from './base'; import nativeMethods from './native-methods'; import * as domUtils from '../utils/dom'; -import { isWebKit } from '../utils/browser'; +import { isWebKit, isSafari } from '../utils/browser'; import { EVENTS } from '../dom-processor'; import { getOffsetPosition } from '../utils/position'; import SHADOW_UI_CLASS_NAME from '../../shadow-ui/class-name'; @@ -161,7 +161,7 @@ export default class ShadowUI extends SandboxBase { }); // NOTE: T174435 - if (isWebKit) { + if (isWebKit && !isSafari) { var stylesheetsCopy = null; var shadowRoot = null; diff --git a/src/client/utils/browser.js b/src/client/utils/browser.js index 4a5443c4a..3075f1c98 100644 --- a/src/client/utils/browser.js +++ b/src/client/utils/browser.js @@ -43,7 +43,7 @@ export var isFirefox = browser.name === 'firefox' && !isIE11; export var isOpera = browser.name === 'opera'; export var isOperaWithWebKit = /opr/.test(userAgent); export var isSafari = isIOS || /safari/.test(userAgent) && !/chrome/.test(userAgent); -export var isWebKit = browser.name === 'webkit' && !isMSEdge && !isSafari; +export var isWebKit = browser.name === 'webkit' && !isMSEdge; export var hasTouchEvents = !!('ontouchstart' in window); export var isMacPlatform = /^Mac/.test(navigator.platform); diff --git a/test/client/fixtures/sandbox/shadow-ui-test.js b/test/client/fixtures/sandbox/shadow-ui-test.js index 6bf254c85..a61f2ac79 100644 --- a/test/client/fixtures/sandbox/shadow-ui-test.js +++ b/test/client/fixtures/sandbox/shadow-ui-test.js @@ -6,7 +6,7 @@ var shadowUI = hammerhead.sandbox.shadowUI; var iframeSandbox = hammerhead.sandbox.iframe; var domUtils = hammerhead.utils.dom; var nativeMethods = hammerhead.nativeMethods; -var isWebKit = hammerhead.utils.browser.isWebKit; +var browserUtils = hammerhead.utils.browser; QUnit.testStart(function () { @@ -441,7 +441,7 @@ test('querySelectorAll', function () { module('ui stylesheet'); -if (isWebKit) { +if (browserUtils.isWebKit && !browserUtils.isSafari) { asyncTest('stylesheets are restored after the document is cleaned', function () { var link1 = document.createElement('link'); var link2 = document.createElement('link');