Skip to content

Commit 8dcb1e9

Browse files
author
Sepand Parhami
committed
Quote CSS property names to avoid renaming.
1 parent 5d68829 commit 8dcb1e9

File tree

6 files changed

+31
-31
lines changed

6 files changed

+31
-31
lines changed

src/img-dimensions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ function getDimensionsForScaleDown(
106106
*/
107107
export function getRenderedDimensions(
108108
img: HTMLImageElement, containerSize: Size): Size {
109-
const {objectFit} = getComputedStyle(img);
109+
const objectFit = getComputedStyle(img).getPropertyValue('object-fit');
110110
const naturalSize = {
111111
width: img.naturalWidth,
112112
height: img.naturalHeight,

src/imitation-img.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,18 @@ export function createImitationImg(
5252
translateElement.appendChild(scaleElement);
5353

5454
Object.assign(scaleElement.style, {
55-
display: 'flex',
56-
overflow: 'hidden',
57-
alignItems: 'center',
58-
justifyContent: 'center',
59-
width: `${srcImgRect.width}px`,
60-
height: `${srcImgRect.height}px`,
55+
'display': 'flex',
56+
'overflow': 'hidden',
57+
'alignItems': 'center',
58+
'justifyContent': 'center',
59+
'width': `${srcImgRect.width}px`,
60+
'height': `${srcImgRect.height}px`,
6161
});
6262

6363
Object.assign(img.style, {
64-
display: 'block',
65-
width: `${imageDimensions.width}px`,
66-
height: `${imageDimensions.height}px`,
64+
'display': 'block',
65+
'width': `${imageDimensions.width}px`,
66+
'height': `${imageDimensions.height}px`,
6767
});
6868

6969
return {

src/transform-img/crop-animation.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -167,17 +167,17 @@ export function prepareCropAnimation({
167167
const endScale = toLarger ? neutralScale : scaleDown;
168168

169169
Object.assign(scaleElement.style, styles, {
170-
willChange: 'transform',
171-
animationName: scaleKeyframesName,
172-
animationTimingFunction: 'linear',
173-
animationFillMode: 'forwards',
170+
'willChange': 'transform',
171+
'animationName': scaleKeyframesName,
172+
'animationTimingFunction': 'linear',
173+
'animationFillMode': 'forwards',
174174
});
175175

176176
Object.assign(counterScaleElement.style, styles, {
177-
willChange: 'transform',
178-
animationName: counterScaleKeyframesName,
179-
animationTimingFunction: 'linear',
180-
animationFillMode: 'forwards',
177+
'willChange': 'transform',
178+
'animationName': counterScaleKeyframesName,
179+
'animationTimingFunction': 'linear',
180+
'animationFillMode': 'forwards',
181181
});
182182

183183
return generateCropKeyframes({

src/transform-img/scale-animation.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ export function prepareScaleAnimation({
6161
const endImgScale = toLarger ? neutralScale : scaleImgDown;
6262

6363
Object.assign(element.style, styles, {
64-
willChange: 'transform',
65-
animationName: keyframesName,
66-
animationTimingFunction: curveToString(curve),
67-
animationFillMode: 'forwards',
64+
'willChange': 'transform',
65+
'animationName': keyframesName,
66+
'animationTimingFunction': curveToString(curve),
67+
'animationFillMode': 'forwards',
6868
});
6969

7070
return `

src/transform-img/test-transform-img.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ describe('prepareImageAnimation', () => {
3434
const curve = {x1: 0.8, y1: 0, x2: 0.2, y2: 1};
3535
const head = document.head!;
3636
const styles = {
37-
animationFillMode: 'forwards',
38-
animationDuration: '1000ms',
37+
'animationFillMode': 'forwards',
38+
'animationDuration': '1000ms',
3939
};
4040

4141
function getReplacement() {

src/transform-img/translate-animation.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@ export function prepareTranslateAnimation({
7070
const deltaTop = startTop - endTop;
7171

7272
Object.assign(element.style, styles, {
73-
position: 'fixed',
74-
top: `${endTop}px`,
75-
left: `${endLeft}px`,
76-
willChange: 'transform',
77-
animationName: keyframesName,
78-
animationTimingFunction: curveToString(curve),
79-
animationFillMode: 'forwards',
73+
'position': 'fixed',
74+
'top': `${endTop}px`,
75+
'left': `${endLeft}px`,
76+
'willChange': 'transform',
77+
'animationName': keyframesName,
78+
'animationTimingFunction': curveToString(curve),
79+
'animationFillMode': 'forwards',
8080
});
8181

8282
return `

0 commit comments

Comments
 (0)