Skip to content

Solve the problem of errors during server rendering #143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: v3
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/algorithms/calculateBoxSize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ interface ResizeObserverSizeCollection {
const cache = new WeakMap<Element, ResizeObserverSizeCollection>();
const scrollRegexp = /auto|scroll/;
const verticalRegexp = /^tb|vertical/;
const IE = (/msie|trident/i).test(global.navigator && global.navigator.userAgent);
const isIE = function () {
return (/msie|trident/i).test(global.navigator && global.navigator.userAgent);
};
const parseDimension = (pixel: string | null): number => parseFloat(pixel || '0');

// Helper to generate and freeze a ResizeObserverSize
Expand Down Expand Up @@ -56,7 +58,7 @@ const calculateBoxSizes = (target: Element, forceRecalculation = false): ResizeO
const svg = isSVG(target) && (target as SVGElement).ownerSVGElement && (target as SVGGraphicsElement).getBBox();

// IE does not remove padding from width/height, when box-sizing is border-box.
const removePadding = !IE && cs.boxSizing === 'border-box';
const removePadding = !isIE() && cs.boxSizing === 'border-box';

// Switch sizes if writing mode is vertical.
const switchSizes = verticalRegexp.test(cs.writingMode || '');
Expand Down