|
12 | 12 | // See the License for the specific language governing permissions and
|
13 | 13 | // limitations under the License.
|
14 | 14 |
|
15 |
| -(function(scope, testing) { |
| 15 | +(function(shared, scope, testing) { |
16 | 16 |
|
17 | 17 | var propertyHandlers = {};
|
18 | 18 |
|
| 19 | + function toCamelCase(property) { |
| 20 | + return property.replace(/-(.)/g, function(_, c) { |
| 21 | + return c.toUpperCase(); |
| 22 | + }); |
| 23 | + } |
| 24 | + |
19 | 25 | function addPropertyHandler(parser, merger, property) {
|
20 | 26 | propertyHandlers[property] = propertyHandlers[property] || [];
|
21 | 27 | propertyHandlers[property].push([parser, merger]);
|
|
24 | 30 | for (var i = 0; i < properties.length; i++) {
|
25 | 31 | var property = properties[i];
|
26 | 32 | WEB_ANIMATIONS_TESTING && console.assert(property.toLowerCase() === property);
|
27 |
| - addPropertyHandler(parser, merger, property); |
28 |
| - if (/-/.test(property)) { |
29 |
| - // Add camel cased variant. |
30 |
| - addPropertyHandler(parser, merger, property.replace(/-(.)/g, function(_, c) { |
31 |
| - return c.toUpperCase(); |
32 |
| - })); |
33 |
| - } |
| 33 | + addPropertyHandler(parser, merger, toCamelCase(property)); |
34 | 34 | }
|
35 | 35 | }
|
36 | 36 | scope.addPropertiesHandler = addPropertiesHandler;
|
|
90 | 90 | };
|
91 | 91 |
|
92 | 92 | function propertyInterpolation(property, left, right) {
|
| 93 | + var ucProperty = property; |
| 94 | + if (/-/.test(property) && !shared.isDeprecated('Hyphenated property names', '2016-03-22', 'Use camelCase instead.', true)) { |
| 95 | + ucProperty = toCamelCase(property); |
| 96 | + } |
93 | 97 | if (left == 'initial' || right == 'initial') {
|
94 |
| - var ucProperty = property.replace(/-(.)/g, function(_, c) { |
95 |
| - return c.toUpperCase(); |
96 |
| - }); |
97 | 98 | if (left == 'initial')
|
98 | 99 | left = initialValues[ucProperty];
|
99 | 100 | if (right == 'initial')
|
100 | 101 | right = initialValues[ucProperty];
|
101 | 102 | }
|
102 |
| - var handlers = left == right ? [] : propertyHandlers[property]; |
| 103 | + var handlers = left == right ? [] : propertyHandlers[ucProperty]; |
103 | 104 | for (var i = 0; handlers && i < handlers.length; i++) {
|
104 | 105 | var parsedLeft = handlers[i][0](left);
|
105 | 106 | var parsedRight = handlers[i][0](right);
|
|
121 | 122 | }
|
122 | 123 | scope.propertyInterpolation = propertyInterpolation;
|
123 | 124 |
|
124 |
| -})(webAnimations1, webAnimationsTesting); |
| 125 | +})(webAnimationsShared, webAnimations1, webAnimationsTesting); |
125 | 126 |
|
0 commit comments