| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -140,8 +140,8 @@ function setAnimationStyle(element: any, name: string, value: string, index?: nu | |||
| 140 | 140 | element.style[prop] = value; | |
| 141 | 141 | } | |
| 142 | 142 | ||
| 143 | - function getAnimationStyle(element: any, name: string) { | ||
| 144 | - return element.style[ANIMATION_PROP + name]; | ||
| 143 | + export function getAnimationStyle(element: any, name: string) { | ||
| 144 | + return element.style[ANIMATION_PROP + name] || ''; | ||
| 145 | 145 | } | |
| 146 | 146 | ||
| 147 | 147 | function countChars(value: string, char: string): number { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,9 +5,8 @@ | |||
| 5 | 5 | * Use of this source code is governed by an MIT-style license that can be | |
| 6 | 6 | * found in the LICENSE file at https://angular.io/license | |
| 7 | 7 | */ | |
| 8 | - import {ElementAnimationStyleHandler} from '../../../src/render/css_keyframes/element_animation_style_handler'; | ||
| 8 | + import {ElementAnimationStyleHandler, getAnimationStyle} from '../../../src/render/css_keyframes/element_animation_style_handler'; | ||
| 9 | 9 | import {computeStyle} from '../../../src/util'; | |
| 10 | - | ||
| 11 | 10 | import {assertStyle, createElement, makeAnimationEvent, supportsAnimationEventCreation} from './shared'; | |
| 12 | 11 | ||
| 13 | 12 | const EMPTY_FN = () => {}; | |
@@ -227,5 +226,23 @@ const EMPTY_FN = () => {}; | |||
| 227 | 226 | element.dispatchEvent(event); | |
| 228 | 227 | expect(done).toBeTruthy(); | |
| 229 | 228 | }); | |
| 229 | + | ||
| 230 | + // Issue: https://github.com/angular/angular/issues/24094 | ||
| 231 | + it('should not break getAnimationStyle in old browsers', () => { | ||
| 232 | + // Old browsers like Chrome Android 34 returns null if element.style | ||
| 233 | + // is not found, modern browsers returns empty string. | ||
| 234 | + const fakeElement = { | ||
| 235 | + style: { | ||
| 236 | + 'animationstyle1': 'value', | ||
| 237 | + 'animationstyle2': null, | ||
| 238 | + 'animationstyle3': '', | ||
| 239 | + 'animation': null | ||
| 240 | + } | ||
| 241 | + }; | ||
| 242 | + expect(getAnimationStyle(fakeElement, 'style1')).toBe('value'); | ||
| 243 | + expect(getAnimationStyle(fakeElement, 'style2')).toBe(''); | ||
| 244 | + expect(getAnimationStyle(fakeElement, 'style3')).toBe(''); | ||
| 245 | + expect(getAnimationStyle(fakeElement, '')).toBe(''); | ||
| 246 | + }); | ||
| 230 | 247 | }); | |
| 231 | 248 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments