Skip to content

Commit

Permalink
fix: Set empty style porperty values to undefined instead of empty st…
Browse files Browse the repository at this point in the history
…ring

resolves #271
  • Loading branch information
pekarja5 committed Aug 23, 2022
1 parent f4e7259 commit 9456005
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/components/ReactSlider/ReactSlider.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,7 @@ class ReactSlider extends React.Component {
const style = {
position: 'absolute',
touchAction: 'none',
willChange: this.state.index >= 0 ? this.posMinKey() : '',
willChange: this.state.index >= 0 ? this.posMinKey() : undefined,
zIndex: this.state.zIndices.indexOf(i) + 1,
};
style[this.posMinKey()] = `${offset}px`;
Expand All @@ -974,7 +974,8 @@ class ReactSlider extends React.Component {
buildTrackStyle(min, max) {
const obj = {
position: 'absolute',
willChange: this.state.index >= 0 ? `${this.posMinKey()},${this.posMaxKey()}` : '',
willChange:
this.state.index >= 0 ? `${this.posMinKey()},${this.posMaxKey()}` : undefined,
};
obj[this.posMinKey()] = min;
obj[this.posMaxKey()] = max;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ exports[`<ReactSlider> can render 1`] = `
"left": 0,
"position": "absolute",
"right": 0,
"willChange": "",
"willChange": undefined,
}
}
/>
Expand All @@ -29,7 +29,7 @@ exports[`<ReactSlider> can render 1`] = `
"left": 0,
"position": "absolute",
"right": 0,
"willChange": "",
"willChange": undefined,
}
}
/>
Expand All @@ -48,7 +48,7 @@ exports[`<ReactSlider> can render 1`] = `
"left": "0px",
"position": "absolute",
"touchAction": "none",
"willChange": "",
"willChange": undefined,
"zIndex": 1,
}
}
Expand Down

0 comments on commit 9456005

Please sign in to comment.