Thuộc tính document.documentElement trả về phần tử gốc của tài liệu (thường là <html>). Có thể lấy nodeName.
Ví dụ
<!DOCTYPE html>
<html>
<head>
<title>Ví dụ JavaScript</title>
</head>
<body>
<p>Demo Text</p>
<script>
document.body.style.backgroundColor = "gray";
var a = document.documentElement.nodeName;
document.write("Tên nút: " + a); // HTML
</script>
</body>
</html>