Skip to content

unquoted attribute at end of self-closing tag consumes trailing slash #132

Description

@ianjosephwilson

Confusing situation where we are missing the space before the self-closing component tag:

from string.templatelib import Template

from tdom import html


def AuthStatus(logged_in: bool = False) -> Template:
    msg = 'In' if logged_in else 'Out'
    return t'<div>{msg}</div>'


test_t = t'<{AuthStatus} logged_in={True}/>'

try:
    print (html(test_t))
except ValueError as e:
    print (e)


test_t = t'<div><{AuthStatus} logged_in={True}/></div>'

try:
    print (html(test_t))
except ValueError as e:
    print (e)


test_t = t'<div><{AuthStatus} logged_in={True} /></div>'

try:
    print (html(test_t))
except ValueError as e:
    print (e)
Invalid HTML structure: unclosed tags remain.
Mismatched closing tag </div> for component starting at AuthStatus.
<div><div>In</div></div>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions