File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -99,15 +99,18 @@ export function mount(
99
99
el . id = MOUNT_ELEMENT_ID
100
100
101
101
if ( options ?. attachTo ) {
102
- const to = isString ( options . attachTo )
103
- ? document . querySelector ( options . attachTo )
104
- : options . attachTo
105
-
106
- if ( ! to ) {
107
- throw new Error (
108
- `Unable to find the element matching the selector ${ options . attachTo } given as the \`attachTo\` option`
109
- )
102
+ let to : Element
103
+ if ( typeof options . attachTo === 'string' ) {
104
+ to = document . querySelector ( options . attachTo )
105
+ if ( ! to ) {
106
+ throw new Error (
107
+ `Unable to find the element matching the selector ${ options . attachTo } given as the \`attachTo\` option`
108
+ )
109
+ }
110
+ } else {
111
+ to = options . attachTo
110
112
}
113
+
111
114
to . appendChild ( el )
112
115
}
113
116
You can’t perform that action at this time.
0 commit comments