From 72b7ed95d67ad50a16c7a08be1fb1c0e130e47e0 Mon Sep 17 00:00:00 2001 From: Pedro Lauro Date: Tue, 19 Sep 2017 16:07:21 -0300 Subject: [PATCH] When running on PhantomJS, the Object.defineProperty method doesn't work for every element, prints a log on console and doesn't throw an exception. So now it checks for the change, and forces an exception. --- package.json | 1 - src/apply-preserving-inline-style.js | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index f97c8b06..fc463485 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,6 @@ "karma-sauce-launcher": "~0.2.3", "grunt-checkrepo": "~0.1.0", "grunt-saucelabs": "~4.0.2", - "grunt-checkrepo": "~0.1.0", "grunt-git-status": "~1.0.0", "grunt-template": "~0.2.3", "source-map": "~0.1.40" diff --git a/src/apply-preserving-inline-style.js b/src/apply-preserving-inline-style.js index 4002a2f5..3ebd9e4d 100644 --- a/src/apply-preserving-inline-style.js +++ b/src/apply-preserving-inline-style.js @@ -205,6 +205,11 @@ var animatedStyle = new AnimatedCSSStyleDeclaration(element); try { configureProperty(element, 'style', { get: function() { return animatedStyle; } }); + + if (!element.style._set || !element.style._clear) { + throw 'Couldnt configure property style.'; + } + } catch (_) { // iOS and older versions of Safari (pre v7) do not support overriding an element's // style object. Animations will clobber any inline styles as a result.