@samitouri / QOS-React / commits / 167c27e188

Re-added support for attaching events to document fragments

Wildhoney committed Apr 8, 2016 at 19:31 UTC 167c27e188f8a0becc8e1d4f63ef3d95d1d75a67
2 files changed +6 -1
src/renderers/dom/shared/ReactDOMComponent.js
+5 -1
@@ -60,6 +60,9 @@ var RESERVED_PROPS = {
60 suppressContentEditableWarning: null,
61 };
62
63 +// Node type for document fragments (Node.DOCUMENT_FRAGMENT_NODE).
64 +var DOC_FRAGMENT_TYPE = 11;
65 +
66
67 function getDeclarationErrorAddendum(internalInstance) {
68 if (internalInstance) {
@@ -213,7 +216,8 @@ function enqueuePutListener(inst, registrationName, listener, transaction) {
216 );
217 }
218 var containerInfo = inst._nativeContainerInfo;
216 - var doc = containerInfo._ownerDocument;
219 + var isDocumentFragment = containerInfo._node && containerInfo._node.nodeType === DOC_FRAGMENT_TYPE;
220 + var doc = isDocumentFragment ? containerInfo._node : containerInfo._ownerDocument;
221 if (!doc) {
222 // Server rendering.
223 return;
src/renderers/dom/shared/ReactDOMContainerInfo.js
+1
@@ -22,6 +22,7 @@ function ReactDOMContainerInfo(topLevelWrapper, node) {
22 _ownerDocument: node ?
23 node.nodeType === DOC_NODE_TYPE ? node : node.ownerDocument :
24 null,
25 + _node: node,
26 _tag: node ? node.nodeName.toLowerCase() : null,
27 _namespaceURI: node ? node.namespaceURI : null,
28 };