This repository was archived by the owner on May 3, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +3
-8
lines changed
Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Original file line number Diff line number Diff line change @@ -71,19 +71,14 @@ const elmWebComponents = {
7171 const flags = mapFlags ( props )
7272 context . flags = flags
7373
74- var elmDiv = this ;
75- var parentDiv = this ;
76-
77- if ( useShadowDom ) {
78- parentDiv = this . attachShadow ( { mode : 'open' } ) ;
79- }
74+ const parentDiv = useShadowDom ? this . attachShadow ( { mode : 'open' } ) : this ;
8075
8176 if ( elmVersion === '0.19' ) {
8277 /* a change in Elm 0.19 means that ElmComponent.init now replaces the node you give it
8378 * whereas in 0.18 it rendered into it. To avoid Elm therefore destroying our custom element
8479 * we create a div that we let Elm render into, and manually clear any pre-rendered contents.
8580 */
86- elmDiv = document . createElement ( 'div' )
81+ const elmDiv = document . createElement ( 'div' )
8782
8883 parentDiv . innerHTML = ''
8984 parentDiv . appendChild ( elmDiv )
@@ -94,7 +89,7 @@ const elmWebComponents = {
9489 } )
9590 setupPorts ( elmElement . ports )
9691 } else if ( elmVersion === '0.18' ) {
97- const elmElement = ElmComponent . embed ( elmDiv , flags )
92+ const elmElement = ElmComponent . embed ( parentDiv , flags )
9893 setupPorts ( elmElement . ports )
9994 }
10095 } catch ( error ) {
You can’t perform that action at this time.
0 commit comments