diff --git a/profiles/aom.js b/profiles/aom.js index 175c33e934..7c690218be 100644 --- a/profiles/aom.js +++ b/profiles/aom.js @@ -15,6 +15,7 @@ const modules = [ import("../src/aom/abstract.js"), import("../src/core/data-transform.js"), import("../src/core/data-abbr.js"), + import("../src/core/algorithms.js"), import("../src/core/inlines.js"), import("../src/aom/conformance.js"), import("../src/core/dfn.js"), @@ -40,7 +41,6 @@ const modules = [ import("../src/core/list-sorter.js"), import("../src/core/highlight-vars.js"), import("../src/core/data-type.js"), - import("../src/core/algorithms.js"), import("../src/core/anchor-expander.js"), import("../src/core/dfn-panel.js"), import("../src/core/custom-elements/index.js"), diff --git a/profiles/dini.js b/profiles/dini.js index 794b8654b9..2955af93e7 100644 --- a/profiles/dini.js +++ b/profiles/dini.js @@ -15,6 +15,7 @@ const modules = [ import("../src/dini/abstract.js"), import("../src/core/data-transform.js"), import("../src/core/data-abbr.js"), + import("../src/core/algorithms.js"), import("../src/core/inlines.js"), import("../src/dini/conformance.js"), import("../src/core/dfn.js"), @@ -40,7 +41,6 @@ const modules = [ import("../src/core/list-sorter.js"), import("../src/core/highlight-vars.js"), import("../src/core/data-type.js"), - import("../src/core/algorithms.js"), import("../src/core/anchor-expander.js"), import("../src/core/dfn-panel.js"), import("../src/core/custom-elements/index.js"), diff --git a/profiles/geonovum.js b/profiles/geonovum.js index 34f17fc740..f8d883e3b0 100644 --- a/profiles/geonovum.js +++ b/profiles/geonovum.js @@ -13,6 +13,7 @@ const modules = [ import("../src/core/markdown.js"), import("../src/core/reindent.js"), import("../src/core/data-transform.js"), + import("../src/core/algorithms.js"), import("../src/core/inlines.js"), import("../src/core/dfn.js"), import("../src/core/pluralize.js"), @@ -39,7 +40,6 @@ const modules = [ import("../src/core/data-tests.js"), import("../src/core/list-sorter.js"), import("../src/core/highlight-vars.js"), - import("../src/core/algorithms.js"), import("../src/core/anchor-expander.js"), import("../src/core/dfn-panel.js"), import("../src/core/dfn-contract.js"), diff --git a/profiles/w3c.js b/profiles/w3c.js index 50537315c9..73393034aa 100644 --- a/profiles/w3c.js +++ b/profiles/w3c.js @@ -18,6 +18,7 @@ const modules = [ import("../src/w3c/abstract.js"), import("../src/core/data-transform.js"), import("../src/core/data-abbr.js"), + import("../src/core/algorithms.js"), import("../src/core/inlines.js"), import("../src/w3c/conformance.js"), import("../src/core/dfn.js"), @@ -55,7 +56,6 @@ const modules = [ import("../src/core/list-sorter.js"), import("../src/core/highlight-vars.js"), import("../src/core/data-type.js"), - import("../src/core/algorithms.js"), import("../src/core/anchor-expander.js"), import("../src/core/dfn-panel.js"), import("../src/core/custom-elements/index.js"), diff --git a/src/core/algorithms.js b/src/core/algorithms.js index 7829e20598..5f03cec54b 100644 --- a/src/core/algorithms.js +++ b/src/core/algorithms.js @@ -3,7 +3,6 @@ Currently used only for adding 'assert' class to algorithm lists */ import css from "../styles/algorithms.css.js"; -import { html } from "./import-maps.js"; export const name = "core/algorithms"; @@ -20,17 +19,21 @@ export function run() { for (const li of elements) { li.classList.add("assert"); - // Link "Assert" to https://infra.spec.whatwg.org/#assert + // Link "Assert" to infra spec using [=Assert=] syntax + // Add data-cite="infra" to the li if not already citing infra in the tree const textNode = li.firstChild; if ( textNode instanceof Text && textNode.textContent.startsWith("Assert: ") ) { - textNode.textContent = textNode.textContent.replace("Assert: ", ""); - li.prepend( - html`Assert`, - ": " + textNode.textContent = textNode.textContent.replace( + "Assert: ", + "[=Assert=]: " ); + // Add data-cite if infra is not already cited in the ancestor tree + if (!li.closest("[data-cite~='INFRA' i], [data-cite~='infra' i]")) { + li.dataset.cite = "INFRA"; + } } }