Module vs Classic Script Diff Lookup

Returns standard language facts for module or classic scripts: automatic strict mode, module scope and top-level var global binding. Classic scripts can opt into strict mode separately.

Description

JavaScript modules automatically use strict mode and module scope.

JavaScript modules automatically use strict mode and module scope. Classic scripts have different top-level bindings and can opt into strict mode separately.1

Returns standard language facts for module or classic scripts: automatic strict mode, module scope and top-level var global binding. Classic scripts can opt into strict mode separately.

When to use Module vs Classic Script Diff Lookup

Use this for the following task: Returns standard language facts for module or classic scripts: automatic strict mode, module scope and top-level var global binding. Classic scripts can opt into strict mode separately.

Prepare the parsed attribute values, element states or ordered local lists requested below. Keep attribute presence separate from value.

How to use Module vs Classic Script Diff Lookup and understand its results

  1. Prepare the parsed attribute values, element states or ordered local lists requested below. Keep attribute presence separate from value.
  2. Enter kind using the field table, then run the tool.
  3. Read automaticStrictMode, moduleScope, topLevelVarUsesGlobalBinding. Interpret flags, units, ordering and placeholder values using the rules below.
  4. Review any reported issue or failed check, correct the supplied values when appropriate, and verify the result in its intended context.
Input fieldMeaningValue type and boundsRequirement
kindKindstring; choose "classic", "module"Required

Select module or classic and return the three language-profile flags.2

module → automaticStrictMode and moduleScope; classic → topLevelVarUsesGlobalBinding

This summarizes the declared operation. Units, indexing, inclusivity and exceptional cases are explained in the surrounding text.

Output fieldMeaningValue type
automaticStrictModeAutomatic Strict Modeboolean
moduleScopeModule Scopeboolean
topLevelVarUsesGlobalBindingTop Level Var Uses Global Bindingboolean
json
{
  "input": {
    "kind": "module"
  },
  "output": {
    "automaticStrictMode": true,
    "moduleScope": true,
    "topLevelVarUsesGlobalBinding": false
  }
}

Limitations and assumptions

This does not execute JavaScript or inspect declarations, import dependencies or a classic script’s own strict-mode directive.

This evaluates supplied local information; it does not fetch a page or run a browser. Malformed requests produce input errors. A successfully evaluated request can still contain false flags, empty result lists or a result outside the supplied threshold; those outcomes have the meanings stated above.

Alternative or Complementary methods

Choose script defer/async Execution Order Table for this operation: Classifies execution scheduling of ordinary parser-inserted classic or module scripts. Async wins over defer; inline classic flags are ignored. This assumes scripting enabled and successful fetch/evaluation, without dynamic insertion or blocking attributes. For a complementary task, use template Inert Content Note for this operation: Classifies ordinary template DocumentFragment contents versus content already inserted into a document or a processed declarative shadow root. Only ordinary template contents remain in the inert template owner document; other reasons for inertness are not evaluated.

Further background: HTML / accessibility reference: Module vs Classic Script Diff Lookup.

References

  1. HTML / accessibility reference: Module vs Classic Script Diff Lookup — Ecma International / TC39

  2. Module vs Classic Script Diff Lookup — tool.io

Similar or alternative tools

  • script defer/async Execution Order Table

    Classifies execution scheduling of ordinary parser-inserted classic or module scripts. Async wins over defer; inline classic flags are ignored. This assumes scripting enabled and successful fetch/evaluation, without dynamic insertion or blocking attributes.

  • template Inert Content Note

    Classifies ordinary template DocumentFragment contents versus content already inserted into a document or a processed declarative shadow root. Only ordinary template contents remain in the inert template owner document; other reasons for inertness are not evaluated.

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies