Problem
If you attach a tap* event (maybe others as well) to window or document, the jQuery library throws an error: "Uncaught TypeError: elem.getClientRects is not a function" at jQuery.fn.init.offset.
Reason
This is because of the .offset() call on window/document, which is not allowed according to this answer on a similar case.
Possible solution
Maybe some check if the element invoking the event is window or document, and if so, set the offset data object to { x: 0, y: 0 } (since window and document are at the origin of measurement).
Temporary workaround
As a temporary workaround, I attached the events to body, but it's not ideal.
Problem If you attach a
tap*
event (maybe others as well) towindow
ordocument
, the jQuery library throws an error:"Uncaught TypeError: elem.getClientRects is not a function" at jQuery.fn.init.offset
.Reason This is because of the
.offset()
call onwindow
/document
, which is not allowed according to this answer on a similar case.Possible solution Maybe some check if the element invoking the event is
window
ordocument
, and if so, set theoffset
data object to{ x: 0, y: 0 }
(since window and document are at the origin of measurement).Temporary workaround As a temporary workaround, I attached the events to
body
, but it's not ideal.