Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2525)

Unified Diff: polymer_0.5.4/bower_components/web-animations-js/src/apply-preserving-inline-style.js

Issue 895523005: Added Polymer 0.5.4 (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: polymer_0.5.4/bower_components/web-animations-js/src/apply-preserving-inline-style.js
diff --git a/polymer_0.5.0/bower_components/web-animations-js/src/apply-preserving-inline-style.js b/polymer_0.5.4/bower_components/web-animations-js/src/apply-preserving-inline-style.js
similarity index 89%
copy from polymer_0.5.0/bower_components/web-animations-js/src/apply-preserving-inline-style.js
copy to polymer_0.5.4/bower_components/web-animations-js/src/apply-preserving-inline-style.js
index c96a3359d150593d6d2193ca7bfb330a72506f68..795be364529173046198d02931bc6509e1055248 100644
--- a/polymer_0.5.0/bower_components/web-animations-js/src/apply-preserving-inline-style.js
+++ b/polymer_0.5.4/bower_components/web-animations-js/src/apply-preserving-inline-style.js
@@ -47,8 +47,7 @@
// Stores the inline style of the element on its behalf while the
// polyfill uses the element's inline style to simulate web animations.
// This is needed to fake regular inline style CSSOM access on the element.
- this._surrogateElement = document.createElement('div');
- this._surrogateStyle = this._surrogateElement.style;
+ this._surrogateStyle = document.createElementNS('http://www.w3.org/1999/xhtml', 'div').style;
this._style = element.style;
this._length = 0;
this._isAnimatedProperty = {};
@@ -157,10 +156,19 @@
if (element._webAnimationsPatchedStyle)
return;
- // If this style patch fails (on Safari and iOS) use the apply-preserving-inline-style-methods.js
- // module instead and restrict inline style interactions to the methods listed in styleMethods.
var animatedStyle = new AnimatedCSSStyleDeclaration(element);
- configureProperty(element, 'style', { get: function() { return animatedStyle; } });
+ try {
+ configureProperty(element, 'style', { get: function() { return animatedStyle; } });
+ } 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.
+ element.style._set = function(property, value) {
+ element.style[property] = value;
+ };
+ element.style._clear = function(property) {
+ element.style[property] = '';
+ };
+ }
// We must keep a handle on the patched style to prevent it from getting GC'd.
element._webAnimationsPatchedStyle = element.style;
@@ -180,4 +188,4 @@
if (WEB_ANIMATIONS_TESTING)
testing.ensureStyleIsPatched = ensureStyleIsPatched;
-})(webAnimationsMinifill, webAnimationsTesting);
+})(webAnimations1, webAnimationsTesting);

Powered by Google App Engine
This is Rietveld 408576698