Skip to content
This repository has been archived by the owner on Oct 7, 2020. It is now read-only.

Commit

Permalink
fix(ripple): SSR document check for getBoundingClientRect (#2000)
Browse files Browse the repository at this point in the history
  • Loading branch information
trimox committed Sep 10, 2019
1 parent 820f389 commit f3089e9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/ripple/ripple.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ export class MdcRipple implements OnDestroy {
window.removeEventListener('resize', handler) : {},
updateCssVariable: (varName: string, value: string | null) =>
(instance._root as HTMLElement).style.setProperty(varName, value),
computeBoundingRect: () => instance._root.getBoundingClientRect(),
computeBoundingRect: () => typeof document === 'object' && !!document ?
instance._root.getBoundingClientRect() : ({top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0}),
getWindowPageOffset: () => typeof window !== 'undefined' ?
({x: window.pageXOffset, y: window.pageYOffset}) : ({x: 0, y: 0}),
registerInteractionHandler: <K extends EventType>(evtType: K, handler: SpecificEventListener<K>) =>
Expand Down

0 comments on commit f3089e9

Please sign in to comment.