Skip to content

Commit 0b27946

Browse files
committed
Merge remote-tracking branch 'web-animations-next/master' into HEAD
2 parents 8398b15 + 0d940db commit 0b27946

8 files changed

+104
-11
lines changed

History.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,32 @@
1+
### 1.0.3 - *December 4 2014*
2+
3+
* Fix a critical bug on iOS 7 and Safari <= 6. Due to limitations,
4+
inline style patching is not supported on these platforms.
5+
6+
### 1.0.2 - *November 28 2014*
7+
8+
* Deprecated `AnimationTiming.playbackRate`.
9+
10+
For example, this is no longer supported:
11+
12+
var player = element.animate(
13+
keyframes,
14+
{duration: 1000, playbackRate: 2});
15+
16+
Use `AnimationPlayer.playbackRate` instead:
17+
18+
var player = element.animate(
19+
keyframes,
20+
{duration: 1000});
21+
player.playbackRate = 2;
22+
23+
If you have any feedback on this change, please start a discussion
24+
on the public-fx mailing list:
25+
http://lists.w3.org/Archives/Public/public-fx/
26+
27+
Or file an issue against the specification on GitHub:
28+
https://github.com/w3c/web-animations/issues/new
29+
130
### 1.0.1 - *November 26 2014*
231

332
* Players should be constructed in idle state

README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ JavaScript can still work in the presence of animations. However, to keep the
115115
size of web-animations-next-lite as small as possible, the style emulation
116116
module is not included. When using this version of the polyfill, JavaScript
117117
inline style modification will be overwritten by animations.
118+
Due to browser constraints inline style modification is not supported on iOS 7
119+
or Safari 6 (or earlier versions).
118120

119121
### Prefix handling
120122

@@ -147,12 +149,13 @@ Report any issues with this implementation on GitHub:
147149
Breaking changes
148150
----------------
149151

150-
When we make a potentially breaking change to the polyfill's API surface (like
151-
a rename) we'll continue supporting the old version, deprecated, for three
152-
months, and ensure that there are console warnings to indicate that a change is
153-
pending. After three months, the old version of the API surface (e.g. the old
154-
version of a function name) will be removed. If you see deprecation warnings
155-
you can't avoid it by not updating.
152+
When we make a potentially breaking change to the polyfill's API
153+
surface (like a rename) where possible we will continue supporting the
154+
old version, deprecated, for three months, and ensure that there are
155+
console warnings to indicate that a change is pending. After three
156+
months, the old version of the API surface (e.g. the old version of a
157+
function name) will be removed. *If you see deprecation warnings you
158+
can't avoid it by not updating*.
156159

157160
We also announce anything that isn't a bug fix on
158161
[[email protected]](https://groups.google.com/forum/#!forum/web-animations-changes).

src/animation-constructor.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,12 @@
2828

2929
scope.Animation = function(target, effect, timingInput) {
3030
this.target = target;
31-
// TODO: Make modifications to specified update the underlying player
31+
32+
// TODO: Store a clone, not the same instance.
33+
this._timingInput = timingInput;
3234
this._timing = shared.normalizeTimingInput(timingInput);
35+
36+
// TODO: Make modifications to timing update the underlying player
3337
this.timing = shared.makeTiming(timingInput);
3438
// TODO: Make this a live object - will need to separate normalization of
3539
// keyframes into a shared module.
@@ -54,7 +58,7 @@
5458
if (typeof effect == 'function') {
5559
effect = [];
5660
}
57-
return originalElementAnimate.apply(target, [effect, animation.timing]);
61+
return originalElementAnimate.apply(target, [effect, animation._timingInput]);
5862
};
5963

6064
scope.bindPlayerForAnimation = function(player) {

src/apply-preserving-inline-style.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,19 @@
157157
if (element._webAnimationsPatchedStyle)
158158
return;
159159

160-
// If this style patch fails (on Safari and iOS) use the apply-preserving-inline-style-methods.js
161-
// module instead and restrict inline style interactions to the methods listed in styleMethods.
162160
var animatedStyle = new AnimatedCSSStyleDeclaration(element);
163-
configureProperty(element, 'style', { get: function() { return animatedStyle; } });
161+
try {
162+
configureProperty(element, 'style', { get: function() { return animatedStyle; } });
163+
} catch (_) {
164+
// iOS and older versions of Safari (pre v7) do not support overriding an element's
165+
// style object. Animations will clobber any inline styles as a result.
166+
element.style._set = function(property, value) {
167+
element.style[property] = value;
168+
};
169+
element.style._clear = function(property) {
170+
element.style[property] = '';
171+
};
172+
}
164173

165174
// We must keep a handle on the patched style to prevent it from getting GC'd.
166175
element._webAnimationsPatchedStyle = element.style;

src/deprecation.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// Copyright 2014 Google Inc. All rights reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
(function(shared) {
16+
17+
var silenced = {};
18+
19+
shared.isDeprecated = function(feature, date, advice, plural) {
20+
var auxVerb = plural ? 'are' : 'is';
21+
var today = new Date();
22+
var expiry = new Date(date);
23+
expiry.setMonth(expiry.getMonth() + 3); // 3 months grace period
24+
25+
if (today < expiry) {
26+
if (!(feature in silenced)) {
27+
console.warn('Web Animations: ' + feature + ' ' + auxVerb + ' deprecated and will stop working on ' + expiry.toDateString() + '. ' + advice);
28+
}
29+
silenced[feature] = true;
30+
return false;
31+
} else {
32+
return true;
33+
}
34+
};
35+
36+
shared.deprecated = function(feature, date, advice, plural) {
37+
if (shared.isDeprecated(feature, date, advice, plural)) {
38+
throw new Error(feature + ' ' + auxVerb + ' no longer supported. ' + advice);
39+
}
40+
};
41+
42+
})(webAnimationsShared);

src/timing-utilities.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@
4545
if ((property == 'direction') && (directions.indexOf(timingInput[property]) == -1)) {
4646
return;
4747
}
48+
if (property == 'playbackRate' && shared.isDeprecated('AnimationTiming.playbackRate', '2014-11-28', 'Use AnimationPlayer.playbackRate instead.')) {
49+
return;
50+
}
4851
timing[property] = timingInput[property];
4952
}
5053
});

target-config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
'src/position-handler.js',
2828
'src/shape-handler.js',
2929
'src/property-names.js',
30+
'src/deprecation.js',
3031
];
3132

3233
var liteMinifillSrc = [
@@ -48,6 +49,7 @@
4849
'src/box-handler.js',
4950
'src/transform-handler.js',
5051
'src/property-names.js',
52+
'src/deprecation.js',
5153
];
5254

5355

web-animations.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
<script src="src/dev.js"></script>
2323
<script src="src/scope.js"></script>
24+
<script src="src/deprecation.js"></script>
2425
<script src="src/timing-utilities.js"></script>
2526
<script src="src/normalize-keyframes.js"></script>
2627
<script src="src/animation-node.js"></script>

0 commit comments

Comments
 (0)