From e9eb9ea063d11f698a9fb111798162de0200c27a Mon Sep 17 00:00:00 2001 From: "Michael[tm] Smith" Date: Tue, 29 Jun 2021 15:22:22 +0900 Subject: [PATCH 1/5] Ensure stable IDs for dfn refs in domintro sections MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change ensures that dfn references/links inside sections which follow the class=domintro convention are output with IDs ending with “-dev” — and most likely, without any additional ①, ②, etc., suffix. Otherwise, without this change, dfn references/links inside class=domintro sections are output with IDs of the form “ref-foo-①”, etc. — just as the IDs output for such references/links outside of class=domintro sections. So this change helps make it likely that dfn references/links inside class=domintro sections end up with stable IDs useful for referencing from MDN and other places — rather than “ref-foo-②”, etc. IDs that might change if some new reference to a term is added to a spec somewhere preceding a class=domintro section where the term is referenced. Relates to https://github.com/mdn/browser-compat-data/issues/11088 --- bikeshed/dfnpanels.py | 5 ++++- bikeshed/h/dom.py | 2 +- bikeshed/unsortedJunk.py | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/bikeshed/dfnpanels.py b/bikeshed/dfnpanels.py index c9259e8443..117977a440 100644 --- a/bikeshed/dfnpanels.py +++ b/bikeshed/dfnpanels.py @@ -45,7 +45,10 @@ def addDfnPanels(doc, dfns): for i, el in enumerate(els): refID = el.get("id") if refID is None: - refID = f"ref-for-{id}" + if hasAncestor(el, lambda x: hasClass(x, "domintro")): + refID = f"{id}-dev" + else: + refID = f"ref-for-{id}" el.set("id", safeID(doc, refID)) if i == 0: appendChild( diff --git a/bikeshed/h/dom.py b/bikeshed/h/dom.py index 162c928685..02d15d6366 100644 --- a/bikeshed/h/dom.py +++ b/bikeshed/h/dom.py @@ -803,7 +803,7 @@ def dedupIDs(doc): continue if el.get("data-silently-dedup") is not None: warnAboutDupes = False - if dupeId.startswith("ref-for-"): + if dupeId.startswith("ref-for-") or dupeId.endswith("-dev"): warnAboutDupes = False # Try to de-dup the id by appending an integer after it. if warnAboutDupes: diff --git a/bikeshed/unsortedJunk.py b/bikeshed/unsortedJunk.py index 637fdab16a..25bccf55d6 100644 --- a/bikeshed/unsortedJunk.py +++ b/bikeshed/unsortedJunk.py @@ -1078,7 +1078,10 @@ def decorateAutolink(doc, el, linkType, linkText, ref): if el.get("id") is None: _, _, id = ref.url.partition("#") if id: - el.set("id", f"ref-for-{id}") + if hasAncestor(el, lambda x: hasClass(x, "domintro")): + el.set("id", f"{id}-dev") + else: + el.set("id", f"ref-for-{id}") el.set("data-silently-dedup", "") # Get all the values that the type expands to, add it as a title. From 3ce8770151f22aa4c7fb0fe7d69106e400830b1c Mon Sep 17 00:00:00 2001 From: "Michael[tm] Smith" Date: Tue, 29 Jun 2021 20:10:43 +0900 Subject: [PATCH 2/5] Update tests --- tests/github/WICG/app-history/spec.html | 286 +- tests/github/WICG/cookie-store/index.html | 108 +- .../github/WICG/file-system-access/index.html | 568 +-- tests/github/WICG/kv-storage/spec.html | 174 +- .../github/WICG/local-font-access/index.html | 68 +- .../WICG/shape-detection-api/index-zh-cn.html | 68 +- .../WICG/shape-detection-api/index.html | 156 +- .../github/WICG/shape-detection-api/text.html | 22 +- tests/github/WICG/web-locks/index.html | 110 +- tests/github/w3c/FileAPI/index.html | 190 +- tests/github/w3c/IndexedDB/index.html | 2468 ++++----- .../github/w3c/mediacapture-image/index.html | 928 ++-- .../mediacapture-record/MediaRecorder.html | 656 +-- tests/github/whatwg/dom/dom.html | 4494 ++++++++--------- tests/github/whatwg/encoding/encoding.html | 598 +-- tests/github/whatwg/fetch/fetch.html | 512 +- .../github/whatwg/fullscreen/fullscreen.html | 102 +- tests/github/whatwg/streams/index.html | 2040 ++++---- tests/github/whatwg/xhr/xhr.html | 712 +-- 19 files changed, 7130 insertions(+), 7130 deletions(-) diff --git a/tests/github/WICG/app-history/spec.html b/tests/github/WICG/app-history/spec.html index 1d075ed239..954f95d310 100644 --- a/tests/github/WICG/app-history/spec.html +++ b/tests/github/WICG/app-history/spec.html @@ -731,20 +731,20 @@

