I am writing a browser plug-in for Firefox(Greasemonkey), Opera and Chrome in Javascript for a website. The issue is, when I load the document.innerHTML into a variable,
<form name="foo" action="foo.php" method="get">
<td id="td">text:
<input name="k" type="text" />
</td>
</form>
... the original code above of the website(which I am writing the plug-in for) is converted into
<form name="foo" action="foo.php" method="get">
<td id="td">text:
**<input name="k" type="text">**
</td>
... this one. As you can see, the self-closing <input /> tag is not closed anymore, and the </form> tag also disappeared. I have googled almost all the internet but none of the solutions I read did not solve my problem.
<input>element is that it doesn't have descendants. The lack of a/>doesn't change that.<input>tag does not have to be closed in HTML, and in fact in HTML self-closing tags are syntactically incorrect anyway.