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

does not fix mismatching tags #247

Open
John-B opened this issue Feb 28, 2024 · 2 comments
Open

does not fix mismatching tags #247

John-B opened this issue Feb 28, 2024 · 2 comments

Comments

@John-B
Copy link

John-B commented Feb 28, 2024

DOMDocument::Serialize, which is called by Drupal's Html::normalize before Drupal 10, appears to fix mismatching tags, but HTML5-php does not.

With DOMDocument, Html::normalize() on <h3>Heading</h2> is giving <h3>Heading</h3>.
With HTL5-php, Html::normalize() on <h3>Heading</h2> is giving <h3>Heading</p>.

Arguably not a bug, though it has caused a regression in one use case (https://www.drupal.org/project/toc_api/issues/3416816)

@goetas
Copy link
Member

goetas commented Jul 17, 2024

can you please explain better what is the issue here? i'm not sure if I understand it correctly.. do you have a failing test case?

@John-B
Copy link
Author

John-B commented Jul 17, 2024

If passed non-matching or open h tags, expected behaviour is to match closing h tag, but this is not working.

I do not see a relevant Masterminds or Drupal test. Quick manual test:

  1. Make directory.
  2. Install Masterminds with composer.
  3. Place Masterminds/html5-php/example.php in the directory.
  4. Check the file runs: php ./example.php
  5. Now break the HTML by changing </h1> to </h2>. Or to </p>. Or by deleting </h1>. Run again.
  6. Expected output in all three cases is <h1>Hello World</h1>. Actual output is faulty HTML.

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

2 participants