Bug 135628

Summary: TouchEvent listeners do not trigger from nodes created from different document
Product: WebKit Reporter: Daniel Freedman <dfreedm>
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: ap, benjamin, ddkilzer
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: iPhone / iPad   
OS: iOS 7.0   
Attachments:
Description Flags
Minimal reproduction case
none
Version with <template> none

Description Daniel Freedman 2014-08-05 16:43:03 PDT
If a node is created in a document that is not the main document (document.implementation.createHTMLDocument), has touch event listeners added, and then is added to the main document, those listeners do not trigger from touches.
The event listeners show up in the inspector, but the handler function is not called.
A synthetic event of the same name (touchstart, touchmove, touchend), will trigger the listener, as expected.
If the event listeners are added after the node is imported into the main document, then the listeners trigger as expected.

However, if a global touch listener is added, say to document.body, then the event listeners on the imported nodes trigger correctly.

This scenario is encountered when using a polyfill for <template>, and with native <template> in iOS 7 and iOS 8 respectively.
In addition, only touch listeners are affected by this, mouse listeners on the same nodes with trigger as expected.

Attached is a minimized repro case.
Comment 1 Daniel Freedman 2014-08-05 16:43:29 PDT
Created attachment 236064 [details]
Minimal reproduction case
Comment 2 Daniel Freedman 2014-08-05 16:58:58 PDT
Created attachment 236065 [details]
Version with <template>
Comment 3 Lucas Forschler 2019-02-06 09:18:25 PST
Mass move bugs into the DOM component.