Ticket board: model and safe rendering
Project milestone
Build an accessible support-ticket board from an in-memory collection. Each ticket has a numeric ID, a title and an open or closed state. Render titles as text, not markup.
Run the examples
Open projects/ticket-board/index.html fresh for each example and run the JavaScript in its browser console.
document.querySelector('#title').value = 'Printer';document.querySelector('#create').requestSubmit();console.log(document.querySelector('#status').textContent);Expected console output:
1 of 1 ticketsThe valid submit adds one open ticket and renders the count.
Open projects/ticket-board/index.html fresh for each example and run the JavaScript in its browser console.
document.querySelector('#title').value = '<b>Printer</b>';document.querySelector('#create').requestSubmit();console.log(document.querySelector('#tickets span').textContent);console.log(document.querySelectorAll('#tickets b').length);Expected console output:
<b>Printer</b>0The title is a literal text node, so no b element is created.
Implementation and contract
The submit handler trims the input, validates its length and enforces a 100-ticket limit. It creates a new array and assigns an increasing ID. render() builds a document fragment with native buttons and text spans. Inspect index.html and trace the state from the submit event to the list. No persistence or backend is included.
Common mistakes
Using a title as the DOM identity fails when two tickets share the same title. Never insert an untrusted title into an HTML parser.
Acceptance task
Add two tickets with the same title; confirm their buttons have different accessible names and independently change state.
Project source, setup and tests: projects/ticket-board/README.md. Read the implementation before modifying it; the tests check the supplied baseline, not every possible implementation.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Ticket board: model and safe rendering — Knowledge Check
Assess implementation decisions and project behavior.
Which property identifies two tickets with identical titles?
Why use a native button for the state transition?
Where is the authoritative ticket collection in this lab?
In the Ticket board: model and safe rendering lab, what does this independent example log? document.querySelector('#title').value = 'Printer'; document.querySelector('#create').requestSubmit(); console.log(document.querySelector('#status').textContent);
In the Ticket board: model and safe rendering lab, what does this independent example log? document.querySelector('#title').value = '<b>Printer</b>'; document.querySelector('#create').requestSubmit(); console.log(document.querySelector('#tickets span').textContent); console.log(document.querySelectorAll('#tickets b').length);