Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Self-closing tags in views #982

Open
code-distortion opened this issue Mar 9, 2025 · 0 comments
Open

Self-closing tags in views #982

code-distortion opened this issue Mar 9, 2025 · 0 comments
Labels
Triage New issues that need to be reviewed by the Tempest team.

Comments

@code-distortion
Copy link

Tempest version

1.0-alpha.5

PHP version

8.4

Operating system

Linux

Description

Hi there. Tags like <br/> and <img src="xyz.jpg"/> are expanded to <br></br> and <img src="xyz.jpg"></img> by Dom\HTMLDocument.

Specifically by $dom->saveHtml().

Steps to reproduce

I'll add a failing test for this:

public function test_self_closing_tag(): void
{
    $html = $this->render(<<<'HTML'
    <html lang="en"><body>Hello<br/>there</body></html>
    HTML);

    $this->assertStringEqualsStringIgnoringLineEndings(<<<'HTML'
    <html lang="en"><body>Hello<br/>there</body></html>
    HTML, $html);

    // produces "<html lang="en"><body>Hello<br></br>there</body></html>"
}
@code-distortion code-distortion added the Triage New issues that need to be reviewed by the Tempest team. label Mar 9, 2025
code-distortion added a commit to code-distortion/tempest-framework that referenced this issue Mar 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Triage New issues that need to be reviewed by the Tempest team.
Projects
None yet
Development

No branches or pull requests

1 participant