${identifier}{{ ${str} }}`;
const title = "Error: Invalid inline IDL string.";
@@ -381,6 +423,20 @@ export function idlStringToHtml(str) {
});
return el;
}
+ const { tokens: results, typeHint: rawTypeHint } = parsed;
+ let typeHint = rawTypeHint;
+ if (typeHint && !validTypeHints.has(typeHint)) {
+ const el = html`{{ ${str} }}`;
+ showWarning(
+ `Unknown type hint "!!${typeHint}" in \`{{ ${str} }}\`. Falling back to default type resolution.`,
+ "core/inlines",
+ {
+ elements: [el],
+ hint: `Common types: attribute, method, event, interface, dict-member, const, enum-value.`,
+ }
+ );
+ typeHint = "";
+ }
const render = html(document.createDocumentFragment());
const output = [];
for (const details of results) {
@@ -391,13 +447,13 @@ export function idlStringToHtml(str) {
break;
}
case "attribute":
- output.push(renderAttribute(details));
+ output.push(renderAttribute(details, typeHint));
break;
case "internal-slot":
output.push(renderInternalSlot(details));
break;
case "method":
- output.push(renderMethod(details));
+ output.push(renderMethod(details, typeHint));
break;
case "enum":
output.push(renderEnum(details));
diff --git a/tests/spec/core/inlines-spec.js b/tests/spec/core/inlines-spec.js
index bdb85132d5..5cd9d65ba2 100644
--- a/tests/spec/core/inlines-spec.js
+++ b/tests/spec/core/inlines-spec.js
@@ -1,6 +1,13 @@
"use strict";
-import { flushIframes, makeRSDoc, makeStandardOps } from "../SpecHelper.js";
+import {
+ flushIframes,
+ makeRSDoc,
+ makeStandardOps,
+ warningFilters,
+} from "../SpecHelper.js";
+
+const inlinesWarningsFilter = warningFilters.filter("core/inlines");
describe("Core - Inlines", () => {
afterAll(flushIframes);
@@ -538,6 +545,42 @@ describe("Core - Inlines", () => {
);
});
+ it("links {{ Interface/event!!event }} to event-type definitions", async () => {
+ const body = `
+ {{ ScreenOrientation/change!!event }}
+{{ Window/event!!nonsense }}
+