Skip to content

Commit a5b9379

Browse files
committed
Remove elementType validation in InPortal, based on findings in #8 (comment)
1 parent 8c1fc37 commit a5b9379

File tree

1 file changed

+0
-20
lines changed

1 file changed

+0
-20
lines changed

src/index.tsx

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -142,31 +142,11 @@ class InPortal extends React.PureComponent<InPortalProps, { nodeProps: {} }> {
142142
});
143143
};
144144

145-
validateElementTypesOfChildren() {
146-
const {
147-
elementType,
148-
element: { childNodes },
149-
} = this.props.node;
150-
151-
// To support SVG and other non-html elements, every element that gets rendered
152-
// into the InPortal needs to match the portalNode's elementType.
153-
// Non-elements like Text aren't checkable.
154-
childNodes.forEach((childNode) => {
155-
if (childNode instanceof Element) {
156-
if (!validateElementType(childNode, elementType)) {
157-
throw new Error(`Invalid content for portal: "${elementType}" portalNodes must be used with ${elementType} elements, but InPortal received <${childNode.tagName}>.`);
158-
}
159-
}
160-
})
161-
}
162-
163145
componentDidMount() {
164-
this.validateElementTypesOfChildren();
165146
this.addPropsChannel();
166147
}
167148

168149
componentDidUpdate() {
169-
this.validateElementTypesOfChildren();
170150
this.addPropsChannel();
171151
}
172152

0 commit comments

Comments
 (0)