ICANNWiki:Documentation/CLS: Difference between revisions

table update // via Wikitext Extension for VSCode
// via Wikitext Extension for VSCode
 
Line 3: Line 3:
== MediaWiki Rendering Priority (General Reference) ==
== MediaWiki Rendering Priority (General Reference) ==
When diagnosing layout or UI stability issues, think of a rendering priority stack. Earlier layers shape what the browser paints first; later layers should respect the space and structure already defined.
When diagnosing layout or UI stability issues, think of a rendering priority stack. Earlier layers shape what the browser paints first; later layers should respect the space and structure already defined.
== MediaWiki Rendering Priority (General Reference) ==
When diagnosing layout or UI stability issues, treat the page as (1) server-side DOM construction, then (2) ResourceLoader-delivered CSS/JS behaviors, then (3) late/third-party content. The key operational goal is: layout anchors should exist in the delivered HTML and have CSS-reserved space before any JS enhances them.
== MediaWiki Rendering Priority (General Reference) ==
When diagnosing layout or UI stability issues, treat the page as a priority stack. Earlier layers define the DOM shell and layout anchors; later layers should enhance what already exists rather than inventing structure late.


{| class="wikitable"
{| class="wikitable"
Line 8: Line 14:
! Responsibility
! Responsibility
! Reference
! Reference
! Notes
! Operational notes
|-
|-
| Server-rendered HTML
| Server-side HTML (Page chrome + Wrappers)
| Defines MediaWiki-supplied structural skeleton and default behavior
| MediaWiki + Skin core output: the outer page structure and content wrappers into which parsed content gets inserted
| Backend
| Backend core + Skin
| Highest influence on first paint
| This is the “wiki looks like a wiki” layer; Lua/templates can't normally replace this outer chrome.
|-
|-
| Lua module output
| Lua (#invoke)
| Emits markup/data server-side, but slightly after backend
| Emits arbitrary HTML/wikitext at parser-time, which become part of the delivered HTML inside content wrappers
| Scribunto
| Scribunto
| Ensure the final HTML shape is fixed before delivery
| Distinct authoring surface; an "upper layer" that still ships as part of the server HTML response.
|-
|-
| CSS
| CSS (skin + site + template-scoped)
| Core layout rules, space reservation, visibility
| Layout/visibility/space reservation via stylesheets linked from the HTML (ResourceLoader); may include site CSS (e.g., Common.css) and other modules
| Common.css + page overrides
| ResourceLoader styles + Common.css
| Must load before first paint
| ResourceLoader explicitly treats stylesheets as a first-class, HTML-linked resource; this is where you must reserve space and define “anchors” before any JS runs.
|-
|-
| Gadget JS
| ResourceLoader startup runtime
| Populates/toggles UI, fetches data
| The only script linked directly from the HTML; it bootstraps mw.loader and then batches/requests the rest of the JS modules (including gadgets and site scripts)
| MediaWikiGadgets-definition
| ResourceLoader startup module
| Target pre-existing containers; avoid structural reflow
| Key reality check: anything not in startup (i.e., basically all custom JS) cannot influence first paint and will necessarily be “later”.
|-
|-
| General JS
| Gadget JS (ResourceLoader modules)
| Cross-site utilities and enhancements
| Optional enhancement modules registered by Extension:Gadgets; can declare dependencies and can be configured for earlier loading when needed
| Common.js
| Extension:Gadgets (ResourceLoader)
| Should not reshape layout anchors; respect reserved space
| Gadgets are explicitly ResourceLoader modules (and can declare dependencies).
|-
| Site JS (Common.js, Skin.js)
| Site-wide and skin-specific scripts bundled by SiteModule (includes MediaWiki:Common.js)
| ResourceLoader SiteModule
| Common.js is delivered via ResourceLoader SiteModule.
|-
|-
| Embedded content / third-party widgets
| Embedded content / third-party widgets
| External iframes or async components
| External iframes or async components arriving late
| Arbitrary loose HTML
| External HTML/JS
| Reserve dimensions up front; treat as content, not structure
| Treat as content, not structure; reserve dimensions up front (width/height/aspect ratio/min-height) to avoid CLS.
|}
|}