jakearchibald / navigation-transitions

335 stars 11 forks source link

Guarantees about cheap layout data? #4

Open surma opened 7 years ago

surma commented 7 years ago

Looking at the example in the explainer, I was wondering if the spec should make any guarantees about how cheap calls to getBoundingClientRect() and similar are.

Transition/Animation code is going to need that kind of data by very nature, so it’d be good if calls like this would not force layout (unless style changes). Maybe even attach this kind of data to the event?

jakearchibald commented 7 years ago

Unless there's been a style modification, getBoundingClientRect shouldn't trigger layout.

It's tricky, because if there has been a style update, you probably want to know where everything is taking those styles into account.