| 208 | } |
| 209 | |
| 210 | function dispatchTarget(node, event, type, wsin, wsout) { |
| 211 | if (observer.has(node) && !wsin.has(node)) { |
| 212 | wsout["delete"](node); |
| 213 | wsin.add(node); |
| 214 | node.dispatchEvent(event); |
| 215 | /* |
| 216 | // The event is not bubbling (perf reason: should it?), |
| 217 | // hence there's no way to know if |
| 218 | // stop/Immediate/Propagation() was called. |
| 219 | // Should DOM Level 0 work at all? |
| 220 | // I say it's a YAGNI case for the time being, |
| 221 | // and easy to implement in user-land. |
| 222 | if (!event.cancelBubble) { |
| 223 | var fn = node['on' + type]; |
| 224 | if (fn) |
| 225 | fn.call(node, event); |
| 226 | } |
| 227 | */ |
| 228 | } |
| 229 | |
| 230 | for (var // apparently is node.children || IE11 ... ^_^;; |
| 231 | // https://github.com/WebReflection/disconnected/issues/1 |
| 232 | children = node.children || [], length = children.length, i = 0; i < length; dispatchTarget(children[i++], event, type, wsin, wsout)) { |
| 233 | } |
| 234 | } |
| 235 | } |
| 236 | } |
| 237 | |