From 9bd9b53ee8ed591906a104f600972912db1dd98f Mon Sep 17 00:00:00 2001 From: Robert Reinhard Date: Fri, 19 Jan 2024 15:20:58 -0800 Subject: [PATCH] Test that the root node is an element --- src/concerns/dimensions.coffee | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/concerns/dimensions.coffee b/src/concerns/dimensions.coffee index 5308809..f8d3e70 100644 --- a/src/concerns/dimensions.coffee +++ b/src/concerns/dimensions.coffee @@ -13,8 +13,9 @@ export default @onResize() # Resize observer listens for the element itself to change dimensions - @resizeObserver = new ResizeObserver @onResize - @resizeObserver.observe @$el + if @$el?.nodeType == Node.ELEMENT_NODE + @resizeObserver = new ResizeObserver @onResize + @resizeObserver.observe @$el beforeDestroy: -> @resizeObserver?.disconnect()