예제 #1
0
func checkParent(target, elm dom.Element) bool {
	for target.ParentElement() != nil {
		if target.IsEqualNode(elm) {
			return true
		}
		target = target.ParentElement()
	}
	return false
}
예제 #2
0
func registerUpdateStopper(c dom.Element, updateStop chan struct{}) {
	if c.ParentNode() != nil {
		mutation.New(func(rs []*mutation.Record, o *mutation.Observer) {
			if len(rs) > 0 {
				for _, r := range rs {
					for _, n := range r.RemovedNodes() {
						if c.IsEqualNode(n) {
							o.Disconnect()
							close(updateStop)
							return
						}
					}
				}
			}
		}).Observe(c.ParentNode(), mutation.ObserverInit{ChildList: true})
	}
}