webref
webref copied to clipboard
Look for duplicate exported dfns
Some specs define and export terms that are defined elsewhere, see e.g. discussion in https://github.com/w3c/respec/issues/3687
There may be valid cases where this is needed. It would be good to first look at exported dfns and list terms that are defined more than once.
See also https://github.com/w3c/aria/pull/1510
Here is a first dump of exported terms defined in more than one spec. This is the result of parsing the dfns extracts with the following rules:
- Only consider exported dfns (
dfn.access === 'public') - Only consider root dfns (
dfn.for.length === 0) - Consider that dfns in CSS modules override the same dfns in CSS 2 and SVG 2
- Consider that
css-aligndfns override those incss-flexbox - Consider that
css-positiondfns override those incss-logical - Ignore duplicate IDL terms, we know about them and fix them already through IDL patches (although note we don't yet fix them in
dfnsextracts) - Ignore duplicate elements in HTML and SVG 2 (the
a,link,style,titleelements)
These rules take care of most but not all of the duplicate CSS properties identified in https://github.com/w3c/webref/issues/127#issuecomment-874135280.
Looking at the results, there are a number of cases where the duplicates are warranted (e.g. the notion of attribute in DOM is different from the notion of attribute in Web IDL). There are cases where specs need fixing (e.g. wai-aria should reference Infra for user agent, conformant server should not be exported, Trusted Types has a few weird constructs). And there are cases that are questionable (e.g. the notion of character? Why does Page Lifecycle re-define discard, is it an extended dfn?)
Duplicate dfns with same type (27 found)
*: Clear Site Data, CSS Values and Units Module Level 4<integer>: CSS Syntax Module Level 3, CSS Values and Units Module Level 4<media-query>: CSS Cascading and Inheritance Level 4, Media Queries Level 4<supports-condition>: CSS Cascading and Inheritance Level 4, CSS Conditional Rules Module Level 3alignment baseline: CSS Box Alignment Module Level 3, CSS Inline Layout Module Level 3append an attribute: DOM Standard, Trusted Typesattribute: DOM Standard, Accessible Rich Internet Applications (WAI-ARIA) 1.3, Web IDLbase64-value: Content Security Policy Level 3, Subresource Integritybaseline alignment preference: CSS Box Alignment Module Level 3, CSS Inline Layout Module Level 3character: Infra Standard, CSS Text Module Level 3conformant server: Incremental Font Transfer, Web Audio APIconformant user agent: Incremental Font Transfer, Web Audio APIcontent(): CSS Generated Content Module Level 3, CSS Generated Content for Paged Media Moduleelement: DOM Standard, Accessible Rich Internet Applications (WAI-ARIA) 1.3event: DOM Standard, WebDriver BiDi, Accessible Rich Internet Applications (WAI-ARIA) 1.3identifier: CSS Syntax Module Level 3, Web IDLlocal coordinate system: CSS Transforms Module Level 1, Generic Sensor APImultiply: CSS Transforms Module Level 1, Geometry Interfaces Module Level 1post-multiply: CSS Transforms Module Level 1, Geometry Interfaces Module Level 1pre-multiply: CSS Transforms Module Level 1, Geometry Interfaces Module Level 1Process response policy: Document Policy, Permissions Policystatus: Fetch Standard, WebDriver BiDistring(): CSS Generated Content Module Level 3, CSS Generated Content for Paged Media Modulestring-set: CSS Generated Content Module Level 3, CSS Generated Content for Paged Media Modulesynchronized: Scalable Vector Graphics (SVG) 2, Scalable Vector Graphics (SVG) 2user agent: Infra Standard, Accessible Rich Internet Applications (WAI-ARIA) 1.3widget: CSS Basic User Interface Module Level 4, Accessible Rich Internet Applications (WAI-ARIA) 1.3
Duplicate dfns with different types (54 found)
+: CSS Values and Units Module Level 4, Selectors Level 4background: HTML Standard, CSS Backgrounds and Borders Module Level 3base: HTML Standard, CSS Ruby Annotation Layout Module Level 1block-size: CSS Logical Properties and Values Level 1, CSS Writing Modes Level 4body: Fetch Standard, HTML Standardboolean: Infra Standard, Web IDLborder: CSS Backgrounds and Borders Module Level 3, CSS Box Model Module Level 3bottom: CSS Positioned Layout Module Level 3, CSS Writing Modes Level 4byte: Infra Standard, Web IDLcanvas: HTML Standard, Scalable Vector Graphics (SVG) 2color: CSS Color Module Level 4, CSS Color Module Level 4columns: CSS Multi-column Layout Module Level 1, CSS Table Module Level 3discard: HTML Standard, SVG Animations, Page LifecycleDOMString: Accessible Rich Internet Applications (WAI-ARIA) 1.3, Web IDLElement: DOM Standard, Accessible Rich Internet Applications (WAI-ARIA) 1.3Event: DOM Standard, Accessible Rich Internet Applications (WAI-ARIA) 1.3filter: Filter Effects Module Level 1, Filter Effects Module Level 1float: CSS Page Floats, Web IDLfont: HTML Standard, CSS Fonts Module Level 4Global: WebAssembly JavaScript Interface, Web IDLgrid: CSS Grid Layout Module Level 2, CSS Grid Layout Module Level 2header: Fetch Standard, HTML Standardheight: CSS Box Sizing Module Level 3, CSS Box Sizing Module Level 3, CSS Writing Modes Level 4inline-size: CSS Logical Properties and Values Level 1, CSS Writing Modes Level 4isolation: Compositing and Blending Level 1, CSS Writing Modes Level 4Landmark: Accelerated Shape Detection in Images, Accessible Rich Internet Applications (WAI-ARIA) 1.3left: CSS Positioned Layout Module Level 3, CSS Writing Modes Level 4map: HTML Standard, Infra Standardmargin: CSS Box Model Module Level 3, CSS Box Model Module Level 3mask: CSS Masking Module Level 1, CSS Masking Module Level 1mask-position: CSS Masking Module Level 1, CSS Masking Module Level 1mask-size: CSS Masking Module Level 1, CSS Masking Module Level 1Node: DOM Standard, Accessible Rich Internet Applications (WAI-ARIA) 1.3object: HTML Standard, Accessible Rich Internet Applications (WAI-ARIA) 1.3, Web IDLoverflow: CSS Overflow Module Level 3, CSS Overflow Module Level 3pause: HTML Standard, CSS Speech Module Level 1right: CSS Positioned Layout Module Level 3, CSS Writing Modes Level 4role: HTML Standard, Scalable Vector Graphics (SVG) 2, Accessible Rich Internet Applications (WAI-ARIA) 1.3script: HTML Standard, HTML Standard, Scalable Vector Graphics (SVG) 2set: Infra Standard, SVG Animationsslot: DOM Standard, HTML Standardsource: HTML Standard, Media Capture and Streamsspan: HTML Standard, CSS Table Module Level 3symbol: Scalable Vector Graphics (SVG) 2, Web IDLtop: CSS Positioned Layout Module Level 3, CSS Writing Modes Level 4TrustedHTML: Trusted Types, Trusted TypesTrustedScript: Trusted Types, Trusted TypesTrustedScriptURL: Trusted Types, Trusted TypesTrustedTypePolicy: Trusted Types, Trusted TypesTrustedTypePolicyFactory: Trusted Types, Trusted TypesTrustedTypePolicyOptions: Trusted Types, Trusted TypesURL: URL Standard, URL Standardwidth: CSS Box Sizing Module Level 3, CSS Box Sizing Module Level 3, CSS Writing Modes Level 4||: CSS Values and Units Module Level 4, Selectors Level 4
in the list of same name, different types, there were 6 were the duplicate came from the same spec (Trusted Types), due to a bug in the markup - PR filed at https://github.com/w3c/webappsec-trusted-types/pull/348
re "character" in the first list, it's interesting that the visible term in Infra is actually "code point", with character only provided as an alternate linking text - maybe one that should be deprecated given the ambiguity of the term.
~~I'm surprised the 2nd list is so short; for instance, width is also used in HTML, SVG, as a mediastreamtrack constraint, etc.~~ I guess these are filtered out by the "root-only dfns" rule.
Note code that produces the previous report is in a dedicated Reffy branch: https://github.com/w3c/reffy/blob/study-dfns/src/cli/study-dfns.js
I leave a note here but please tell me if you prefer that I open a dedicated issue.
<rgb()> and <hsl()> are defined with a legacy syntax that @webref/css does not extract. The legacy syntax defines a comma separated list of arguments while the modern syntax defines a whitespace/slash separated list. The legacy syntax will never be removed, I presume, and I would bet many CSS authors use the legacy syntax instead of the new one.
<!-- Markup for the modern syntax -->
<pre class="prod highlight">
<dfn class="dfn-paneled" data-dfn-type="function" data-export="" id="funcdef-hsl">
<c- nf="">hsl</c-><c- p="">()</c->
</dfn>
<!-- ... -->
</pre>
<!-- Markup for the legacy syntax -->
<pre class="prod highlight">
<c- nf="">hsl</c-><c- p="">()</c->
<!-- ... -->
</pre>
I'm not sure what to suggest and where to suggest it. I believe that Bikeshed should allow defining a legacy syntax that @webref/css could assign to an additional legacy for an entry in valuespace, but to my knowledge, these are the only types that have two value definitions defined in the same spec.
Thanks @cdoublev, I moved your comment to a dedicated issue #563.
Refreshing the list of duplicate definitions and completing with the list of IDL terms that are defined more than once (before patches are applied):
Duplicate dfns with same type (64 found)
*: Clear Site Data, CSS Values and Units Module Level 4:fullscreen: Fullscreen API Standard, Selectors Level 4<integer>: CSS Syntax Module Level 3, CSS Values and Units Module Level 4alignment baseline: CSS Box Alignment Module Level 3, CSS Inline Layout Module Level 3animation-delay: CSS Animations Level 1, Scroll-linked Animationsappend an attribute: DOM Standard, Trusted TypesASCII case-insensitive: Infra Standard, Internationalization Glossaryattribute: DOM Standard, Web IDL Standardaudio: HTML Standard, EPUB 3.3base64-value: Content Security Policy Level 3, Subresource Integritybaseline alignment preference: CSS Box Alignment Module Level 3, CSS Inline Layout Module Level 3cap shapes: CSS Fill and Stroke Module Level 3, SVG Strokesch-prefers-color-scheme: Client Hints Infrastructure, User Preference Media Features Client Hints Headersch-prefers-reduced-motion: Client Hints Infrastructure, User Preference Media Features Client Hints Headerscharacter: Infra Standard, CSS Text Module Level 3code unit: Infra Standard, Internationalization Glossaryconsumer: Internationalization Glossary, Media Capture and Streamscontent(): CSS Generated Content Module Level 3, CSS Generated Content for Paged Media Moduledash positions: CSS Fill and Stroke Module Level 3, SVG Strokesdevicechange: Media Capture and Streams, Screen Capturedocument: DOM Standard, CSS Style Attributesenabled: Internationalization Glossary, Media Capture and Streamsentailment regime: RDF 1.1 Concepts and Abstract Syntax, RDF 1.1 Semanticsevent: DOM Standard, WebDriver BiDiextension: Internationalization Glossary, RDF 1.1 Semanticsfallback: CSS Box Sizing Module Level 3, Internationalization Glossaryhead: HTML Standard, EPUB 3.3idempotent: RFC 7231 - Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content, RFC 9110 - HTTP Semanticsinterpolation: CSS Values and Units Module Level 4, RDF 1.1 SemanticsIRI: RDF 1.1 Concepts and Abstract Syntax, RDF 1.1 Semanticsisomorphic: RDF 1.1 Concepts and Abstract Syntax, RDF 1.1 Semanticslanguage tag: Internationalization Glossary, RDF 1.1 Concepts and Abstract Syntaxlexical-to-value mapping: RDF 1.1 Concepts and Abstract Syntax, RDF 1.1 Semanticsline join shape: CSS Fill and Stroke Module Level 3, SVG Strokeslink: HTML Standard, EPUB 3.3, Scalable Vector Graphics (SVG) 2literal: RDF 1.1 Concepts and Abstract Syntax, RDF 1.1 Semanticslocal coordinate system: CSS Transforms Module Level 1, Generic Sensor APImeta: HTML Standard, EPUB 3.3multiply: CSS Transforms Module Level 1, Geometry Interfaces Module Level 1namespace: Web IDL Standard, RDF 1.1 Concepts and Abstract Syntaxnamespace prefix: CSS Namespaces Module Level 3, RDF 1.1 Concepts and Abstract Syntaxpost-multiply: CSS Transforms Module Level 1, Geometry Interfaces Module Level 1pre-multiply: CSS Transforms Module Level 1, Geometry Interfaces Module Level 1predicate: RDF 1.1 Concepts and Abstract Syntax, RDF 1.1 Semanticsrange: DOM Standard, Internationalization GlossaryRDF dataset: RDF 1.1 Concepts and Abstract Syntax, RDF 1.1 SemanticsRDF graph: RDF 1.1 Concepts and Abstract Syntax, RDF 1.1 SemanticsRDF source: RDF 1.1 Concepts and Abstract Syntax, RDF 1.1 SemanticsRDF triple: RDF 1.1 Concepts and Abstract Syntax, RDF 1.1 SemanticsRDF vocabulary: RDF 1.1 Concepts and Abstract Syntax, RDF 1.1 Semanticsreferent: RDF 1.1 Concepts and Abstract Syntax, RDF 1.1 Semanticsresources: Internationalization Glossary, RDF 1.1 Concepts and Abstract Syntaxrole: HTML Standard, Scalable Vector Graphics (SVG) 2service constructor: ECMAScript® 2023 Internationalization API Specification, Intl Enumeration API Specificationstatus: Fetch Standard, WebDriver BiDistring(): CSS Generated Content Module Level 3, CSS Generated Content for Paged Media Modulestring-set: CSS Generated Content Module Level 3, CSS Generated Content for Paged Media Modulestroke shape: CSS Fill and Stroke Module Level 3, SVG Strokessubject: RDF 1.1 Concepts and Abstract Syntax, RDF 1.1 Semanticssurrogate: Infra Standard, Internationalization Glossarytext: EPUB 3.3, Scalable Vector Graphics (SVG) 2valid: Internationalization Glossary, RDF 1.1 Semanticsvalue space: RDF 1.1 Concepts and Abstract Syntax, RDF 1.1 Semanticswidget: CSS Basic User Interface Module Level 4, MiniApp Packaging
Duplicate dfns with different types (64 found)
+: CSS Values and Units Module Level 4, Selectors Level 4<dasharray>: SVG Strokes, Scalable Vector Graphics (SVG) 2animation: CSS Animations Level 1, Web Animationsannotation: CSS Ruby Annotation Layout Module Level 1, MathML Corebackground: HTML Standard, CSS Backgrounds and Borders Module Level 3base: HTML Standard, CSS Ruby Annotation Layout Module Level 1block-size: CSS Logical Properties and Values Level 1, CSS Writing Modes Level 4body: Fetch Standard, HTML Standard, EPUB 3.3boolean: Infra Standard, Web IDL Standardborder: CSS Backgrounds and Borders Module Level 3, CSS Box Model Module Level 3bottom: CSS Positioned Layout Module Level 3, CSS Writing Modes Level 4byte: Infra Standard, Web IDL Standardcanvas: HTML Standard, Scalable Vector Graphics (SVG) 2class: MathML Core, RDF 1.1 Semanticscollection: DOM Standard, EPUB 3.3color: CSS Color Module Level 4, CSS Color Module Level 4columns: CSS Multi-column Layout Module Level 1, CSS Table Module Level 3cursor: CSS Basic User Interface Module Level 4, Screen CaptureDefault: Web IDL Standard, Screen Orientationdir: HTML Standard, MathML Corediscard: SVG Animations, Page Lifecyclefilter: Filter Effects Module Level 1, Filter Effects Module Level 1float: Web IDL Standard, CSS Page Floatsfont: HTML Standard, CSS Fonts Module Level 4Function: ECMAScript® 2023 Language Specification, Web IDL StandardGlobal: Web IDL Standard, MiniApp Lifecycle, WebAssembly JavaScript Interfacegrid: CSS Grid Layout Module Level 2, CSS Grid Layout Module Level 2header: Fetch Standard, HTML Standardheight: CSS Box Sizing Module Level 3, CSS Box Sizing Module Level 3, CSS Writing Modes Level 4, Screen Captureid: WebDriver BiDi, MathML Coreinline-size: CSS Logical Properties and Values Level 1, CSS Writing Modes Level 4isolation: Compositing and Blending Level 1, CSS Writing Modes Level 4label: HTML Standard, Web App Manifest - Application Informationleft: CSS Positioned Layout Module Level 3, CSS Writing Modes Level 4manifest: Web Application Manifest, EPUB 3.3, MiniApp Manifestmap: HTML Standard, Infra Standardmargin: CSS Box Model Module Level 3, CSS Box Model Module Level 3mask: CSS Masking Module Level 1, CSS Masking Module Level 1mask-position: CSS Masking Module Level 1, CSS Masking Module Level 1mask-size: CSS Masking Module Level 1, CSS Masking Module Level 1metadata: EPUB 3.3, Internationalization Glossary, Scalable Vector Graphics (SVG) 2object: HTML Standard, Web IDL Standard, RDF 1.1 Concepts and Abstract Syntax, RDF 1.1 Semanticsoverflow: CSS Overflow Module Level 3, CSS Overflow Module Level 3pause: HTML Standard, CSS Speech Module Level 1right: CSS Positioned Layout Module Level 3, CSS Writing Modes Level 4script: HTML Standard, HTML Standard, Scalable Vector Graphics (SVG) 2set: Infra Standard, SVG Animationsslot: DOM Standard, HTML Standardsource: HTML Standard, Media Capture and Streamsspan: HTML Standard, CSS Table Module Level 3stroke: CSS Fill and Stroke Module Level 3, SVG Strokesstroke-dasharray: CSS Fill and Stroke Module Level 3, SVG Strokesstroke-dashoffset: CSS Fill and Stroke Module Level 3, SVG Strokesstroke-linecap: CSS Fill and Stroke Module Level 3, SVG Strokesstroke-linejoin: CSS Fill and Stroke Module Level 3, SVG Strokesstroke-miterlimit: CSS Fill and Stroke Module Level 3, SVG Strokesstroke-opacity: CSS Fill and Stroke Module Level 3, SVG Strokesstroke-width: CSS Fill and Stroke Module Level 3, SVG Strokesstyle: HTML Standard, MathML Core, Scalable Vector Graphics (SVG) 2symbol: Web IDL Standard, Scalable Vector Graphics (SVG) 2top: CSS Positioned Layout Module Level 3, CSS Writing Modes Level 4URL: URL Standard, URL Standardwidth: CSS Box Sizing Module Level 3, CSS Box Sizing Module Level 3, CSS Writing Modes Level 4, Screen Capture||: CSS Values and Units Module Level 4, Selectors Level 4
Duplicate IDL dfns (11 found)
DOMParser: HTML Standard, Trusted TypesEvalError: ECMAScript® 2023 Language Specification, Web IDL StandardMessageEventSource: HTML Standard, PortalsMutationEvent: DOM Standard, UI EventsPermissionState: DeviceOrientation Event Specification, PermissionsRangeError: ECMAScript® 2023 Language Specification, Web IDL StandardReferenceError: ECMAScript® 2023 Language Specification, Web IDL StandardRTCStats: Identifiers for WebRTC's Statistics API, WebRTC 1.0: Real-Time Communication Between BrowsersSyntaxError: ECMAScript® 2023 Language Specification, Web IDL StandardTypeError: ECMAScript® 2023 Language Specification, Web IDL StandardURIError: ECMAScript® 2023 Language Specification, Web IDL Standard
Reflecting on the duplicate IDL dfns:
DOMParser: definition in Trusted Types appears in an IDL block flagged with an"exclude"class. Definitions should probably not be extracted at all.MessageEventSource,PermissionState: handled in IDL patch. Could be hardcoded in Reffy.MutationEvent: legacy, defined as removed in DOM, and deprecated in UI Events. Could be hardcoded in Reffy.RTCStats: definition in WebRTC Stats is informative (but exported).EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError: Shouldn't Web IDL reference definitions in ECMAScript rather than define the terms? Or do we want to prefer Web IDL definitions because they are closer to relevant algorithms for Web specs?
RTCStats: definition in WebRTC Stats is informative (but exported).
Marking the definition as non-exported should be an easily accepted patch there
EvalError, RangeError, ReferenceError, SyntaxError, TypeError, URIError: Shouldn't Web IDL reference definitions in ECMAScript rather than define the terms? Or do we want to prefer Web IDL definitions because they are closer to relevant algorithms for Web specs?
From the discussion in https://github.com/w3c/reffy/pull/732, I believe it was indeed preferred to keep WebIDL as an intermediary, although I'm not sure how deeply discussed this was.
Duplicate dfns with same type
Some of these are different concepts altogether of terms that happen to be the same across specs (e.g. an attribute in DOM is quite different from an attribute in WebIDL); some of these are for concepts that are pretty close but not fully equivalent definitions (e.g. surrogate in Infra & I18N glossary); some of these are explicitly duplicate definitions that happen to be repeated for mostly logistical / editorial reasons (e.g. the overlap between rdf concepts & rdf semantics; the duplicates across CSS modules).
I think these 3 categories probably lead to different type of solutions:
- for the 1st one, namespacing with a
dfn-forthe definitions would be an obvious candidate - not sure if that would work across the board though - for the 2nd one, trying to get convergence on a single definition in a single place would be the ideal approach; if not possible, trying to encourage using different terms would be an alternative
- for the 3rd one, we would probably want a mechanism to describe this equivalence relationship - this would allow in ReSpec and Bikeshed to avoid the duplicate warning; in ReSpec, this would allow using either specs in the
xrefsetting and still be able to use the relevant definition