Octane,
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<div> </div> <p> </p> <p> </p> 123
<script language="JavaScript" type="text/javascript">
alert( document.getElementsByTagName('div')[0].nextSibling ); // object text
function normalize(element) {
var i, textNodes = [];
(function (element) {
var i, node, nodes = element.childNodes, length = nodes.length;
for (i = 0; i < length; i++) {
node = nodes[i];
if (node.nodeType == 3 && !node.nodeValue) {
textNodes.push(node);
} else if(node.hasChildNodes()) {
arguments.callee(node);
}
}
})(element);
for (i = 0; i < textNodes.length; i++) {
textNodes[i].parentNode.removeChild(textNodes[i]);
}
}
normalize(document.body);
alert( document.getElementsByTagName('div')[0].nextSibling ); /// object text
</script>
</body>
</html>
Тестил под Opera.