-
-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(fix) deal with multiple script tags (#193)
All script tags, no matter at what level, are listed within the root children. To get the top level scripts, filter out all those that are part of children's children. Those have another type ('Element' with name 'script'). Fixes #143
- Loading branch information
1 parent
705469f
commit da2f54d
Showing
5 changed files
with
79 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
.../svelte2tsx/test/svelte2tsx/samples/script-inside-head-after-toplevel-script/expected.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<></>;function render() { | ||
|
||
let b = 'top level'; | ||
; | ||
<><div> | ||
|
||
</div> | ||
|
||
|
||
|
||
<sveltehead> | ||
<link rel="stylesheet" href="/lib/jodit.es2018.min.css" /> | ||
|
||
</sveltehead></> | ||
return { props: {}, slots: {} }} | ||
|
||
export default class { | ||
$$prop_def = __sveltets_partial(render().props) | ||
$$slot_def = render().slots | ||
} |
14 changes: 14 additions & 0 deletions
14
.../svelte2tsx/test/svelte2tsx/samples/script-inside-head-after-toplevel-script/input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<div> | ||
<script>let a = 'not top level';</script> | ||
</div> | ||
|
||
<script> | ||
let b = 'top level'; | ||
</script> | ||
|
||
<svelte:head> | ||
<link rel="stylesheet" href="/lib/jodit.es2018.min.css" /> | ||
<script src="/lib/jodit.es2018.min.js"> | ||
</script> | ||
</svelte:head> |
3 changes: 2 additions & 1 deletion
3
packages/svelte2tsx/test/svelte2tsx/samples/self-closing-component/expected.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
<></>;import Test from './Test.svelte'; | ||
function render() { | ||
|
||
|
||
|
||
let a = 'b'; | ||
; | ||
<><Test b="6" /> | ||
</> | ||
|
3 changes: 2 additions & 1 deletion
3
packages/svelte2tsx/test/svelte2tsx/samples/self-closing-component/input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<Test b="6" /> | ||
<script> | ||
import Test from './Test.svelte'; | ||
import Test from './Test.svelte'; | ||
let a = 'b'; | ||
</script> |