Perf: Avoid creation of intermediary array when iterating over style rules (#1272)
* Perf: Avoid creation of intermediary array when iterating over stylesheet rules by using the second `mapFn` argument of Array.from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from Performance analysis by: JonasBA <jonas@badalic.com> Authored-by: Eoghan Murray <eoghan@getthere.ie>
This commit is contained in:
@@ -98,7 +98,7 @@ export function stringifyStylesheet(s: CSSStyleSheet): string | null {
|
||||
const rules = s.rules || s.cssRules;
|
||||
return rules
|
||||
? fixBrowserCompatibilityIssuesInCSS(
|
||||
Array.from(rules).map(stringifyRule).join(''),
|
||||
Array.from(rules, stringifyRule).join(''),
|
||||
)
|
||||
: null;
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user