File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed
Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change 515515 if ( landState ) {
516516 // remove owned xr-iframes
517517
518- const landXrIframe = root . childNodes [ 0 ] ;
519- const ownedXrIframes = _getOwnedXrIframes ( landXrIframe ) ;
518+ const ownedXrIframes = Array . from ( root . querySelectorAll ( 'xr-iframe' ) ) . filter ( xrIframe => / ^ o w n e d : / . test ( xrIframe . id ) ) ;
520519 for ( let i = 0 ; i < ownedXrIframes . length ; i ++ ) {
521520 const ownedXrIframe = ownedXrIframes [ i ] ;
522- const match = ownedXrIframe . match ( / ^ o w n e d : ( .* ?) - / ) ;
521+ const match = ownedXrIframe . id . match ( / ^ o w n e d : ( .* ?) - / ) ;
523522 if ( match ) {
524523 const ownerId = match [ 1 ] ;
525524 if ( ownerId === peerConnectionId ) {
561560 break ;
562561 }
563562 case 'removeChild' : {
564- const childNode = el . childNodes [ key ] ;
565- el . removeChild ( childNode ) ;
563+ let match , childNode ;
564+ if ( typeof key === 'number' && key < el . childNodes . length ) {
565+ childNode = el . childNodes [ key ] ;
566+ el . removeChild ( childNode ) ;
567+ } else if (
568+ typeof key === 'string' &&
569+ ( match = key . match ( / ^ # ( .+ ) $ / ) ) &&
570+ ( childNode = Array . from ( el . childNodes ) . find ( node => node . id === match [ 1 ] ) )
571+ ) {
572+ el . removeChild ( childNode ) ;
573+ } else {
574+ console . warn ( 'remove missing child' , keyPath , key ) ;
575+ }
566576 break ;
567577 }
568578 }
You can’t perform that action at this time.
0 commit comments