Document.documentElement vs document.all

Can someone tell me the difference between these two JavaScript commands?
What is the compatibility of these two main browsers? I know that documentElement compatible with most browsers.

thanks

+6
source share
2 answers

document.all is a proprietary extension of Microsoft's W3C standard.
This is an old feature and should no longer be used!

rfc document.all vs. document.getElementById

+5
source

document.documentElement - a link to the root element of the document, usually the <html> .

document.all is a collection type containing an enumeration of all child tags in a document. This IE is specific and should be avoided for multi-browser scenarios.

document.documentElement is DOM Level 2, so these days it should work in almost any large browser.

+5
source

Source: https://habr.com/ru/post/898867/


All Articles