mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 14:13:37 +08:00
fix: some browser may not repaint when remove nodes (#43358)
Co-authored-by: sunliangmu <sunliangmu@sensorsdata.cn> Co-authored-by: lijianan <574980606@qq.com>
This commit is contained in:
parent
efa427072a
commit
4154dafaa1
@ -25,10 +25,17 @@ export const detectFlexGapSupported = () => {
|
||||
flex.appendChild(document.createElement('div'));
|
||||
flex.appendChild(document.createElement('div'));
|
||||
|
||||
// some browser may not repaint when remove nodes, so we need create a new layer to detect.
|
||||
const container = document.createElement('div');
|
||||
container.style.position = 'absolute';
|
||||
container.style.zIndex = '-9999';
|
||||
container.appendChild(flex);
|
||||
|
||||
|
||||
// append to the DOM (needed to obtain scrollHeight)
|
||||
document.body.appendChild(flex);
|
||||
document.body.appendChild(container);
|
||||
flexGapSupported = flex.scrollHeight === 1; // flex container should be 1px high from the row-gap
|
||||
document.body.removeChild(flex);
|
||||
document.body.removeChild(container);
|
||||
|
||||
return flexGapSupported;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user