web-features

repository·main·Indexed 21 days ago

https://github.com/web-platform-dx/web-features

A shared catalog of web platform features designed to improve understanding of web capabilities. It provides feature definitions, generates Baseline support data summarizing feature availability across browsers, and publishes these as an npm package. The project includes the @web-platform-dx/web-features package and the compute-baseline utility for calculating Baseline statuses.

Tokens
14.8K
Snippets
30
Records
71
Agent score
75%

What's inside web-features

  1. Explore the web-features project documentation

    main

    The web-features project provides a curated list of web platform features and explores the set of interoperable features of the web platform. Use the following resources to navigate the project:

  2. What is Baseline status?

    main

    Baseline is a wayfinding tool for web developers designed to identify consensus web platform features. It helps distinguish established, workaday features from those that are still in development (proposals, experiments) or are deprecated/historic.

    Baseline aims to provide a shortcut for developers to understand feature availability without needing to perform deep, site-specific browser compatibility analysis. It focuses on features that demonstrate:

    • Interoperability: Support across multiple browser implementations.
    • Availability: Support across a supermajority of global users.
    • Continuity: Uninterrupted support from one release to the next.
    • Commitment: Presence in official specifications and documentation.
  3. What is a web platform feature?

    main

    In the context of this project, a feature (or feature group) is defined as:

    A logical subset of all the addressable behaviors and interfaces that the web platform, as mediated by browsers and related tools, exposes to web developers.

    Key components of the definition:

    • Logical subset: A feature is not a random collection of technologies (e.g., mixing a JS object, a CSS property, and an HTTP method). It is a coherent group, which can range from a single specific capability to hundreds of related items.
    • Addressable: A feature must be identifiable and distinguishable (e.g., the <form> element or the HTMLFormElement API).
    • Behaviors and interfaces: Features represent what the platform can do (the general behavior) rather than specific instances of use.
    • The web platform: Includes open standards like HTML, CSS, JavaScript, SVG, and WebAssembly, but excludes proprietary or vendor-specific technologies.
    • Mediated by browsers: Features must be implemented (or likely to be implemented soon) by web browsers or related tools like JavaScript engines.
    • Exposes to web developers: The feature must be inspectable or manipulatable by developers via web documents and applications (e.g., calling getUserMedia() is a feature; the specific UI of the permission prompt is not).
  4. How Peers and Owners make decisions

    main

    The project uses a consensus-seeking decision-making model. The goal is to achieve true consensus before resorting to a vote.

    Decision Process:

    1. Consensus Seeking: Participants discuss the agenda item to reach agreement.
    2. Final Call: When consensus appears reached, the chair asks, "Does anyone object?" to check for final dissent.
    3. Voting (if consensus fails): If consensus cannot be reached, an Owner may call for a closing vote or a vote to defer the issue to the next meeting. A call for a vote must be approved by a majority of Owners.
    4. Outcome: A simple majority wins.
    5. Memorialization: All collective decisions made by Owners must be memorialized in writing (e.g., in a document, PR comment, or issue).
  5. When to use status overrides

    main

    Overrides should be used sparingly. Preferred alternatives include splitting a feature into multiple features or fixing upstream data. Use overrides only in these specific scenarios:

    • Reconsideration: To prevent a status from advancing or regressing while a feature is under review.
    • Missing Data: To set a status when no relevant BCD keys exist.
    • Data Errors: To override BCD when data is suspected to be incorrect (consider filing an upstream issue first).
    • Caniuse Alignment: To align with caniuse support information, especially for features predating web-features.
    • Birthday Setting: To set the original version or date when an established feature acquired minor behavioral additions or restrictions (rare).
  6. Understand BCD and web-features synchronization

    main

    The web-features and mdn/browser-compat-data (BCD) repositories are complementary. They synchronize feature mappings using two primary methods: tagging keys in BCD or listing keys in web-features source YAML files.

    • Tagging in BCD: BCD keys are tagged with web-features:<feature-id>. This is preferred for small, incremental changes.
    • Listing in web-features: Keys are explicitly listed in the compat_features field of a feature's source YAML file in web-features. These are later migrated to BCD tags via an automated process.

    Key Rule for Maintainers: To avoid circular dependencies, BCD contributors should not create a tag for an ID that does not yet exist in web-features. Conversely, web-features contributors should not manually remove compat_features lists from source files.

  7. Challenges in defining web feature support

    main

    Determining the implementation status of a web feature is complex due to several factors:

    • Granularity and Composition: A single specification (like Media Source Extensions) may be composed of many individual IDL features. A feature might be 'supported' for typical use cases but 'unsupported' if specific sub-features (like SourceBuffer.textTracks) are required.
    • Evolving Specifications: Specifications evolve over time. A feature that is considered 'fully supported' today may have new capabilities (e.g., running in dedicated workers) added later that are not yet implemented.
    • Usage Scenarios: Support status often depends on the developer's specific use case. A feature might be reported as supported for general adaptive streaming but unsupported for specialized threading requirements.
    • Beyond Mere Support: Implementation status may also involve qualitative aspects like accessibility (e.g., video support without accessible controls) which are not always captured in standard platform status dashboards.
  8. Granularity of web feature tracking across platforms

    main

    Different web platform status projects and databases track features at different levels of granularity. When building tools or dashboards, it is important to understand these varying perspectives:

    ProjectGranularity LevelApproximate CountFocus/Perspective
    MDN Browser Compat Data (BCD)Very Fine-grained~14,000IDL interfaces, attributes, CSS properties, and events.
    Chrome Platform StatusMixed~2,200Implementer-centric; ranges from coarse (specification level) to fine-grained (specific implementation details).
    Can I UseCoarse-grained~520Quick developer lookup for broad browser support.
    Webkit StatusVariesN/ABrowser-specific implementation status.

    Example of Granularity Differences: For the File API:

    • Can I Use provides a single entry for FileReader.
    • Chrome Platform Status provides an entry for FileReader plus specific implementation entries like FileReader - Set Result Only on Load.
    • BCD provides detailed support information for both the FileReader and Blob interfaces and their individual members.
  9. Handle moved and split feature redirects

    main

    Some feature IDs in the features object act as redirects to ensure data integrity when features change.

    Moved Features (kind: "moved")

    Treat these like an HTTP 301 redirect. Use the redirect_target property to find the new feature ID.

    {
      "kind": "moved",
      "redirect_target": "new_feature_id"
    }

    Split Features (kind: "split")

    These act like a Wikipedia disambiguation page. Use the redirect_targets array to present the user with multiple relevant feature options.

    {
      "kind": "split",
      "redirect_targets": ["feature_a", "feature_b"]
    }
  10. Understand the lifecycle of a proposed feature

    main

    Proposed features follow a specific lifecycle to transition from early discovery to official publication:

    1. Creation: A .yml file is created in the features/draft/proposed/ directory containing metadata like an explainer or spec URL and a chromestatus URL.
    2. Transition: A maintainer creates the official feature entry and updates the proposed feature file to act as a pointer.
    3. Redirection: The proposed feature file is updated with a kind: moved status and a redirect_target pointing to the new feature ID.
    4. Update: Consumers update their references from the proposed/ ID to the final feature ID.
  11. What defines a web feature in web-features

    main

    In this project, a feature is an individual component of the web platform used by developers to achieve specific tasks. A feature has no fixed size and can range from a single CSS property to an entire JavaScript API (like fetch()) or a combination of HTML, CSS, and JS (like the Web Audio API).

    When deciding if a new item should be a distinct feature, consider:

    • Developer Recognition: Do developers discuss it as a standalone entity in blogs, Stack Overflow, or social media?
    • Existing Publications: Is it described as a feature in Can I Use, CSS-Tricks, DEV.to, or MDN?
    • Expectation: For new features, use the specification process (e.g., TC39 proposals vs. CSS specs) to make an educated guess.
  12. Use proposed features in external projects

    main

    The proposed/ prefix is reserved for features that have not yet been officially published in web-features. You can refer to these early-stage features using the proposed/a-feature notation in your tools or source code.

    Once a feature is officially published, the proposed ID may be updated to a redirect_target. You should eventually update your references from the proposed ID to the final, published feature ID.

    proposed/html-pis