Skip to content

HtmlUnitNekoDOMBuilder: Fix to allow <form> in <table> children - #548

Closed
atnak wants to merge 3 commits into
HtmlUnit:masterfrom
atnak:forms_in_tables
Closed

HtmlUnitNekoDOMBuilder: Fix to allow <form> in <table> children#548
atnak wants to merge 3 commits into
HtmlUnit:masterfrom
atnak:forms_in_tables

Conversation

@atnak

@atnak atnak commented Feb 1, 2023

Copy link
Copy Markdown
Contributor

This PR contains:

  • Fix to allow <form> in table children just like <script>

@atnak

atnak commented Feb 1, 2023

Copy link
Copy Markdown
Contributor Author

Here's my local test for this but possibly the tests already in MalformedHtmlTest cover this situation because applying this fix reduced the number of errors by MalformedHtmlTest

Input:

<html>
<body>
<table>
	<form></form>
	<tbody>
		<tr>
		</tr>
	</tbody>
	<form></form>
	<script></script>
</table>

<table>
	<form></form>
	<tr>
	</tr>
	<form></form>
	<script></script>
</table>
</body>
</html>

Expected:

String[] expected = {
		"<?xml version='1.0' encoding='UTF-8'?>",
		"<html>",
		"  <head/>",
		"  <body>",
		"    <table>",
		"      <form>",
		"      </form>",
		"      <tbody>",
		"        <tr>",
		"        </tr>",
		"      </tbody>",
		"      <form>", // Not synthesized <tbody> so these are not moved
		"      </form>",
		"      <script>",
		"      </script>",
		"    </table>",
		"    <table>",
		"      <form>",
		"      </form>",
		"      <tbody>",
		"        <tr>",
		"        </tr>",
		"        <form>", // These are moved into synthesized <tbody>
		"        </form>",
		"        <script>",
		"        </script>",
		"      </tbody>",
		"    </table>",
		"  </body>",
		"</html>",
		"",

@atnak

atnak commented Feb 1, 2023

Copy link
Copy Markdown
Contributor Author

It looked like MalformedHtmlTest.formInTable4() and MalformedHtmlTest.formInTable8() can be fixed so I've pushed them as well

@rbri

rbri commented Feb 1, 2023

Copy link
Copy Markdown
Member

Have merged your fix manually - many thanks.

@rbri rbri closed this Feb 1, 2023
@atnak
atnak deleted the forms_in_tables branch February 1, 2023 17:24
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

Successfully merging this pull request may close these issues.

2 participants