@@ -18,7 +18,6 @@ import {
18
18
} from "./dfn-validators.js" ;
19
19
import { registerDefinition } from "./dfn-map.js" ;
20
20
import { slotRegex } from "./inline-idl-parser.js" ;
21
- import { sub } from "./pubsubhub.js" ;
22
21
23
22
export const name = "core/dfn" ;
24
23
@@ -78,7 +77,6 @@ export function run() {
78
77
}
79
78
dfn . dataset . lt = titles . join ( "|" ) ;
80
79
}
81
- sub ( "plugins-done" , completeDefinitionMarkup ) ;
82
80
}
83
81
84
82
/**
@@ -215,63 +213,3 @@ function processAsInternalSlot(title, dfn) {
215
213
}
216
214
return dfnType ;
217
215
}
218
-
219
- function completeDefinitionMarkup ( ) {
220
- addContractDefaults ( ) ;
221
- addDefinitionPointers ( ) ;
222
- }
223
-
224
- function addContractDefaults ( ) {
225
- // Find all dfns that don't have a type and default them to "dfn".
226
- /** @type NodeListOf<HTMLElement> */
227
- const dfnsWithNoType = document . querySelectorAll (
228
- "dfn:is([data-dfn-type=''],:not([data-dfn-type]))"
229
- ) ;
230
- for ( const dfn of dfnsWithNoType ) {
231
- dfn . dataset . dfnType = "dfn" ;
232
- }
233
-
234
- // Per "the contract", export all definitions, except where:
235
- // - Explicitly marked with data-noexport.
236
- // - The type is "dfn" and not explicitly marked for export (i.e., just a regular definition).
237
- // - definitions was included via (legacy) data-cite="foo#bar".
238
- /** @type NodeListOf<HTMLElement> */
239
- const exportableDfns = document . querySelectorAll (
240
- "dfn:not([data-noexport], [data-export], [data-dfn-type='dfn'], [data-cite])"
241
- ) ;
242
- for ( const dfn of exportableDfns ) {
243
- dfn . dataset . export = "" ;
244
- }
245
- }
246
-
247
- // - Sets data-defines on well-known definition content patterns
248
- function addDefinitionPointers ( ) {
249
- // A dl with class hasdefinitions associated the dfn in each dt
250
- // the definition in the following sibling element
251
- /** @type NodeListOf<HTMLElement> */
252
- const describedDTs = document . querySelectorAll (
253
- "dl.definitions dt:has(dfn[data-dfn-type])"
254
- ) ;
255
- for ( const dt of describedDTs ) {
256
- const dfnId = dt . querySelector ( "dfn[data-dfn-type]" ) . id ;
257
- const dfnContent = /** @type {HTMLElement | null } */ (
258
- dt . nextElementSibling
259
- ) ;
260
- if ( dfnContent && ! dfnContent . dataset . defines && dfnId ) {
261
- dfnContent . dataset . defines = `#${ dfnId } ` ;
262
- }
263
- }
264
-
265
- // an element with class "definition" is marked as defining the term
266
- // found in the element
267
- /** @type NodeListOf<HTMLElement> */
268
- const definitionContainers = document . querySelectorAll (
269
- ".definition:has(dfn[data-dfn-type])"
270
- ) ;
271
- for ( const el of definitionContainers ) {
272
- const dfn = el . querySelector ( "dfn[data-dfn-type]" ) ;
273
- if ( dfn . id && ! el . dataset . defines ) {
274
- el . dataset . defines = `#${ dfn . id } ` ;
275
- }
276
- }
277
- }
0 commit comments