1.
-
appHistory . current +
appHistory . current
-

The current AppHistoryEntry.

-
appHistory . entries() +

The current AppHistoryEntry.

+
appHistory . entries()
-

Returns an array of AppHistoryEntry instances representing the current app history list, i.e. all session history entries for this Window that are same origin and contiguous to the current session history entry.

-
appHistory . canGoBack +

Returns an array of AppHistoryEntry instances representing the current app history list, i.e. all session history entries for this Window that are same origin and contiguous to the current session history entry.

+
appHistory . canGoBack
-

Returns true if the current AppHistoryEntry is not the first one in the app history entries list.

-
appHistory . canGoForward +

Returns true if the current AppHistoryEntry is not the first one in the app history entries list.

+
appHistory . canGoForward
-

Returns true if the current AppHistoryEntry is not the last one in the app history entries list.

+

Returns true if the current AppHistoryEntry is not the last one in the app history entries list.

-

Each AppHistory object has an associated entry list, a list of AppHistoryEntry objects, initially empty.

+

Each AppHistory object has an associated entry list, a list of AppHistoryEntry objects, initially empty.

Each AppHistory object has an associated current index, an integer, initially −1.

The current getter steps are: @@ -840,7 +840,7 @@

1.

Let she be sessionHistory[backwardIndex].

  • -

    If she’s origin is same origin with currentSHE’s origin, then prepend she to appHistorySHEs.

    +

    If she’s origin is same origin with currentSHE’s origin, then prepend she to appHistorySHEs.

  • Otherwise, break.

  • @@ -856,7 +856,7 @@

    1.

    Let she be sessionHistory[forwardIndex].

  • -

    If she’s origin is same origin with currentSHE’s origin, then append she to appHistorySHEs.

    +

    If she’s origin is same origin with currentSHE’s origin, then append she to appHistorySHEs.

  • Otherwise, break.

  • @@ -878,12 +878,12 @@

    1. For each she of appHistorySHEs:

    1. -

      If appHistory’s entry list contains an AppHistoryEntry existingAHE whose session history entry is she, then append existingAHE to newEntryList.

      +

      If appHistory’s entry list contains an AppHistoryEntry existingAHE whose session history entry is she, then append existingAHE to newEntryList.

    2. Otherwise:

      1. -

        Let newAHE be a new AppHistoryEntry created in the relevant realm of appHistory.

        +

        Let newAHE be a new AppHistoryEntry created in the relevant realm of appHistory.

      2. Set newAHE’s session history entry to she.

      3. @@ -899,7 +899,7 @@

        1.

        Set appHistory’s current index to newCurrentIndex.

      -

      For same-document navigations only the current index and the indices of the various AppHistoryEntry objects will ultimately be updated by this algorithm. Implementations can special-case same-document navigations and avoid reassembling the entry list.

      +

      For same-document navigations only the current index and the indices of the various AppHistoryEntry objects will ultimately be updated by this algorithm. Implementations can special-case same-document navigations and avoid reassembling the entry list.

  • [Exposed=Window]
    @@ -936,40 +936,40 @@ 
    -

    A FileSystemDirectoryHandle's associated entry must be a directory entry.

    -

    FileSystemDirectoryHandle objects are serializable objects. Their serialization steps and deserialization steps are the same as those for FileSystemHandle.

    +

    A FileSystemDirectoryHandle's associated entry must be a directory entry.

    +

    FileSystemDirectoryHandle objects are serializable objects. Their serialization steps and deserialization steps are the same as those for FileSystemHandle.

    In the Origin Trial as available in Chrome 78, these objects are not yet serializable. In Chrome 82 they are.

    In Chrome versions upto Chrome 85 getFileHandle and getDirectoryHandle where @@ -1492,10 +1492,10 @@

    In the future we might want to add arguments to the async iterable declaration to support for example recursive iteration. <https://github.com/wicg/file-system-access/issues/173>

    - The asynchronous iterator initialization steps for a FileSystemDirectoryHandle handle ant its async iterator iterator are: + The asynchronous iterator initialization steps for a FileSystemDirectoryHandle handle ant its async iterator iterator are:
    1. -

      Let permissionStatus be the result of querying file system permission given handle and "read".

      +

      Let permissionStatus be the result of querying file system permission given handle and "read".

    2. If permissionStatus is not "granted", throw a NotAllowedError.

      @@ -1504,20 +1504,20 @@

      - To get the next iteration result for a FileSystemDirectoryHandle handle and its async iterator iterator: + To get the next iteration result for a FileSystemDirectoryHandle handle and its async iterator iterator:
      1. Let promise be a new promise.

      2. Let directory be handle’s entry.

      3. -

        Let permissionStatus be the result of querying file system permission given handle and "read".

        +

        Let permissionStatus be the result of querying file system permission given handle and "read".

      4. If permissionStatus is not "granted", reject promise with a NotAllowedError and return promise.

      5. Let child be an entry in directory’s children, - such that child’s name is not contained in iterator’s past results, + such that child’s name is not contained in iterator’s past results, or null if no such entry exists.

        Note: This is intentionally very vague about the iteration order. Different platforms and file systems provide different guarantees about iteration order, and we want it to @@ -1533,21 +1533,21 @@

    3. Return promise.

      @@ -1585,12 +1585,12 @@

      -
      fileHandle = await directoryHandle . getFileHandle(name) -
      fileHandle = await directoryHandle . getFileHandle(name, { create: false }) +
      fileHandle = await directoryHandle . getFileHandle(name) +
      fileHandle = await directoryHandle . getFileHandle(name, { create: false })

      Returns a handle for a file named name in the directory represented by directoryHandle. If no such file exists, this rejects.

      -
      fileHandle = await directoryHandle . getFileHandle(name, { create: true }) +
      fileHandle = await directoryHandle . getFileHandle(name, { create: true })

      Returns a handle for a file named name in the directory represented by directoryHandle. If no such file exists, this creates a new file. If no file with named name can be created this @@ -1600,7 +1600,7 @@

      create: false }.

      + with { create: false }.

    @@ -1617,17 +1617,17 @@
    -

    Key round-tripping refers to the way in which JavaScript values are processed by first being passed through IndexedDB’s convert a value to a key operation, then converted back through its convert a key to a value operation. Keys returned by the keys() or entries() methods will have gone through this process.

    -

    Notably, any typed arrays or DataViews will have been "unwrapped", and returned back as just ArrayBuffers containing the same bytes. Also, similar to the structured-serialization/deserialization process, any "expando" properties or other modifications will not be preserved by key round-tripping.

    -

    For primitive string or number values, there’s no need to worry about key round-tripping; the values are indistinguishable.

    +

    Key round-tripping refers to the way in which JavaScript values are processed by first being passed through IndexedDB’s convert a value to a key operation, then converted back through its convert a key to a value operation. Keys returned by the keys() or entries() methods will have gone through this process.

    +

    Notably, any typed arrays or DataViews will have been "unwrapped", and returned back as just ArrayBuffers containing the same bytes. Also, similar to the structured-serialization/deserialization process, any "expando" properties or other modifications will not be preserved by key round-tripping.

    +

    For primitive string or number values, there’s no need to worry about key round-tripping; the values are indistinguishable.

    To get the range for a key key:
      @@ -1363,7 +1363,7 @@

      https://tc39.github.io/ecma262/#sec-date-objectsReferenced in:

  • Sort list in ascending order by using postscriptName as the sort key and store the result as list.

    @@ -1017,20 +1017,20 @@

    Make "selected by the user" more spec-like.

  • -

    6.2. The FontMetadata interface

    -

    A FontMetadata provides details about a font face. Each FontMetadata has an associated font representation.

    +

    6.2. The FontMetadata interface

    +

    A FontMetadata provides details about a font face. Each FontMetadata has an associated font representation.

    -
    metadata . postscriptName +
    metadata . postscriptName

    The PostScript name for the font. Example: "Arial-Bold". The OpenType spec expects this to be encoded in a subset of ASCII and is unique for metadata

    -
    metadata . fullName +
    metadata . fullName

    The full font name, including family subfamily names. Example: "Arial Bold"

    -
    metadata . family +
    metadata . family

    The font family name. Example: "Arial"

    -
    metadata . style +
    metadata . style

    The font style (or subfamily) name. Example: "Regular", "Bold Italic"

    @@ -1039,10 +1039,10 @@

    interface FontMetadata { Promise<Blob> blob(); - readonly attribute USVString postscriptName; - readonly attribute USVString fullName; - readonly attribute USVString family; - readonly attribute USVString style; + readonly attribute USVString postscriptName; + readonly attribute USVString fullName; + readonly attribute USVString family; + readonly attribute USVString style; };
    @@ -1063,9 +1063,9 @@

    Include name ID 3 (Unique identifier) as well?

    -
    await blob = metadata . blob() +
    await blob = metadata . blob()
    -

    Request the font data of metadata. The result blob contains data bytes.

    +

    Request the font data of metadata. The result blob contains data bytes.

    @@ -1077,7 +1077,7 @@

    Run these steps in parallel:

    1. -

      Let blob be a new Blob whose contents are this's data bytes and type attribute is `application/octet-stream`.

      +

      Let blob be a new Blob whose contents are this's data bytes and type attribute is `application/octet-stream`.

    2. Resolve promise with blob.

    @@ -1089,10 +1089,10 @@

    7. Document internationalization consideration, e.g. string localization

    7.1. Font Names

    The `name` table in OpenType [OPENTYPE] fonts allows names (family, subfamily, etc) to have multilingual strings, using either platform-specific numeric language identifiers or language-tag strings conforming to [BCP47]. For example, a font could have family name strings defined for both `en` and `zh-Hant-HK`.

    -

    The FontMetadata properties postscriptName, fullName, family, and style are provided by this API simply as strings, using the `en` locale. This matches the behavior of the FontFace family property.

    +

    The FontMetadata properties postscriptName, fullName, family, and style are provided by this API simply as strings, using the `en` locale. This matches the behavior of the FontFace family property.

    The above does not match the spec/implementation. Resolve the ambiguity.

    Web applications that need to provide names in other languages can request and parse the `name` table directly.

    -

    Should we define an option to the query() method to specify the desired language for strings (e.g. {lang: 'zh'}), falling back to `en` if not present?

    +

    Should we define an option to the query() method to specify the desired language for strings (e.g. {lang: 'zh'}), falling back to `en` if not present?

    8. Accessibility considerations

    There are no known accessibility impacts of this feature.

    9. Security considerations

    @@ -1620,7 +1620,7 @@

    #font-representation-data-bytesReferenced in: