DocumentType: thuộc tính publicId

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 publicId của DocumentType trả về mã định danh hình thức 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().

Giá trị

Một chuỗi.

Ví dụ

js
const docType = document.implementation.createDocumentType(
  "svg",
  "-//W3C//DTD SVG 1.1//EN",
  "http://www.w3.org/2000/svg",
);

console.log(docType.publicId); // Hiển thị "-//W3C//DTD SVG 1.1//EN"

Thông số kỹ thuật

Thông số kỹ thuật
DOM
# dom-documenttype-publicid

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