mirror of
https://github.com/sveltejs/svelte.git
synced 2024-12-01 17:30:59 +01:00
Merge pull request #347 from sveltejs/gh-335-top-level-special-tags
only process special tags (script, style) when they are top-level
This commit is contained in:
commit
fe2a06da47
@ -130,13 +130,13 @@ export default function tag ( parser ) {
|
||||
|
||||
parser.allowWhitespace();
|
||||
|
||||
// special cases – <script> and <style>
|
||||
if ( name in specials ) {
|
||||
// special cases – top-level <script> and <style>
|
||||
if ( name in specials && parser.stack.length === 1 ) {
|
||||
const special = specials[ name ];
|
||||
|
||||
if ( parser[ special.property ] ) {
|
||||
parser.index = start;
|
||||
parser.error( `You can only have one <${name}> tag per component` );
|
||||
parser.error( `You can only have one top-level <${name}> tag per component` );
|
||||
}
|
||||
|
||||
parser.eat( '>', true );
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"message": "You can only have one <style> tag per component",
|
||||
"message": "You can only have one top-level <style> tag per component",
|
||||
"loc": {
|
||||
"line": 9,
|
||||
"column": 0
|
||||
|
Loading…
Reference in New Issue
Block a user