Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ data.proposed.json

# Ignore files created & used by pages & 11ty
/_site/**

# Local spec URL fragment reports (npm run test:specs -- --report)
reports/
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ towards-features.md
/features/draft
/scripts/schema.ts
/scripts/specs.ts
/reports
2 changes: 1 addition & 1 deletion features/anchor-positioning-transforms.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Anchor positioning transforms
description: Anchor positioned elements take CSS transforms on their anchor elements into account.
spec: https://drafts.csswg.org/css-anchor-position-1/#anchoring
spec: https://drafts.csswg.org/css-anchor-position-1/#anchor-positioning
group: anchor-positioning
compat_features:
- css.properties.anchor-name.position_after_layout
2 changes: 1 addition & 1 deletion features/anchor-positioning.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Anchor positioning
description: Anchor positioning places an element based on the position of another element. For example, you can place a tooltip next to the content it references.
spec: https://drafts.csswg.org/css-anchor-position-1/#anchoring
spec: https://drafts.csswg.org/css-anchor-position-1/#anchor-positioning
group: anchor-positioning
caniuse: css-anchor-positioning
compat_features:
Expand Down
2 changes: 1 addition & 1 deletion features/array-iterators.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Array iterators
description: Arrays are iterable with the `for … of` statement and enumerable with the methods `entries()`, `keys()`, and `values()`.
spec:
- https://tc39.es/ecma262/multipage/indexed-collections.html#sec-array.prototype-@@iterator
- https://tc39.es/ecma262/multipage/indexed-collections.html#sec-array.prototype-%25symbol.iterator%25
- https://tc39.es/ecma262/multipage/indexed-collections.html#sec-array.prototype.entries
- https://tc39.es/ecma262/multipage/indexed-collections.html#sec-array.prototype.keys
- https://tc39.es/ecma262/multipage/indexed-collections.html#sec-array.prototype.values
Expand Down
2 changes: 1 addition & 1 deletion features/background-attachment.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: background-attachment
description: The `background-attachment` CSS property sets whether an element's background image or gradient moves as the element scrolls.
spec: https://drafts.csswg.org/css-backgrounds-3/#the-background-attachment
spec: https://drafts.csswg.org/css-backgrounds-3/#background-attachment
group: background
caniuse: background-attachment
# TODO: https://github.com/web-platform-dx/web-features/issues/1971
Expand Down
2 changes: 1 addition & 1 deletion features/calc.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: calc()
description: The `calc()` CSS function computes mathematical expressions such a `calc(100%/3 - 1em)`.
spec: https://drafts.csswg.org/css-values-3/#calc-notation
spec: https://drafts.csswg.org/css-values-3/#funcdef-calc
group: css
caniuse: calc
status:
Expand Down
2 changes: 1 addition & 1 deletion features/contain-inline-size.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Inline-size containment
description: "The `contain: inline-size` CSS declaration prevents the element's inline dimension from being set by the element's contents. This permits the browser to avoid slower layout calculations."
spec: https://drafts.csswg.org/css-contain-3/#containment-inline-size
spec: https://drafts.csswg.org/css-contain-2/#containment-inline-size
group: containment
compat_features:
- css.properties.contain.inline-size
2 changes: 1 addition & 1 deletion features/custom-ellipses.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Custom ellipses
description: The `text-overflow` CSS property with a string value sets the string representing clipped text.
spec: https://drafts.csswg.org/css-overflow-4/#overflow-string
spec: https://drafts.csswg.org/css-overflow-4/#text-overflow
compat_features:
- css.properties.text-overflow.string
2 changes: 1 addition & 1 deletion features/display-animation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ name: display animation
description: "You can animate elements between `display: none` and any other `display` value or animate between `content-visibility: hidden` and any other `content-visibility` value. This also applies to transitions."
spec:
- https://drafts.csswg.org/css-display-4/#display-animation
- https://drafts.csswg.org/css-contain-3/#content-visibility-animation
- https://drafts.csswg.org/css-contain-2/#content-visibility-animation
group: css
2 changes: 1 addition & 1 deletion features/fit-content-function.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: fit-content()
description: The `fit-content()` CSS function, used outside of a grid layout property, clamps a length between `min-content` and `max-content`.
spec: https://drafts.csswg.org/css-sizing-3/#funcdef-width-fit-content
spec: https://drafts.csswg.org/css-sizing-4/#funcdef-width-fit-content
group: layout
compat_features:
- css.properties.block-size.fit-content_function
Expand Down
2 changes: 1 addition & 1 deletion features/fit-content.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: fit-content
description: The `fit-content` CSS keyword expands a box as needed to fit its contents until the maximum size is reached, preserving the content's preferred aspect ratio.
spec: https://drafts.csswg.org/css-sizing-4/#valdef-width-fit-content
spec: https://drafts.csswg.org/css-sizing-3/#valdef-width-fit-content
group: layout
compat_features:
- css.properties.height.fit-content
Expand Down
2 changes: 1 addition & 1 deletion features/font-family-math.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Math font family
description: "The `font-family: math` CSS declaration uses the browser default font face for displaying mathematical expressions."
spec: https://drafts.csswg.org/css-fonts-4/#math-def
spec: https://drafts.csswg.org/css-fonts-4/#valdef-font-family-math
# TODO: https://github.com/web-platform-dx/web-features/issues/1971
# Status changed: https://github.com/web-platform-dx/web-features/pull/3867
# 2026-03-16 — low → false — Upstream data incorrectly reported that `font-family: math` shipped in Firefox 145. It actually shipped in Firefox 149.
Expand Down
2 changes: 1 addition & 1 deletion features/font-family-system.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: System font
description: "The `font-family: system-ui` CSS declaration uses the operating system default font for text."
spec: https://drafts.csswg.org/css-fonts-4/#system-ui-def
spec: https://drafts.csswg.org/css-fonts-4/#valdef-font-family-system-ui
caniuse: font-family-system-ui
compat_features:
- css.properties.font-family.system-ui
2 changes: 1 addition & 1 deletion features/font-family-ui.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: UI fonts
description: The `ui-serif`, `ui-sans-serif`, `ui-monospace` and `ui-rounded` values for the `font-family` CSS property use device-default user interface fonts for text.
spec: https://drafts.csswg.org/css-fonts-4/#ui-serif-def
spec: https://drafts.csswg.org/css-fonts-4/#valdef-font-family-ui-serif
caniuse: extended-system-fonts
group: fonts
compat_features:
Expand Down
2 changes: 1 addition & 1 deletion features/gif.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: GIF
description: The GIF (Graphics Interchange Format) image format is a raster graphics file format with animation and lossless compression.
spec:
- https://www.w3.org/Graphics/GIF/spec-gif89a.txt#top
- https://www.w3.org/Graphics/GIF/spec-gif89a.txt
compat_features:
- mediatypes.image.gif
2 changes: 1 addition & 1 deletion features/hyphens.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Hyphenation
# The description should be revisited when support notes are added.
# https://github.com/web-platform-dx/web-features/issues/915
description: The `hyphens` CSS property controls when long words are broken by line wrapping. Although called `hyphens`, the property applies to word-splitting behavior across languages, such as customary spelling changes or the use of other characters. Support for non-English languages varies significantly.
spec: https://drafts.csswg.org/css-text-3/#hyphens-property
spec: https://drafts.csswg.org/css-text-3/#propdef-hyphens
caniuse: css-hyphens
group: css
compat_features:
Expand Down
2 changes: 1 addition & 1 deletion features/indeterminate.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: ":indeterminate"
description: The `:indeterminate` CSS pseudo-class selects any form element whose state is indeterminate, such as checkboxes that have been set to an indeterminate state with JavaScript, or radio buttons which are members of a group in which all radio buttons are unchecked.
spec:
- https://drafts.csswg.org/selectors-4/#indeterminate
- https://drafts.csswg.org/selectors-4/#indeterminate-pseudo
- https://html.spec.whatwg.org/multipage/semantics-other.html#selector-indeterminate
group: forms
caniuse: css-indeterminate-pseudo
2 changes: 1 addition & 1 deletion features/intl.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Intl
description: "The `Intl` API provides language sensitive string comparison, number formatting, date and time formatting, and more."
group: intl
spec: https://tc39.es/ecma402/#introduction
spec: https://tc39.es/ecma402/
caniuse: internationalization
status:
compute_from: javascript.builtins.Intl
Expand Down
2 changes: 1 addition & 1 deletion features/iterators.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: The `for...of` loop operates on a sequence of values sourced from a
group: iterators
snapshot: ecmascript-2015
spec:
- https://tc39.es/ecma262/multipage/control-abstraction-objects.html#sec-%iteratorprototype%-object
- https://tc39.es/ecma262/multipage/control-abstraction-objects.html#sec-%25iterator.prototype%25-object
- https://tc39.es/ecma262/multipage/ecmascript-language-statements-and-declarations.html#sec-for-in-and-for-of-statements
status:
compute_from: javascript.statements.for_of
Expand Down
2 changes: 1 addition & 1 deletion features/javascript.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: JavaScript (initial core language support)
description: JavaScript is a programming language that runs in browsers, usually through the `<script>` element. JavaScript has changed over many years. This feature represents the oldest language features, such as built-in objects, statements, and operators. Also known as ECMAScript.
spec: https://tc39.es/ecma262/multipage/#sec-intro
spec: https://tc39.es/ecma262/multipage/
group: javascript
compat_features:
- javascript.builtins.Boolean
Expand Down
2 changes: 1 addition & 1 deletion features/manifest-localization.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Web app manifest localization
description: The `_localized` suffixed members of the web app manifest set translated names, descriptions, icons, and shortcuts. The browser automatically selects resources based on the user's language and region settings.
spec: https://w3c.github.io/manifest/#localized-members
spec: https://w3c.github.io/manifest/#x_localized-members
group: progressive-web-app
# Expected compat keys:
# - manifests.webapp.name_localized
Expand Down
4 changes: 2 additions & 2 deletions features/map.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ spec:
- https://tc39.es/ecma262/multipage/keyed-collections.html#sec-map.prototype.set
- https://tc39.es/ecma262/multipage/keyed-collections.html#sec-get-map.prototype.size
- https://tc39.es/ecma262/multipage/keyed-collections.html#sec-map.prototype.values
- https://tc39.es/ecma262/multipage/keyed-collections.html#sec-map.prototype-@@iterator
- https://tc39.es/ecma262/multipage/keyed-collections.html#sec-get-map-@@species
- https://tc39.es/ecma262/multipage/keyed-collections.html#sec-map.prototype-%25symbol.iterator%25
- https://tc39.es/ecma262/multipage/keyed-collections.html#sec-get-map-%25symbol.species%25
snapshot: ecmascript-2015
group: maps
status:
Expand Down
4 changes: 2 additions & 2 deletions features/performancetiming.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: PerformanceTiming and PerformanceNavigation
description: The `window.performance.timing` and `window.performance.navigation` APIs report performance timing information for events that occur during the loading and use of the current page.
spec: https://w3c.github.io/navigation-timing/#obsolete
spec: https://w3c.github.io/navigation-timing/#obsolete-heading
group: performance
discouraged:
reason: This feature is supserseded by the `PerformanceNavigationTiming` API.
according_to:
- https://w3c.github.io/navigation-timing/#obsolete
- https://w3c.github.io/navigation-timing/#obsolete-heading
alternatives:
- performance
- navigation-timing
Expand Down
2 changes: 1 addition & 1 deletion features/promise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ caniuse: promises
snapshot: ecmascript-2015
spec:
- https://tc39.es/ecma262/multipage/control-abstraction-objects.html#sec-promise-objects
- https://tc39.es/ecma262/multipage/control-abstraction-objects.html#sec-get-promise-@@species
- https://tc39.es/ecma262/multipage/control-abstraction-objects.html#sec-get-promise-%25symbol.species%25
- https://tc39.es/ecma262/multipage/control-abstraction-objects.html#sec-promise-constructor
- https://tc39.es/ecma262/multipage/control-abstraction-objects.html#sec-promise.all
- https://tc39.es/ecma262/multipage/control-abstraction-objects.html#sec-promise.prototype.catch
Expand Down
2 changes: 1 addition & 1 deletion features/scope.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: "@scope"
description: The `@scope` CSS at-rule sets the scope for a group of rules.
spec: https://drafts.csswg.org/css-cascade-6/#scope-atrule
spec: https://drafts.csswg.org/css-cascade-6/#at-ruledef-scope
group: css
caniuse: css-cascade-scope
compat_features:
Expand Down
2 changes: 1 addition & 1 deletion features/stretch.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: stretch
description: The `stretch` CSS keyword expands a box as needed to fit its contents until the maximum size is reached, without preserving the content's preferred aspect ratio.
spec: https://drafts.csswg.org/css-sizing-4/#stretch-fit-sizing
spec: https://drafts.csswg.org/css-sizing-3/#stretch-fit-sizing
group: layout
compat_features:
- css.properties.height.stretch
Expand Down
2 changes: 1 addition & 1 deletion features/text-fit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: text-fit
description: >
The `text-fit` CSS property scales text to fill the inline size of its container.
You can use this to grow or shrink headlines, captions, or pull quotes to fit a container.
spec: https://drafts.csswg.org/css-text-4/#propdef-text-fit
spec: https://drafts.csswg.org/css-text-5/#propdef-text-fit
compat_features:
- css.properties.text-fit
- css.properties.text-fit.none
Expand Down
2 changes: 1 addition & 1 deletion features/typed-array-iterators.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Typed array iterators
description: Typed arrays are iterable with the `for … of` statement and enumerable with the methods `entries()`, `keys()`, and `values()`.
spec:
- https://tc39.es/ecma262/multipage/indexed-collections.html#sec-%25typedarray%25.prototype-@@iterator
- https://tc39.es/ecma262/multipage/indexed-collections.html#sec-%25typedarray%25.prototype-%25symbol.iterator%25
- https://tc39.es/ecma262/multipage/indexed-collections.html#sec-%25typedarray%25.prototype.entries
- https://tc39.es/ecma262/multipage/indexed-collections.html#sec-%25typedarray%25.prototype.keys
- https://tc39.es/ecma262/multipage/indexed-collections.html#sec-%25typedarray%25.prototype.values
Expand Down
1 change: 0 additions & 1 deletion features/typed-arrays.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Typed arrays (initial support)
description: "Typed arrays are ordered lists of JavaScript values, where all values are of the same numerical type, such as 8-bit integers or 32-bit floating point numbers."
spec:
- https://tc39.es/ecma262/multipage/indexed-collections.html#table-49
- https://tc39.es/ecma262/multipage/indexed-collections.html#sec-typedarray-constructors
- https://tc39.es/ecma262/multipage/indexed-collections.html#sec-typedarray-objects
- https://tc39.es/ecma262/multipage/indexed-collections.html#sec-typedarray.bytes_per_element
Expand Down
2 changes: 1 addition & 1 deletion features/wasm-bigint.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: BigInt to i64 conversion (WebAssembly)
description: Integer values pass bidirectionally between JavaScript and WebAssembly, converted to i64 values in WebAssembly or BigInt values in JavaScript.
spec: https://webassembly.github.io/spec/js-api/#ref-for-syntax-numtype①⓪
spec: https://webassembly.github.io/spec/js-api/#dom-valuetype-i64
group: webassembly
caniuse: wasm-bigint
compat_features:
Expand Down
8 changes: 8 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"@types/caniuse-lite": "^1.0.4",
"@types/node": "^22.20.5",
"@types/yargs": "^17.0.35",
"@webref/xref": "^1.2.22",
"ajv": "^8.20.0",
"caniuse-lite": "^1.0.30001816",
"cheerio": "^1.2.0",
Expand Down
58 changes: 58 additions & 0 deletions scripts/spec-fragments.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// Fragment-level validation of spec URLs against @webref/xref, which knows the
// definition and heading anchors of every spec crawled by w3c/webref.
//
// The rules largely mirror BCD's spec_url linter, except that text fragments
// are forbidden here rather than skipped. See:
// https://github.com/mdn/browser-compat-data/blob/main/lint/linter/test-spec-urls.js
// https://github.com/web-platform-dx/web-features/issues/84

import * as xref from "@webref/xref";
import type { XrefMatch, LookupOptions } from "@webref/xref";

type LookupFunction = (url: string, options?: LookupOptions) => XrefMatch[];

export type FragmentResult =
| { status: "valid"; matches: XrefMatch[] }
| { status: "invalid"; reason: "unknown-fragment" | "text-fragment" }
| { status: "skipped"; reason: "no-fragment" };

let initialized = false;

/**
* Check a spec URL's fragment against webref's known anchors. Returns the
* matching webref entries on success (each names its spec's shortname), rather
* than a bare boolean, so callers can cross-reference with web-specs.
*
* Page-level validity (is this a spec web-features may cite at all?) is out of
* scope here; check that separately against web-specs.
*/
export function validateSpecFragment(
url: URL,
lookup: LookupFunction = xref.lookup,
): FragmentResult {
if (lookup === xref.lookup && !initialized) {
xref.setup();
initialized = true;
}

let target = new URL(url);

if (!target.hash) {
return { status: "skipped", reason: "no-fragment" };
}

// Text fragments (`#:~:text=…`) can't be validated against webref and break
// easily as spec prose changes, so web-features forbids them outright. (BCD
// merely skips them, because its fine-grained keys sometimes need them.)
if (target.hash.includes(":~:text=")) {
return { status: "invalid", reason: "text-fragment" };
}

const matches = lookup(target.toString(), {
series: true,
standing: "good",
});
return matches.length
? { status: "valid", matches }
: { status: "invalid", reason: "unknown-fragment" };
}
Loading
Loading