Skip to content

Commit

Permalink
mod comment
Browse files Browse the repository at this point in the history
  • Loading branch information
canalun committed Feb 17, 2024
1 parent 51c346b commit d6e2dfb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/game/getComputedStyleWithCache.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// getComputedStyle() is expensive, so we should cache the result.
// We can assume that the style of an element doesn't change, except for DOMRect-related,
// because the page is frozen.
// We can assume that the style of an element doesn't change, because the page is frozen.
// Please note that DOMRect-related settings can't be used in this function,
// because they can change by removing blocks. Use getBoundingClientRect() instead.
const styleCache = new Map<Element, CSSStyleDeclaration>()
export function getComputedStyleWithCache(
element: Element
Expand Down

0 comments on commit d6e2dfb

Please sign in to comment.