Skip to content

Commit beabba4

Browse files
committed
Drop old browsers
1 parent a5b5d82 commit beabba4

5 files changed

Lines changed: 6 additions & 28 deletions

File tree

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,6 @@ function MyComponent() {
5757
- [Boxes example](examples/Boxes.tsx)
5858
- [Bootstrap example](examples/Bootstrap.tsx): https://codesandbox.io/s/github/tkrotoff/flex-wrap-layout/tree/codesandbox.io/examples
5959

60-
## Supported browsers
61-
62-
IE 11 and evergreen browsers
63-
6460
## Limitations
6561

6662
This will cause reflows (layout thrashing): https://gist.github.com/paulirish/5d52fb081b3570c81e3a

examples/.browserslistrc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
>= 1%
2-
IE >= 11
1+
defaults

examples/Boxes.test.e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ test('resize', async ({ page }) => {
1717
//expect(await page.screenshot()).toMatchSnapshot('boxes-1.png');
1818

1919
await expect(children).toHaveClass([
20-
'wrap-children',
20+
'wrap-children ',
2121
'wrap-children',
2222
'box blue',
2323
'box grey flex-fill',

src/detectWrappedElements.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// [jQuery.position() equivalent is wrong](https://github.com/HubSpot/youmightnotneedjquery/issues/172)
22
function getTopPosition(el: Element) {
33
const { top } = el.getBoundingClientRect();
4-
const { marginTop } = window.getComputedStyle(el);
4+
const { marginTop } = getComputedStyle(el);
55
return top - parseInt(marginTop, 10);
66
}
77

@@ -52,8 +52,5 @@ export function detectWrappedElements(
5252
const containsChildNextIsWrapped =
5353
rootElement.getElementsByClassName(nextIsWrappedClassName).length > 0;
5454

55-
// IE does not support toggle() second argument
56-
// https://developer.mozilla.org/en-US/docs/Web/API/Element/classList#Browser_compatibility
57-
//rootEl.classList.toggle(hasChildWrappedClassName, containsChildNextIsWrapped);
58-
rootElement.classList[containsChildNextIsWrapped ? 'add' : 'remove'](hasChildWrappedClassName);
55+
rootElement.classList.toggle(hasChildWrappedClassName, containsChildNextIsWrapped);
5956
}

src/forceDetectWrappedElements.ts

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,4 @@
11
export function forceDetectWrappedElements() {
2-
try {
3-
// https://stackoverflow.com/q/1818474
4-
window.dispatchEvent(new Event('resize'));
5-
} catch {
6-
// FIXME Event constructor is not supported by IE
7-
// https://github.com/zloirock/core-js/issues/354
8-
// https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#polyfill
9-
// https://github.com/lifaon74/events-polyfill/blob/bc989dc00fb90a42ae9c012c309d48710dec2589/event-constructor-polyfill.js#L11-L28
10-
// https://github.com/kumarharsh/custom-event-polyfill/blob/v1.0.7/polyfill.js
11-
// http://youmightnotneedjquery.com/#trigger_native
12-
const event = document.createEvent('Event');
13-
const bubbles = false; // Default is false for new Event()
14-
const cancelable = false; // Default is false for new Event()
15-
event.initEvent('resize', bubbles, cancelable);
16-
window.dispatchEvent(event);
17-
}
2+
// https://stackoverflow.com/q/1818474
3+
dispatchEvent(new Event('resize'));
184
}

0 commit comments

Comments
 (0)