DocumentType: thuộc tính name

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

Thuộc tính chỉ đọc name của DocumentType trả về kiểu của tài liệu.

Với DocumentType tổng hợp, thuộc tính này phản ánh giá trị được truyền vào tham số của DOMImplementation.createDocumentType().

Với tài liệu HTML, trình duyệt luôn đặt giá trị này là html, bất kể doctype thực tế trong mã nguồn là gì.

Giá trị

Một chuỗi.

Ví dụ

js
const docType = document.implementation.createDocumentType("html", "", "");

console.log(docType.name); // Hiển thị `html`

Thông số kỹ thuật

Specification
DOM
# dom-documenttype-name

Tương thích trình duyệt