Skip to content

Commit d17c543

Browse files
GH-41: Consider the lazy imports and Suspense case
1 parent 317c8a8 commit d17c543

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

src/legacy/style.ts

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
export default (cssText: string) => {
2-
window.addEventListener("load", () => {
3-
/** Resolve the overlap issue of the CSS rules when using Bootstrap */
4-
for (const styleSheet of Array.from(document.styleSheets)) {
5-
try {
6-
for (const rule of Array.from(styleSheet.cssRules || styleSheet.rules)) {
7-
if (rule instanceof CSSStyleRule) {
8-
rule.selectorText = rule.selectorText.replace(
9-
/^\.form-control(?=:|$)/,
10-
".form-control:not(.ant-input)",
11-
)
12-
}
2+
/** Resolve the overlap issue of the CSS rules when using Bootstrap */
3+
for (const styleSheet of Array.from(document.styleSheets)) {
4+
try {
5+
for (const rule of Array.from(styleSheet.cssRules || styleSheet.rules)) {
6+
if (rule instanceof CSSStyleRule) {
7+
rule.selectorText = rule.selectorText.replace(
8+
/^\.form-control(?=:|$)/,
9+
".form-control:not(.ant-input)",
10+
)
1311
}
14-
} catch (e) {
1512
}
13+
} catch (e) {
1614
}
17-
})
15+
}
1816

1917
/** Inject the given `cssText` in the document head */
2018
const style = document.createElement("style");
@@ -27,4 +25,4 @@ export default (cssText: string) => {
2725
}
2826

2927
document.head.appendChild(style);
30-
}
28+
}

0 commit comments

Comments
 (0)