jQuery removing slash from self-closing tag
|Reported by:||Vic D'Elfant||Owned by:|
By accident, I found out that jQuery appears to be removing the closing slash from a self-closing XHTML tag when inserting this tag through .append(), .prepend() and other ways, which results in invalid XHTML which - on its turn - results in mangled markup.
The following code, for example:
$('body').append('<input type="hidden" name="test" value="test" />');
Results in the following:
<input name="test" value="test" type="hidden">
Whilst the expected output is:
<input name="test" value="test" type="hidden" />
Please see the attached file for a working POC.