// TriggerBindEvent connects the giving event with the provided dom target. func (dm *DOMRenderer) TriggerBindEvent(event *gjs.Object, root *gjs.Object, source *trees.Event) { target := event.Get("target") children := root.Call("querySelectorAll", source.Target()) if children == nil || children == gjs.Undefined { return } kids := js.DOMObjectToList(children) var match bool for _, item := range kids { if item != target { continue } match = true break } // if we match then run the listeners registered. if match { dispatch.Dispatch(trees.EventBroadcast{ EventID: source.EventID, Event: trees.NewWrapperEvent(event), }) } }