From f79b7782b1423e7a4a4f81643823e221ec870cff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20C=C3=A1ceres?= Date: Fri, 13 Aug 2021 15:02:42 +1000 Subject: [PATCH] fix(core): revert making "task source" a type (#3744) --- src/core/dfn.js | 13 -------- src/core/inlines.js | 8 +---- tests/spec/core/dfn-spec.js | 64 ------------------------------------- 3 files changed, 1 insertion(+), 84 deletions(-) diff --git a/src/core/dfn.js b/src/core/dfn.js index 899929ec70..77609e232d 100644 --- a/src/core/dfn.js +++ b/src/core/dfn.js @@ -94,12 +94,6 @@ function computeType(dfn, linkingText) { case slotRegex.test(linkingText): type = processAsInternalSlot(linkingText, dfn); break; - - // A definition that ends with "task source" is a "task-source"... - case /\b task source$/i.test(linkingText): - type = "task-source"; - processAsTaskSource(dfn); - break; } // Derive closest type @@ -116,13 +110,6 @@ function computeType(dfn, linkingText) { // But other modules may end up adding a type (e.g., the WebIDL module) } -function processAsTaskSource(dfn) { - // Task sources are exported by default. - if (!dfn.matches(".no-export, [data-noexport]")) { - dfn.dataset.export = ""; - } -} - // Deal with export/no export function computeExport(dfn) { switch (true) { diff --git a/src/core/inlines.js b/src/core/inlines.js index ccd503df32..36db8320d4 100644 --- a/src/core/inlines.js +++ b/src/core/inlines.js @@ -214,14 +214,8 @@ function inlineAnchorMatches(matched) { : [null, content]; const processedContent = processInlineContent(text); const forContext = isFor ? norm(isFor) : null; - let type = "dfn"; - switch (true) { - case /task\s+source$/i.test(matched): - type = "task-source"; - break; - } return html` { } }); - it("automatically identifies task sources and exports them by default", async () => { - const body = ` -
-

Task sources

-

- - I'm a - task - source - - - - task source - - - - - secret - task source - - - - Custom task source - -

-
-
- `; - const ops = makeStandardOps(null, body); - const doc = await makeRSDoc(ops); - - const dfn = doc.getElementById("task-1"); - expect(dfn.dataset.dfnFor).toBeUndefined(); - expect(dfn.dataset.export).toBe(""); - expect(dfn.dataset.dfnType).toBe("task-source"); - - const dfn2 = doc.getElementById("task-2"); - expect(dfn2.dataset.dfnFor).toBeUndefined(); - expect(dfn2.dataset.export).toBeUndefined(); - expect(dfn2.dataset.dfnType).toBe("dfn"); - - const dfn3 = doc.getElementById("task-3"); - expect(dfn3.dataset.dfnFor).toBeUndefined(); - expect(dfn3.dataset.export).toBeUndefined(); - expect(dfn3.dataset.dfnType).toBe("task-source"); - expect(dfn3.dataset.noexport).toBe(""); - - const dfn4 = doc.getElementById("task-4"); - expect(dfn4.dataset.dfnFor).toBeUndefined(); - expect(dfn4.dataset.export).toBeUndefined(); - expect(dfn4.dataset.dfnType).toBe("custom-type"); - expect(dfn4.dataset.noexport).toBe(""); - - const [link1, link2] = doc.querySelectorAll("#links a"); - expect(link1.hash).toBe(`#${dfn.id}`); - expect(link2.hash).toBe(`#${dfn.id}`); - expect(link2.dataset.linkType).toBe(`task-source`); - }); - it("supports permission type", async () => { const ops = { config: makeBasicConfig(),