Famous / engine

MIT License
1.75k stars 250 forks source link

Patch: node is null error when events from other frameworks creep into famous #468

Open CompSciFutures opened 9 years ago

CompSciFutures commented 9 years ago

Firefox 40.0 is generating "node is null" errors when events from other frameworks bubble into Famous (for example, from D3).

The attached patch to Famous#DOMRenderer._getPath() fixes it. It's a patch against the built famous.js but it should be clear where the required change is and its purpose should make sense just from looking at the code.

Grab me on slack if you need more info.

Index: WarRoom/lib/famous-20150801-622461886b5162f8dc42f91483b04d758b507d72.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- WarRoom/lib/famous-20150801-622461886b5162f8dc42f91483b04d758b507d72.js (revision 2ff2a6e3c886e5aca9b200d93c3d3159dd1f7430)
+++ WarRoom/lib/famous-20150801-622461886b5162f8dc42f91483b04d758b507d72.js (revision )
@@ -8993,7 +8993,7 @@
     // TODO move into _triggerEvent, avoid object allocation
     var path = [];
     var node = ev.target;
-    while (node !== document.body) {
+    while (node && node !== document.body) {
         path.push(node);
         node = node.parentNode;
     }
alexanderGugel commented 9 years ago

Thanks. Do you want to submit a PR for this? Otherwise I'm going to fix this.

CompSciFutures commented 8 years ago

Sorry I missed your note. Just fix it directly, its a one line change.