@@ -14,7 +14,8 @@ import { get_attribute_expression, is_expression_attribute } from '../../../util
1414import { closing_tag_omitted } from '../../../../html-tree-validation.js' ;
1515import { list } from '../../../utils/string.js' ;
1616
17- const regex_invalid_unquoted_attribute_value = / ^ ( \/ > | [ \s " ' = < > ` ] ) / ;
17+ const regex_invalid_unquoted_attribute_value_or_self_closing_tag = / ^ ( \/ > | [ \s " ' = < > ` ] ) / ;
18+ const regex_invalid_unquoted_attribute_value = / ^ [ \s " ' = < > ` ] / ;
1819const regex_closing_textarea_tag = / ^ < \/ t e x t a r e a ( \s [ ^ > ] * ) ? > / i;
1920const regex_closing_comment = / - - > / ;
2021const regex_whitespace_or_slash_or_closing_tag = / ( \s | \/ | > ) / ;
@@ -634,9 +635,15 @@ function read_attribute_value(parser) {
634635 try {
635636 value = read_sequence (
636637 parser ,
637- ( ) => {
638+ /** @param {number } chunk_length */
639+ ( chunk_length ) => {
638640 // handle common case of quote marks existing outside of regex for performance reasons
639- if ( quote_mark ) return parser . match ( quote_mark ) ;
641+ if ( quote_mark ) return ! ! parser . match ( quote_mark ) ;
642+
643+ // if chunk is not empty, handle possibility of self-closing tag
644+ if ( chunk_length > 0 ) {
645+ return ! ! parser . match_regex ( regex_invalid_unquoted_attribute_value_or_self_closing_tag ) ;
646+ }
640647 return ! ! parser . match_regex ( regex_invalid_unquoted_attribute_value ) ;
641648 } ,
642649 'in attribute value'
@@ -670,7 +677,7 @@ function read_attribute_value(parser) {
670677
671678/**
672679 * @param {Parser } parser
673- * @param {() => boolean } done
680+ * @param {(value: number ) => boolean } done
674681 * @param {string } location
675682 * @returns {any[] }
676683 */
@@ -700,7 +707,7 @@ function read_sequence(parser, done, location) {
700707 while ( parser . index < parser . template . length ) {
701708 const index = parser . index ;
702709
703- if ( done ( ) ) {
710+ if ( done ( current_chunk . raw . length ) ) {
704711 flush ( parser . index ) ;
705712 return chunks ;
706713 } else if ( parser . eat ( '{' ) ) {
0 commit comments