Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/core/title.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,18 @@ export function run(conf) {
}

// Decorate the spec title
if (!h1Elem.id) h1Elem.id = "title";
if (!h1Elem.id) {
const existing = document.getElementById("title");
if (existing && existing !== h1Elem) {
const msg =
'Another element already uses `id="title"`. ' +
"The spec's `<h1>` will use a different id to avoid a collision.";
showError(msg, name, { elements: [existing] });
h1Elem.id = "document-title";
} else {
h1Elem.id = "title";
}
}
h1Elem.classList.add("title");

setDocumentTitle(conf, h1Elem);
Expand Down