@@ -32,26 +32,14 @@ function Portal(props) {
3232 }
3333
3434 if ( ! _this . _temp ) {
35- // Ensure the element has a mask for useId invocations
36- let root = _this . _vnode ;
37- while ( root !== null && ! root . _mask && root . _parent !== null ) {
38- root = root . _parent ;
39- }
40-
4135 _this . _container = container ;
4236
4337 // Create a fake DOM parent node that manages a subset of `container`'s children:
4438 _this . _temp = {
4539 nodeType : 1 ,
4640 parentNode : container ,
4741 childNodes : [ ] ,
48- _children : { _mask : root . _mask } ,
4942 contains : ( ) => true ,
50- // Technically this isn't needed
51- appendChild ( child ) {
52- this . childNodes . push ( child ) ;
53- _this . _container . appendChild ( child ) ;
54- } ,
5543 insertBefore ( child , before ) {
5644 this . childNodes . push ( child ) ;
5745 _this . _container . insertBefore ( child , before ) ;
@@ -63,11 +51,19 @@ function Portal(props) {
6351 } ;
6452 }
6553
66- // Render our wrapping element into temp.
67- render (
68- createElement ( ContextProvider , { context : _this . context } , props . _vnode ) ,
69- _this . _temp
54+ const element = createElement (
55+ ContextProvider ,
56+ { context : _this . context } ,
57+ props . _vnode
7058 ) ;
59+ // Ensure the element has a mask for useId invocations
60+ let root = _this . _vnode ;
61+ while ( root !== null && ! root . _mask && root . _parent !== null ) {
62+ root = root . _parent ;
63+ }
64+ element . _mask = root . _mask ;
65+ // Render our wrapping element into temp.
66+ render ( element , _this . _temp ) ;
7167}
7268
7369/**
0 commit comments