DiscoveryVIP / HTML & CSS AcademyHelp

100. Capstone project

Module 20 · About 30 minutes · Review the earlier HTML, CSS and DOM foundations relevant to this task.

Open Interactive Lesson

Discover

How can capstone project solve a concrete interface problem, and what actual evidence proves the result?

Predict

Record the expected structure or visual change before rendering. Name one thing that should remain unchanged.

Understand

A capstone combines requirements, state, rendering, validation and testable interactions. Define the smallest complete task before adding decoration. This working task board accepts a nonempty task, renders it with a native Complete button and updates state through a stable delegated listener. User text enters through textContent. The project is intentionally local and does not claim server synchronization; persistence and collaboration are independent extensions with their own failure cases.

Important source lines

index.html:1 <main><h1>Independent task board</h1><form id="form"><label>Task<input id="task" value="Review DOM"></label><button>Add task</button></form><p id="message" role="status"></p><ul id="tasks"></ul></main>
The document’s principal content, normally one visible instance.
styles.css:1 body { font: 18px/1.55 system-ui; margin: 1.5rem; color: #17324d; background: #f5f8fc; } button,input,select,textarea { font: inherit; } button { padding: .5rem .8rem; cursor: pointer; } :focus-visible { outline: 3px solid #155ec4; outline-offset: 3px; } [hidden] { display: none !important; } output { display: block; margin-block: .7rem; } .card { padding: 1rem; border: 1px solid #8a9db2; border-radius: .7rem; }
This CSS rule is a declared presentation policy. Inspect actual computed styles and real browser geometry separately.
script.js:1 const tasks = [];
Bind the named value for the following operations; const does not freeze referenced objects.
script.js:2 function render() { const list = document.querySelector("#tasks"); list.replaceChildren(); tasks.forEach((task, index) => { const item = document.createElement("li"); const label = document.createElement("span"); label.textContent = task.text + (task.complete ? " — Complete" : " — Pending"); const button = document.createElement("button"); button.textContent = "Complete"; button.dataset.index = index; button.disabled = task.complete; item.append(label, button); list.append(item); }); }
Create a detached DOM element. Give it safe text and attributes before inserting it.
script.js:3 document.querySelector("#form").addEventListener("submit", event => { event.preventDefault(); const text = document.querySelector("#task").value.trim(); if (!text) { document.querySelector("#message").textContent = "Enter a task"; return; } tasks.push({text, complete: false}); render(); document.querySelector("#message").textContent = "Task added"; });
Register a real event callback. The function runs after the named event; registration alone does not perform the action.
script.js:4 document.querySelector("#tasks").addEventListener("click", event => { const button = event.target.closest("button[data-index]"); if (!button) return; tasks[Number(button.dataset.index)].complete = true; render(); });
Register a real event callback. The function runs after the named event; registration alone does not perform the action.

All five examples belong to this lesson’s operation. The broken case is explicitly labeled and cannot earn repaired-work credit. The source regression checks DOM contracts; CSS source, browser geometry and complete accessibility need their separately stated evidence.

Example 1: Working capstone project

Adding then completing a task renders Review DOM — Complete with a disabled completion button.

index.html

<main><h1>Independent task board</h1><form id="form"><label>Task<input id="task" value="Review DOM"></label><button>Add task</button></form><p id="message" role="status"></p><ul id="tasks"></ul></main>

styles.css

body { font: 18px/1.55 system-ui; margin: 1.5rem; color: #17324d; background: #f5f8fc; } button,input,select,textarea { font: inherit; } button { padding: .5rem .8rem; cursor: pointer; } :focus-visible { outline: 3px solid #155ec4; outline-offset: 3px; } [hidden] { display: none !important; } output { display: block; margin-block: .7rem; } .card { padding: 1rem; border: 1px solid #8a9db2; border-radius: .7rem; }

script.js

const tasks = [];
function render() { const list = document.querySelector("#tasks"); list.replaceChildren(); tasks.forEach((task, index) => { const item = document.createElement("li"); const label = document.createElement("span"); label.textContent = task.text + (task.complete ? " — Complete" : " — Pending"); const button = document.createElement("button"); button.textContent = "Complete"; button.dataset.index = index; button.disabled = task.complete; item.append(label, button); list.append(item); }); }
document.querySelector("#form").addEventListener("submit", event => { event.preventDefault(); const text = document.querySelector("#task").value.trim(); if (!text) { document.querySelector("#message").textContent = "Enter a task"; return; } tasks.push({text, complete: false}); render(); document.querySelector("#message").textContent = "Task added"; });
document.querySelector("#tasks").addEventListener("click", event => { const button = event.target.closest("button[data-index]"); if (!button) return; tasks[Number(button.dataset.index)].complete = true; render(); });

Expected: Adding then completing a task renders Review DOM — Complete with a disabled completion button.

Edit and Render This Example
Example 2: Long-content and literal-text boundary

Keep the same core operation with an additional realistic long-text record. Inspect wrapping, preserved controls and safe literal characters. This is a content-stress case; actual layout and meaning require visual review.

index.html

<main><h1>Independent task board</h1><form id="form"><label>Task<input id="task" value="Review DOM"></label><button>Add task</button></form><p id="message" role="status"></p><ul id="tasks"></ul></main>
<section aria-label="Additional content case"><p id="content-boundary">Lesson 100: A long account or course title must remain readable with spaces and literal &lt;angle brackets&gt;. A long account or course title must remain readable with spaces and literal &lt;angle brackets&gt;. </p></section>

styles.css

body { font: 18px/1.55 system-ui; margin: 1.5rem; color: #17324d; background: #f5f8fc; } button,input,select,textarea { font: inherit; } button { padding: .5rem .8rem; cursor: pointer; } :focus-visible { outline: 3px solid #155ec4; outline-offset: 3px; } [hidden] { display: none !important; } output { display: block; margin-block: .7rem; } .card { padding: 1rem; border: 1px solid #8a9db2; border-radius: .7rem; }
#content-boundary { overflow-wrap:anywhere; max-width:60ch; }

script.js

const tasks = [];
function render() { const list = document.querySelector("#tasks"); list.replaceChildren(); tasks.forEach((task, index) => { const item = document.createElement("li"); const label = document.createElement("span"); label.textContent = task.text + (task.complete ? " — Complete" : " — Pending"); const button = document.createElement("button"); button.textContent = "Complete"; button.dataset.index = index; button.disabled = task.complete; item.append(label, button); list.append(item); }); }
document.querySelector("#form").addEventListener("submit", event => { event.preventDefault(); const text = document.querySelector("#task").value.trim(); if (!text) { document.querySelector("#message").textContent = "Enter a task"; return; } tasks.push({text, complete: false}); render(); document.querySelector("#message").textContent = "Task added"; });
document.querySelector("#tasks").addEventListener("click", event => { const button = event.target.closest("button[data-index]"); if (!button) return; tasks[Number(button.dataset.index)].complete = true; render(); });

Expected: Adding then completing a task renders Review DOM — Complete with a disabled completion button.

Edit and Render This Example
Example 3: Observe actual DOM mutations

Install a real MutationObserver before the same operation. Its live counter records actual child-list, attribute and character-data changes; it is not a browser-internal paint profiler.

index.html

<main><h1>Independent task board</h1><form id="form"><label>Task<input id="task" value="Review DOM"></label><button>Add task</button></form><p id="message" role="status"></p><ul id="tasks"></ul></main>
<p>Actual observed mutation records: <output id="mutation-count">0</output></p>

styles.css

body { font: 18px/1.55 system-ui; margin: 1.5rem; color: #17324d; background: #f5f8fc; } button,input,select,textarea { font: inherit; } button { padding: .5rem .8rem; cursor: pointer; } :focus-visible { outline: 3px solid #155ec4; outline-offset: 3px; } [hidden] { display: none !important; } output { display: block; margin-block: .7rem; } .card { padding: 1rem; border: 1px solid #8a9db2; border-radius: .7rem; }

script.js

const mutationOutput = document.querySelector("#mutation-count");
let mutationCount = 0;
const mutationObserver = new MutationObserver(records => { const relevant = records.filter(record => record.target !== mutationOutput && !mutationOutput.contains(record.target)); if (!relevant.length) return; mutationCount += relevant.length; mutationOutput.textContent = String(mutationCount); });
mutationObserver.observe(document.body, {subtree:true, childList:true, attributes:true, characterData:true});
const tasks = [];
function render() { const list = document.querySelector("#tasks"); list.replaceChildren(); tasks.forEach((task, index) => { const item = document.createElement("li"); const label = document.createElement("span"); label.textContent = task.text + (task.complete ? " — Complete" : " — Pending"); const button = document.createElement("button"); button.textContent = "Complete"; button.dataset.index = index; button.disabled = task.complete; item.append(label, button); list.append(item); }); }
document.querySelector("#form").addEventListener("submit", event => { event.preventDefault(); const text = document.querySelector("#task").value.trim(); if (!text) { document.querySelector("#message").textContent = "Enter a task"; return; } tasks.push({text, complete: false}); render(); document.querySelector("#message").textContent = "Task added"; });
document.querySelector("#tasks").addEventListener("click", event => { const button = event.target.closest("button[data-index]"); if (!button) return; tasks[Number(button.dataset.index)].complete = true; render(); });

Expected: Adding then completing a task renders Review DOM — Complete with a disabled completion button.

Edit and Render This Example
Example 4: Predict and inspect the intentional fault

This source deliberately replaces .complete = true with .complete = false. Reproduce the mismatch, identify its cause and compare the corrected source.

index.html

<main><h1>Independent task board</h1><form id="form"><label>Task<input id="task" value="Review DOM"></label><button>Add task</button></form><p id="message" role="status"></p><ul id="tasks"></ul></main>

styles.css

body { font: 18px/1.55 system-ui; margin: 1.5rem; color: #17324d; background: #f5f8fc; } button,input,select,textarea { font: inherit; } button { padding: .5rem .8rem; cursor: pointer; } :focus-visible { outline: 3px solid #155ec4; outline-offset: 3px; } [hidden] { display: none !important; } output { display: block; margin-block: .7rem; } .card { padding: 1rem; border: 1px solid #8a9db2; border-radius: .7rem; }

script.js

const tasks = [];
function render() { const list = document.querySelector("#tasks"); list.replaceChildren(); tasks.forEach((task, index) => { const item = document.createElement("li"); const label = document.createElement("span"); label.textContent = task.text + (task.complete ? " — Complete" : " — Pending"); const button = document.createElement("button"); button.textContent = "Complete"; button.dataset.index = index; button.disabled = task.complete; item.append(label, button); list.append(item); }); }
document.querySelector("#form").addEventListener("submit", event => { event.preventDefault(); const text = document.querySelector("#task").value.trim(); if (!text) { document.querySelector("#message").textContent = "Enter a task"; return; } tasks.push({text, complete: false}); render(); document.querySelector("#message").textContent = "Task added"; });
document.querySelector("#tasks").addEventListener("click", event => { const button = event.target.closest("button[data-index]"); if (!button) return; tasks[Number(button.dataset.index)].complete = false; render(); });

Expected: Adding then completing a task renders Review DOM — Complete with a disabled completion button.

Edit and Render This Example
Example 5: Executable regression and independent expectations

Use the actual authored initial checks and fresh interaction assertions printed below. The in-page verifier performs real DOM operations and rejects mismatches; it does not infer correctness from source keywords.

index.html

<main><h1>Independent task board</h1><form id="form"><label>Task<input id="task" value="Review DOM"></label><button>Add task</button></form><p id="message" role="status"></p><ul id="tasks"></ul></main>
<button id="run-regression" type="button">Run declared regression</button><pre id="regression-result">Not tested</pre>

styles.css

body { font: 18px/1.55 system-ui; margin: 1.5rem; color: #17324d; background: #f5f8fc; } button,input,select,textarea { font: inherit; } button { padding: .5rem .8rem; cursor: pointer; } :focus-visible { outline: 3px solid #155ec4; outline-offset: 3px; } [hidden] { display: none !important; } output { display: block; margin-block: .7rem; } .card { padding: 1rem; border: 1px solid #8a9db2; border-radius: .7rem; }

script.js

const tasks = [];
function render() { const list = document.querySelector("#tasks"); list.replaceChildren(); tasks.forEach((task, index) => { const item = document.createElement("li"); const label = document.createElement("span"); label.textContent = task.text + (task.complete ? " — Complete" : " — Pending"); const button = document.createElement("button"); button.textContent = "Complete"; button.dataset.index = index; button.disabled = task.complete; item.append(label, button); list.append(item); }); }
document.querySelector("#form").addEventListener("submit", event => { event.preventDefault(); const text = document.querySelector("#task").value.trim(); if (!text) { document.querySelector("#message").textContent = "Enter a task"; return; } tasks.push({text, complete: false}); render(); document.querySelector("#message").textContent = "Task added"; });
document.querySelector("#tasks").addEventListener("click", event => { const button = event.target.closest("button[data-index]"); if (!button) return; tasks[Number(button.dataset.index)].complete = true; render(); });
document.querySelector("#run-regression").addEventListener("click", async () => {
 const spec = {"rules": [{"type": "exists", "selector": "#form", "label": "exists: #form"}], "case": {"title": "Declared interaction contract", "actions": [{"type": "submit", "selector": "#form"}, {"type": "click", "selector": "#tasks button"}], "assertions": [{"type": "text", "selector": "#tasks li span", "value": "Review DOM \u2014 Complete"}, {"type": "property", "selector": "#tasks button", "property": "disabled", "value": true}]}};
 const failures = [];
 const choose = selector => document.querySelector(selector);
 for (const check of spec.rules) {
  const element = choose(check.selector);
  if (check.type === "exists" && !element) failures.push(check.label);
  if (check.type === "count" && document.querySelectorAll(check.selector).length < check.value) failures.push(check.label);
  if (check.type === "text" && !element?.textContent.includes(check.value)) failures.push(check.label);
  if (check.type === "attr" && element?.getAttribute(check.property) !== check.value) failures.push(check.label);
  if (check.type === "label" && !element?.labels?.length) failures.push(check.label);
 }
 if (spec.case) {
  for (const action of spec.case.actions) {
   const element = choose(action.selector);
   if (!element) { failures.push("Missing action target " + action.selector); continue; }
   if (action.type === "click") element.click();
   if (action.type === "input" || action.type === "change") { element.value = action.value; element.dispatchEvent(new Event(action.type, {bubbles:true})); }
   if (action.type === "key") element.dispatchEvent(new KeyboardEvent("keydown", {key:action.key,bubbles:true,cancelable:true}));
   if (action.type === "submit") element.dispatchEvent(new Event("submit", {bubbles:true,cancelable:true}));
  }
  await new Promise(resolve => setTimeout(resolve, 60));
  for (const check of spec.case.assertions) {
   const element = choose(check.selector);
   const actual = check.type === "count" ? document.querySelectorAll(check.selector).length : check.type === "attribute" ? element?.getAttribute(check.property) : check.type === "property" ? check.property === "focused" ? document.activeElement === element : element?.[check.property] : element?.textContent;
   const pass = check.exact === false ? String(actual).includes(check.value) : actual === check.value;
   if (!pass) failures.push(check.selector + ": expected " + JSON.stringify(check.value) + ", actual " + JSON.stringify(actual));
  }
 }
 document.querySelector("#regression-result").textContent = failures.length ? "FAIL: " + failures.join("; ") : "PASS: declared DOM contract; review CSS/layout separately";
});

Expected: Adding then completing a task renders Review DOM — Complete with a disabled completion button.

Edit and Render This Example

Build and test

Adding then completing a task renders Review DOM — Complete with a disabled completion button. Repair the prepared fault while preserving unrelated content. For an interactive lesson run the selected fresh interaction case, not only initial-structure checks.

Starter index.html

<main><h1>Independent task board</h1><form id="form"><label>Task<input id="task" value="Review DOM"></label><button>Add task</button></form><p id="message" role="status"></p><ul id="tasks"></ul></main>

Starter styles.css

body { font: 18px/1.55 system-ui; margin: 1.5rem; color: #17324d; background: #f5f8fc; } button,input,select,textarea { font: inherit; } button { padding: .5rem .8rem; cursor: pointer; } :focus-visible { outline: 3px solid #155ec4; outline-offset: 3px; } [hidden] { display: none !important; } output { display: block; margin-block: .7rem; } .card { padding: 1rem; border: 1px solid #8a9db2; border-radius: .7rem; }

Objective contract

[
  {
    "type": "exists",
    "selector": "#form",
    "label": "exists: #form"
  }
]
Hint 1

Compare the exact expected result with the first actual mismatch, using the parsed DOM and the selected event case.

Hint 2

Find .complete = false in the exercise and compare its role with .complete = true.

Hint 3

Restore .complete = true or an equivalent correct implementation. Run the fresh case again and explain the changed relationship.

Complete reference solution

index.html

<main><h1>Independent task board</h1><form id="form"><label>Task<input id="task" value="Review DOM"></label><button>Add task</button></form><p id="message" role="status"></p><ul id="tasks"></ul></main>

styles.css

body { font: 18px/1.55 system-ui; margin: 1.5rem; color: #17324d; background: #f5f8fc; } button,input,select,textarea { font: inherit; } button { padding: .5rem .8rem; cursor: pointer; } :focus-visible { outline: 3px solid #155ec4; outline-offset: 3px; } [hidden] { display: none !important; } output { display: block; margin-block: .7rem; } .card { padding: 1rem; border: 1px solid #8a9db2; border-radius: .7rem; }

Explain, reflect and extend

Which actual node, state transition or computed value proves this result? Name an independent input and expected output, then explain one remaining manual or compatibility check.

Apply the same relationship to a new realistic content case. Predict the normal, boundary and invalid outcomes first. Preserve keyboard access and narrow-screen usability, then have another learner reproduce the result.

Troubleshooting and professional practice

Confirm the active file, enable JavaScript and run a fresh preview. A changed source is not installed until the preview reruns. Use the DOM tree to locate missing targets, Console for actual errors, and the selected interaction test for exact behavior. CSS geometry requires a real browser. DOM structure and event results are testable offline. Geometry, native interaction and visual accessibility require a real browser review.

Knowledge check

Explain why the stated result follows from the source. Predict a second input or width and test it independently. Automated contracts and written explanations are reviewed separately.

Optional AI prompts

  1. Explain this lesson’s source line by line using the actual objective above.
  2. Help implement one small extension and define normal, boundary and failure tests.
  3. Review/debug the source against actual preview observations; verify standards and never claim rendering without evidence.

Detailed learning and editor help · Standards reference

Definitions and use case

Use this technique in a reusable, responsive interface whose labels, state and behavior stay consistent. Adding then completing a task renders Review DOM — Complete with a disabled completion button.

Capstone project
A capstone combines requirements, state, rendering, validation and testable interactions.
DOM contract
A fixed expected structure, attribute, property or event result under declared inputs.
Browser observation
An actual computed style, geometry reading or supported callback from the controlled preview; a DOM-only test does not reproduce layout.

Interaction experiments and exact contracts

Run the current source in a fresh preview. Choose an interaction case, predict, then Check My Work. These automated actions are synthetic events; repeat important tasks with a real keyboard and pointer.

Example 1: source explanation and interaction checks

index.html:1 The document’s principal content, normally one visible instance.

styles.css:1 This CSS rule is a declared presentation policy. Inspect actual computed styles and real browser geometry separately.

script.js:1 Bind the named value for the following operations; const does not freeze referenced objects.

script.js:2 Create a detached DOM element. Give it safe text and attributes before inserting it.

script.js:3 Register a real event callback. The function runs after the named event; registration alone does not perform the action.

script.js:4 Register a real event callback. The function runs after the named event; registration alone does not perform the action.

Declared interaction contract

{
  "title": "Declared interaction contract",
  "actions": [
    {
      "type": "submit",
      "selector": "#form"
    },
    {
      "type": "click",
      "selector": "#tasks button"
    }
  ],
  "assertions": [
    {
      "type": "text",
      "selector": "#tasks li span",
      "value": "Review DOM \u2014 Complete"
    },
    {
      "type": "property",
      "selector": "#tasks button",
      "property": "disabled",
      "value": true
    }
  ]
}
Example 2: source explanation and interaction checks

index.html:1 The document’s principal content, normally one visible instance.

index.html:2 A thematic grouping, usually identified by a heading.

styles.css:1 This CSS rule is a declared presentation policy. Inspect actual computed styles and real browser geometry separately.

styles.css:2 Permits long unbroken text to wrap to avoid overflow. Context: constrained scrolling box

script.js:1 Bind the named value for the following operations; const does not freeze referenced objects.

script.js:2 Create a detached DOM element. Give it safe text and attributes before inserting it.

script.js:3 Register a real event callback. The function runs after the named event; registration alone does not perform the action.

script.js:4 Register a real event callback. The function runs after the named event; registration alone does not perform the action.

Declared interaction contract

{
  "title": "Declared interaction contract",
  "actions": [
    {
      "type": "submit",
      "selector": "#form"
    },
    {
      "type": "click",
      "selector": "#tasks button"
    }
  ],
  "assertions": [
    {
      "type": "text",
      "selector": "#tasks li span",
      "value": "Review DOM \u2014 Complete"
    },
    {
      "type": "property",
      "selector": "#tasks button",
      "property": "disabled",
      "value": true
    }
  ]
}
Example 3: source explanation and interaction checks

index.html:1 The document’s principal content, normally one visible instance.

index.html:2 A paragraph of prose.

styles.css:1 This CSS rule is a declared presentation policy. Inspect actual computed styles and real browser geometry separately.

script.js:1 Resolve the first matching live DOM element. A missing match is null and requires handling.

script.js:2 Declare mutable local state; update it before projecting the state into the DOM.

script.js:3 Read or replace actual text without parsing user data as HTML. Select only the intended text container.

script.js:4 Detect and use the browser API only where available; actual geometry is not fabricated offline.

script.js:5 Bind the named value for the following operations; const does not freeze referenced objects.

script.js:6 Create a detached DOM element. Give it safe text and attributes before inserting it.

script.js:7 Register a real event callback. The function runs after the named event; registration alone does not perform the action.

script.js:8 Register a real event callback. The function runs after the named event; registration alone does not perform the action.

Declared interaction contract

{
  "title": "Declared interaction contract",
  "actions": [
    {
      "type": "submit",
      "selector": "#form"
    },
    {
      "type": "click",
      "selector": "#tasks button"
    }
  ],
  "assertions": [
    {
      "type": "text",
      "selector": "#tasks li span",
      "value": "Review DOM \u2014 Complete"
    },
    {
      "type": "property",
      "selector": "#tasks button",
      "property": "disabled",
      "value": true
    }
  ]
}
Example 4: source explanation and interaction checks

index.html:1 The document’s principal content, normally one visible instance.

styles.css:1 This CSS rule is a declared presentation policy. Inspect actual computed styles and real browser geometry separately.

script.js:1 Bind the named value for the following operations; const does not freeze referenced objects.

script.js:2 Create a detached DOM element. Give it safe text and attributes before inserting it.

script.js:3 Register a real event callback. The function runs after the named event; registration alone does not perform the action.

script.js:4 Register a real event callback. The function runs after the named event; registration alone does not perform the action.

Declared interaction contract

{
  "title": "Declared interaction contract",
  "actions": [
    {
      "type": "submit",
      "selector": "#form"
    },
    {
      "type": "click",
      "selector": "#tasks button"
    }
  ],
  "assertions": [
    {
      "type": "text",
      "selector": "#tasks li span",
      "value": "Review DOM \u2014 Complete"
    },
    {
      "type": "property",
      "selector": "#tasks button",
      "property": "disabled",
      "value": true
    }
  ]
}
Example 5: source explanation and interaction checks

index.html:1 The document’s principal content, normally one visible instance.

index.html:2 A native action control with keyboard behavior.

styles.css:1 This CSS rule is a declared presentation policy. Inspect actual computed styles and real browser geometry separately.

script.js:1 Bind the named value for the following operations; const does not freeze referenced objects.

script.js:2 Create a detached DOM element. Give it safe text and attributes before inserting it.

script.js:3 Register a real event callback. The function runs after the named event; registration alone does not perform the action.

script.js:4 Register a real event callback. The function runs after the named event; registration alone does not perform the action.

script.js:5 Register a real event callback. The function runs after the named event; registration alone does not perform the action.

script.js:6 Bind the named value for the following operations; const does not freeze referenced objects.

script.js:7 Bind the named value for the following operations; const does not freeze referenced objects.

script.js:8 Resolve the first matching live DOM element. A missing match is null and requires handling.

script.js:9 Bind the named value for the following operations; const does not freeze referenced objects.

script.js:10 Bind the named value for the following operations; const does not freeze referenced objects.

script.js:11 Follow this control flow using the declared state and event. Compare actual DOM results against the fixed expected contract.

script.js:12 Resolve the first matching live DOM element. A missing match is null and requires handling.

script.js:13 Read or replace actual text without parsing user data as HTML. Select only the intended text container.

script.js:14 Follow this control flow using the declared state and event. Compare actual DOM results against the fixed expected contract.

script.js:15 Follow this control flow using the declared state and event. Compare actual DOM results against the fixed expected contract.

script.js:16 Follow this control flow using the declared state and event. Compare actual DOM results against the fixed expected contract.

script.js:17 Follow this control flow using the declared state and event. Compare actual DOM results against the fixed expected contract.

script.js:18 Bind the named value for the following operations; const does not freeze referenced objects.

script.js:19 Bind the named value for the following operations; const does not freeze referenced objects.

script.js:20 Follow this control flow using the declared state and event. Compare actual DOM results against the fixed expected contract.

script.js:21 Follow this control flow using the declared state and event. Compare actual DOM results against the fixed expected contract.

script.js:22 Follow this control flow using the declared state and event. Compare actual DOM results against the fixed expected contract.

script.js:23 Follow this control flow using the declared state and event. Compare actual DOM results against the fixed expected contract.

script.js:24 Follow this control flow using the declared state and event. Compare actual DOM results against the fixed expected contract.

script.js:25 Follow this control flow using the declared state and event. Compare actual DOM results against the fixed expected contract.

script.js:26 Queue asynchronous work after a minimum delay; no exact timing is promised.

script.js:27 Bind the named value for the following operations; const does not freeze referenced objects.

script.js:28 Bind the named value for the following operations; const does not freeze referenced objects.

script.js:29 Read or replace actual text without parsing user data as HTML. Select only the intended text container.

script.js:30 Bind the named value for the following operations; const does not freeze referenced objects.

script.js:31 Follow this control flow using the declared state and event. Compare actual DOM results against the fixed expected contract.

script.js:32 Follow this control flow using the declared state and event. Compare actual DOM results against the fixed expected contract.

script.js:33 Follow this control flow using the declared state and event. Compare actual DOM results against the fixed expected contract.

script.js:34 Read or replace actual text without parsing user data as HTML. Select only the intended text container.

script.js:35 Follow this control flow using the declared state and event. Compare actual DOM results against the fixed expected contract.

Run the executable regression on a fresh page

{
  "title": "Run the executable regression on a fresh page",
  "actions": [
    {
      "type": "click",
      "selector": "#run-regression"
    }
  ],
  "assertions": [
    {
      "type": "text",
      "selector": "#regression-result",
      "value": "PASS: declared DOM contract",
      "exact": false
    }
  ]
}

Common mistakes and official references

DOM introduction and actual node relationships

EventTarget.addEventListener

Accessible interaction patterns