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

->plaintext contains comments from <styles> in <head> if <meta> tag is existing #114

Open
klammbueddel opened this issue Sep 11, 2024 · 0 comments

Comments

@klammbueddel
Copy link

klammbueddel commented Sep 11, 2024

What is this feature about (expected vs actual behaviour)?

This test should pass but it fails with <!---->foobar not beeing equal to 'foobar'

    public function testTextWithCommentsInStyle()
    {
        $html = '<html><head><meta charset="utf-8"><style><!----></style></head><body><div><p>foo</p><p>bar</p></div></body></html>';
        $element = new HtmlDomParser($html);

        static::assertSame('foobar', $element->text());
        static::assertSame('foobar', $element->plaintext);
    }

Does it take minutes, hours or days to fix?

I suppose minutes

Additional notes

It seems to be this special combination of meta, style and comment which leads to the issue. Outlook will generate this kind of html in its emails ;)

  • Removing meta tag fixes test
  • Renaming style tag fixes test
  • Removing charset="utf-8" from meta tag fixes test
  • Closing meta tag fixes test
  • Selfclosing meta tag fixes test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant