Skip to content

Commit 2ff8742

Browse files
committed
fix: handle unquoted slash in attributes
1 parent b01cac9 commit 2ff8742

File tree

1 file changed

+18
-2
lines changed
  • packages/svelte/src/compiler/phases/1-parse/state

1 file changed

+18
-2
lines changed

packages/svelte/src/compiler/phases/1-parse/state/element.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -504,8 +504,24 @@ function read_attribute(parser) {
504504
let value = true;
505505
if (parser.eat('=')) {
506506
parser.allow_whitespace();
507-
value = read_attribute_value(parser);
508-
end = parser.index;
507+
508+
if (parser.template[parser.index] === '/') {
509+
const char_start = parser.index;
510+
parser.index++; // consume '/'
511+
value = [
512+
{
513+
start: char_start,
514+
end: char_start + 1,
515+
type: 'Text',
516+
raw: '/',
517+
data: '/'
518+
}
519+
];
520+
end = parser.index;
521+
} else {
522+
value = read_attribute_value(parser);
523+
end = parser.index;
524+
}
509525
} else if (parser.match_regex(regex_starts_with_quote_characters)) {
510526
e.expected_token(parser.index, '=');
511527
}

0 commit comments

Comments
 (0)