While I was playing with Prototypejs JavaScript library, I found that
$$("*").length < document.getElementsByTagName("*").length
I wonder why prototypejs always gives a smaller number.
EDIT
After Dr. Molle Answer, I tried on another page, where I found the difference in length 3 is not always 1. Then I found that
and. which starts with "!" after angle brackets (total 1)
b. <! - → comment (there were 2 comments on the page) (total 2)
Interesting: "!" also appears as tagName along with another tag, for example. div, span, script, etc.
The following code is used in the IE Developer Tool
var allEles=document.getElementsByTagName("*");
$A(allEles).each(function(el){
console.log(el.tagName);
});
shows ..
LOG: !
LOG: HTML
LOG: HEAD
source
share