Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

are document.all and document.layers obsolete now

Tags:

javascript

I am going through some (old?) native javascript and I encountered a separation of document.getElementById, document.all and document.layers.

From what I know, document.all and document.layers are obsolete now, but I just wanted to make sure.

like image 831
Paul Avatar asked Apr 06 '13 18:04

Paul


Video Answer


1 Answers

Yes, they are obsolete.

The document.all collection is specific to Internet Explorer. The document.layers collection was specific to Netscape. Neither is in the standards.

Today we use document.getElementById instead.

See also: https://developer.mozilla.org/en-US/docs/Mozilla_Web_Developer_FAQ#JavaScript_doesn.E2.80.99t_work.21_Why.3F

like image 53
Guffa Avatar answered Nov 15 '22 14:11

Guffa