fix(zh-cn): clean up jsxref macro args#36170
Conversation
The `@@iterator` / `@@species` / etc. notation is the old MDN convention for well-known symbol properties. Canonical pages now live under `Symbol.<name>` (e.g. `Symbol.iterator`). Update the macro args to match and insert a `/` so the normalization step (`.` -> `/`) doesn't split the `Symbol.` qualifier.
`{{jsxref("Object.prototype")}}` and similar refs were producing
broken links because no `Object/prototype` page exists; the class
page (`Object`, `Array`, etc.) documents `.prototype` directly.
Rewrite to link to the class page.
…args The handler-trap pages live under `Global_Objects/Proxy/Proxy/<trap>`; the old `Proxy.handler` namespace was retired. Update the macro args to point at the canonical paths.
Preview URLs (133 pages)
Flaws (379)Note! 30 documents with no flaws that don't need to be listed. 🎉 Found an unexpected or unresolvable flaw? Please report it here. URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
TRUNCATED! (comment last updated: 2026-05-22 21:19:24) |
The old `Operators/<Group>_Operators` slugs and related obsolete leaves redirect under the en-US slug graph but never reach the canonical pages cleanly. Rewrite the first arg to the current canonical sub-path.
`Operators/Array_comprehensions`, `Operators/Generator_comprehensions`, `Operators/Expression_closures`, and `Statements/Legacy_generator_function` were removed from JavaScript. Rewrite the macro args to point at `Deprecated_and_obsolete_features`.
…lass>` Intl member classes (`Collator`, `DateTimeFormat`, `NumberFormat`, `PluralRules`, etc.) live under `Global_Objects/Intl/`; the top-level `Global_Objects/<Class>` slug is only a redirect.
…y[/X]` The Proxy constructor page was renamed; the handler-trap namespace now lives under `Global_Objects/Proxy/Proxy/<trap>`. Also normalizes one remaining localized-namespace prefix missed by the round-1 sweep.
Rewrite arg1 for slugs that en-US redirects resolve cleanly so the macro doesn't hop. Includes the standard universal map (`<X>.toSource` → `.toString`, `Array/flatten` → `flat`, `TypedArray.name` → `Function.name`, `Atomics.wake` → `Atomics.notify`, etc.) plus bare pre-namespace slugs (`arguments`/`arguments.callee`/`await`/`template_strings`/`promise`).
`{{jsxref("NumberFormat")}}` and friends resolve via redirect because
the canonical page lives under `Global_Objects/Intl/<Class>`. Rewrite
the bare and dotted forms to the canonical `Intl/<Class>` path. When
no explicit display arg is set, insert the original arg as the
display text so the rendered label keeps reflecting what the author
originally wrote.
WebAssembly was moved out of `Web/JavaScript/Reference/Global_Objects/` and now lives at `/WebAssembly/Reference/JavaScript_interface/`. The `jsxref` macro is scoped to JS Reference, so `WebAssembly.<X>` refs all surface as `templ-redirected-link`. Convert them to plain markdown links pointing at the canonical WebAssembly path. Display preservation: keep an explicit display arg when set; otherwise use the dotted `WebAssembly.<X>` form (with parens preserved when arg1 had them) so the rendered label is unchanged.
Mechanical edits not covered by the bulk sweeps: - Strip literal `%2E` URL-encoding in arg1 (`Operators/new%2Etarget`, `Operators/import%2Emeta`) so the macro produces the dotted slug. - `USVString` is a Web IDL type — swap `jsxref` for `domxref`. - `double` (Web IDL primitive), `canvas`/`alpha`/`true`/`false`/ `boolean` (option keys / JS value literals in a Canvas-getContext page) → inline-code backticks. None of these are JS Reference pages, so the macro can't resolve them. - Bare `this` → `Operators/this`. - The literal-string `proxy.property='value'` arg (not a slug) → inline-code `proxy.property = 'value'`.
Lowercase JS class names (`string`/`boolean`/`number`/`object`/ `promise`/`array`/`symbol`) → canonical capitalized form; `Operators/Conditional_Operator`/`Comma_Operator`/`Function`/ `Operator_Precedence`/`Property_Accessors` → lowercase suffix; method-name typos (`Date/valueof` → `valueOf`, `Map/foreach` → `forEach`, `object/defineProperty`/`defineProperties` → `Object/`); lowercase namespace slugs (`statements/`/`operators/`/`functions/`/ `classes`) → canonical capitalized; `Classes/Constructor` → lowercase `constructor`; `Regexp/` → `RegExp/`; `Intl/DatetimeFormat` → `DateTimeFormat`; `Statements/empty` → `Empty`; `Global_objects/` → `Global_Objects/`; `template_literals` → `Template_literals`; `Errors/Strict_Non_Simple_Params` casing. Also resolve the bare `function` ambiguous arg (matches both `Operators/function` and `Statements/function`) by picking the expression form — all observed call sites are callback parameters in WebAPI pages. Display preservation keeps the original (mis-cased) form rendered so the link text is unchanged.
…er/Segments` `Intl.Segments` used to live at the top of the Intl namespace; the canonical sub-path now nests it under `Intl/Segmenter/`. Display preservation keeps the original `Intl.Segments` text rendered.
Round 2 of the case-fix sweep covering the dotted variants the round-1 mapping missed: `Date.valueof` → `Date.valueOf`, `Map.foreach` → `Map.forEach`, `Regexp.<member>` → `RegExp.<member>` (for `global`/`ignoreCase`/`multiline`/`sticky`), `object.defineProperty`/ `defineProperties` → `Object.`, and `Operators/conditional_operator` (uppercase Operators, lowercase Conditional) → `Operators/Conditional_operator`.
… in case
Over-zealous display preservation inserted by the case-fix sweep:
`{{jsxref("Object", "object")}}` was meant to keep "object" rendered,
but for JS type references the canonical (capitalized) class name
should also be the rendered text. Drop the redundant arg2 when it
matches arg1 case-insensitively — covers `Object`/`String`/`Number`/
`Array`/`Boolean`/`Promise`/`Symbol`/`undefined` and any other
mis-cased pair caught by the index-aware rari.
Only drops arg2 when it's the last positional arg (same safety policy
as `merge-parens-display`).
…perator shorthands Use the bare-keyword shortform for the 5 operator keywords `null`, `this`, `delete`, `new`, `instanceof` per the convention introduced in mdn/content#44221. The shortform resolves cleanly on current rari thanks to the `Reference/<kw>` -> `Reference/Operators/<kw>` redirects that PR added, and resolves natively under the index-aware rari from mdn/rari#715. Only collapses the redundant-display pattern (`("Operators/X", "X")`); longforms with custom display text (`"delete x"`, `"deleted"`, `"x instanceof y"`) are preserved.
Mirrors the en-US redirects added in mdn/content#44221 for the 5 operator-keyword shorthands (`null`, `this`, `delete`, `new`, `instanceof`). Without these per-locale redirects, the bare-keyword `{{jsxref("null")}}` shortform produces a 404 under the deployed rari; with them, it falls back via redirect to the canonical `Reference/Operators/<kw>` page. The index-aware rari from mdn/rari#715 resolves the shortform directly without needing the redirect.
jsxref macro args
Description
Clean up stale
jsxrefmacro arguments in Simplified Chinese content so they resolve against the en-US JS Reference index. Changes are scoped to the first argument ofjsxref()invocations; display text is preserved everywhere it was already explicit, and inserted as the original arg when missing so the rendered label keeps reflecting what the author originally wrote.17 commits, applied in order:
@@<name>toSymbol.<name>..prototypefrom class refs.Proxy.handler[.X](dot form) toProxy/Proxy[/X].Global_Objects/<IntlClass>[/X]toIntl/<IntlClass>[/X].Global_Objects/Proxy/handler[/X](+ one localized-namespace fix).<IntlClass>refs. Display preservation.jsxrefrefs to markdown links.Intl.SegmentsatIntl/Segmenter/Segments.("Operators/<kw>", "<kw>")→("<kw>")for the 5 operator-keyword shortforms (null,this,delete,new,instanceof), per the convention introduced in mdn/content#44221.Reference/<kw>→Reference/Operators/<kw>redirects that back the shorthand calls under the deployed rari.Motivation
These arguments produced broken or redirected links (
templ-broken-link/templ-redirected-link/templ-ill-cased-arg) in the upcoming Rari-based build. The new index-basedjsxrefresolver is being introduced in mdn/rari#715; this PR ensures the Simplified Chinese content resolves cleanly against both the deployed rari and the index-aware version.Additional details
main).rari@jsxref-with-index— only intentional-broken residuals remain (Number.toInteger(),SIMD,TypedArray.prototype.move()).rari@main(deployed), the operator-shorthand calls producetempl-redirected-linkwarnings (~120 per the new redirects). These warnings disappear once fix(jsxref): build Web/JavaScript index to resolve names rari#715 ships.templ-redirected-linkflaws remain underrari@mainfrom bare{{jsxref("Array")}}/{{jsxref("Boolean")}}etc. They redirect to the canonicalGlobal_Objects/<Class>page via 14 locale-specific entries infiles/zh-cn/_redirects.txt. The rendered URLs work correctly through the redirect chain; the index-aware rari resolves them directly without a redirect.Related issues and pull requests
Related to mdn/rari#715 and mdn/content#44221.