<!DOCTYPE html>
<html>
<head>
<title>Test</title>
</head>
<script type="text/javascript">
function fire() {
console.log(document.body.children.length);
console.log(document.body.children[0].children.length);
}
</script>
<body onload="fire()">
<div>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer pharetra ipsum erat. Aenean convallis laoreet massa, et gravida purus faucibus ac. <a id="test"/>Vestibulum libero justo.</p>
</div>
</body>
</html>
When you open the console, you'll see that the <a> is a children of <body>, <div> and <p>. WTF??
If <a> is closed with a "proper" closing tag the issue disappears and its only child of <p>.
Can someone explain this to me?
PS: Tested on Chrome stable.