Skip to content

Commit 9456005

Browse files
committed
fix: Set empty style porperty values to undefined instead of empty string
resolves #271
1 parent f4e7259 commit 9456005

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/components/ReactSlider/ReactSlider.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -964,7 +964,7 @@ class ReactSlider extends React.Component {
964964
const style = {
965965
position: 'absolute',
966966
touchAction: 'none',
967-
willChange: this.state.index >= 0 ? this.posMinKey() : '',
967+
willChange: this.state.index >= 0 ? this.posMinKey() : undefined,
968968
zIndex: this.state.zIndices.indexOf(i) + 1,
969969
};
970970
style[this.posMinKey()] = `${offset}px`;
@@ -974,7 +974,8 @@ class ReactSlider extends React.Component {
974974
buildTrackStyle(min, max) {
975975
const obj = {
976976
position: 'absolute',
977-
willChange: this.state.index >= 0 ? `${this.posMinKey()},${this.posMaxKey()}` : '',
977+
willChange:
978+
this.state.index >= 0 ? `${this.posMinKey()},${this.posMaxKey()}` : undefined,
978979
};
979980
obj[this.posMinKey()] = min;
980981
obj[this.posMaxKey()] = max;

src/components/ReactSlider/__tests__/__snapshots__/ReactSlider.test.js.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ exports[`<ReactSlider> can render 1`] = `
1818
"left": 0,
1919
"position": "absolute",
2020
"right": 0,
21-
"willChange": "",
21+
"willChange": undefined,
2222
}
2323
}
2424
/>
@@ -29,7 +29,7 @@ exports[`<ReactSlider> can render 1`] = `
2929
"left": 0,
3030
"position": "absolute",
3131
"right": 0,
32-
"willChange": "",
32+
"willChange": undefined,
3333
}
3434
}
3535
/>
@@ -48,7 +48,7 @@ exports[`<ReactSlider> can render 1`] = `
4848
"left": "0px",
4949
"position": "absolute",
5050
"touchAction": "none",
51-
"willChange": "",
51+
"willChange": undefined,
5252
"zIndex": 1,
5353
}
5454
}

0 commit comments

Comments
 (0)