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(
9999 el . id = MOUNT_ELEMENT_ID
100100
101101 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
110112 }
113+
111114 to . appendChild ( el )
112115 }
113116
You can’t perform that action at this time.
0 commit comments