A duplicated practice card looks just like the original. Its heading, classes and button label are present. The original button responds, but the copied button does nothing. The copy is not necessarily broken markup: the missing part may belong to a different layer of the component.
The short answer is that cloneNode copies node structure according to the DOM cloning rules, with descendants included when requested. It does not duplicate listeners registered on the original nodes through addEventListener. An HTML event-handler attribute is a different mechanism from a separately registered callback. Native button behaviour, delegated ancestor listeners and later initialisation also need to be distinguished before deciding why a copy responds.
This guide follows an original fictional practice-card component through cloning, insertion, listener setup and cleanup. It keeps structure, node identity, callback registration and application state in separate records. Its event traces are paper examples checked against the platform contracts, not claims of browser or device execution.
This specialist guide belongs to the Websites root. It also connects to The Gold Standard of Education | Learning That Transfers into Life and the How X Works hub. The worked cases are original teaching examples; their numbers are stipulated so that the reasoning can be checked.
eduKateSG · Websites
Find your next learning step
A copied button can preserve its label without inheriting its original listener registrations. Find which structure was created, which target received a handler, and which instance that handler changes.
ROUTE 1 · CHAPTERS 1–4
Identify the copied structure
Trace attributes, descendants and the new node identities.
ROUTE 2 · CHAPTERS 5–8
Find the responding listener
Separate missing setup, shared callbacks, captured references and delegation.
ROUTE 3 · CHAPTERS 9–11
Check handler and state boundaries
Compare content attributes, handler properties and application-owned state.
ROUTE 4 · CHAPTERS 12–14
Check the destination
Audit presentation context, copied identifiers and insertion.
ROUTE 5 · CHAPTERS 15–18
Establish instance ownership
Test setup flags, cleanup, reproductions and the complete interaction.
Chapter contents
Identify the copied structure · Chapters 1–4
1. Identify what the copied card is supposed to do
2. Separate attributes, children and registrations
Find the responding listener · Chapters 5–8
5. Explain the first nonresponsive copy
6. Register the same callback on a different target
Check handler and state boundaries · Chapters 9–11
9. Distinguish an HTML handler attribute from addEventListener
Check the destination · Chapters 12–14
12. Do not treat matching classes as matching presentation conditions
Establish instance ownership · Chapters 15–18
15. Audit initialisation flags copied as attributes
16. Keep cleanup ownership explicit for every instance
17. Build a reproduction that distinguishes the mechanisms
18. Report the missing layer instead of blaming the whole copy
CHAPTER 1 OF 18 · Identify the copied structure
1. Identify what the copied card is supposed to do
Imagine a vocabulary exercise that lets a learner reveal a hint on each practice card. A card has a title, a hint paragraph and a Reveal hint button. The hint begins hidden. Selecting the button reveals only the hint belonging to that card.
For this lesson, the button is explicitly type button. It is not being used to submit a form. That makes the intended custom action easy to separate from unrelated native submission behaviour.
The original card is O. A copy will be C. The product requirement is not merely that C resembles O. It is that C has its own readable title, its own hint state and a control that acts on C without unexpectedly changing O.
Write those requirements before choosing a copying API. A screenshot can show resemblance but cannot establish which callback runs, which hint it changes or how cleanup works. The visitor experiences the complete interaction, not only the copied pixels.
This gives us four records to follow: the node tree, the identities of the nodes in that tree, the listeners registered on particular targets and the application state associated with each card. A duplication feature needs a deliberate account of all four. cloneNode supplies part of that account; it is not a general instruction to duplicate a running application component.
CHAPTER 2 OF 18 · Identify the copied structure
2. Separate attributes, children and registrations
An ordinary element has attributes such as class, id and data labels. Its children can include text nodes and other elements. A listener registered with addEventListener is associated with an EventTarget through the event-listener mechanism. It is not stored as a child element in the markup.
For O, stipulate a section element containing a heading, a hint paragraph and a button. The button has a class used for styling. Application code registers revealOriginal on that specific button object.
The visible label Reveal hint is a text child of the button. The class is an attribute. revealOriginal is a callback registered in the button's listener list. These three pieces can all contribute to one apparent control while belonging to different contracts.
When the copy has the label and class but not the registered callback, two parts were preserved and one was not transferred. Calling the whole copy empty or saying cloning copied everything obscures that precise difference.
Use a four-column ledger for the component: node or attribute, original value, copied structure, separately established behaviour. The final column is not an invitation to invent a handler. It is where the component's initialisation policy must explain how C becomes an independent usable instance after its structure has been created.
CHAPTER 3 OF 18 · Identify the copied structure
3. Follow a shallow clone before adding descendants
Calling cloneNode without requesting the subtree creates a shallow copy under the relevant node-cloning rules. For the ordinary section in this exercise, its element attributes are copied, but the heading, paragraph and button descendants are not included.
The result can therefore retain the card's class while containing no visible card content. That is not the same failure as a deep copy whose button exists but lacks a custom listener. Begin diagnosis by checking whether the expected nodes are present.
For a paper trace, O has three element children: H1, P1 and B1. A shallow copy C has no copies of those child nodes. A search for C's button cannot produce B2 merely because O contains B1.
Do not repair the missing button by registering a listener on the original B1 again. That operation addresses the original target, and its duplicate-registration rules are a separate issue. It does not add a descendant to C.
The changed-context check is simple. Replace the section example with an ordinary button whose label is a text child. A shallow clone can preserve its type and class attributes while omitting that text child. The word shallow describes which node structure is included; it does not mean copy the part that looked visually important to the author.
CHAPTER 4 OF 18 · Identify the copied structure
4. Trace the deep copy’s new identities
Now request a deep copy of O's ordinary light-DOM subtree. The copy includes corresponding heading, hint and button nodes. Label them H2, P2 and B2. Their text and attributes follow the cloning rules, but H2 is not H1 and B2 is not B1.
Before insertion, C is a newly created subtree distinct from O. Creating it does not itself insert a second card beside the first. The application must deliberately place the copy where it belongs.
Retain the identity distinction after insertion. A visible title may be identical on both cards, yet event registration and application ownership remain tied to particular objects. A reference saved earlier to B1 does not automatically become a reference to whichever button now looks like it.
For an independent check, ask the learner which node revealOriginal was registered on. The answer is B1. The fact that B2 has the same class and label does not establish a registration on B2.
This is also why comparing structure is not enough to prove behaviour. A structural equality test concerns its specified node and attribute conditions. It does not provide an inventory of registered callbacks, outstanding operations or application-owned state. Two subtrees can be structurally alike while participating in different interactions.
CHAPTER 5 OF 18 · Find the responding listener
5. Explain the first nonresponsive copy
At stage A, O exists and B1 has one click listener, revealOriginal. At stage B, code creates the deep copy C, including B2. At stage C, it inserts C into the list. No initialisation registers a custom click listener on B2.
In this controlled example there are also no delegated ancestor handlers and no event-handler attributes. Activating B1 invokes revealOriginal and reveals P1. Activating B2 has no registered custom reveal callback to invoke, so P2 remains in its starting state.
That conclusion follows from the complete stipulated registration record. It is not a rule that every cloned button must appear inert. Later chapters change the other mechanisms that can cause a response.
The correct repair starts by choosing how the new instance gets its behaviour. One option is an explicit initialisation function that receives C, locates B2 and P2 within C, and registers the intended callback on B2. Another design may use an already established ancestor handler. The application should choose deliberately.
Avoid a broad add listeners everywhere patch without checking which targets are already initialised. Such a patch can create confusing ownership or multiple distinct callbacks. A component duplication feature is easier to maintain when structure creation and instance initialisation are named stages with checkable outputs.
CHAPTER 6 OF 18 · Find the responding listener
6. Register the same callback on a different target
A callback function can be deliberately registered on both B1 and B2. The duplicate-listener rules apply to the relevant target's listener list; they do not make one registration on B1 a global registration for all buttons that look alike.
For a simple callback that uses the event's currentTarget appropriately, the application can establish one registration on B1 and another on B2. Each target then has its own relationship with the callback. The existing listener-identity guide explains how type, callback and capture participate in duplicate matching.
The word same now needs care. The callback object may be the same, while the targets are different. The nodes' class attributes may be the same, while neither node identity nor registration ownership is shared.
For the paper ledger, list two rows: target B1, click, callback F; target B2, click, callback F. That is a different record from one row on B1 followed by an assumption that cloning created the second row.
A changed-context check removes the listener from B1 using the appropriate matching registration details. That does not by itself remove the separately established registration on B2. Cleanup needs the same target-level ownership clarity as setup. A shared function is a reusable piece of code, not a shared lifecycle policy for every instance using it.
For a concrete registration ledger, begin with B1 registered to F and no B2 yet. Record one deliberate activation of B1 as one invocation of F. Create C and B2, but do not initialise B2. Under the controlled conditions, activating B2 adds no invocation of F. The running count remains one; the existence of B2 has not added a registration.
Next register F on B2 explicitly and activate B2 once. The count becomes two, with the second invocation attributed to currentTarget B2. Now remove F from B1 using matching removal details. An activation of B1 adds nothing under this stripped-down setup, while another activation of B2 takes the count to three. The copy's response survives the original's cleanup because the two registrations belonged to different targets.
Keep that count beside the target sequence B1, B2, B2. The count alone cannot show which button acted. If a delegated ancestor handler is introduced, start a new ledger rather than adding its effects to this one without explanation. These are stipulated event traces for learning, not observed browser results. Their value is that every expected invocation is tied to a known registration and a named activation, so an unexpected response has a specific place to investigate.
Registering a callback on B2 is not sufficient if its code still acts on the original card. Suppose revealOriginal closes over P1 and always reveals P1, regardless of which button invokes it.
If the application deliberately registers that same function on B2, activating B2 can reveal the original hint. The listener is present on the copy, but the callback's captured reference still points to the original paragraph.
This is a different defect from missing registration. A debugging record should distinguish no custom callback ran from a callback ran and targeted the wrong instance. Both can produce a copied card that fails to reveal its own hint.
For the controlled repair, initialise C with a callback whose instance references belong to C, or use a well-defined relation from the event target to the owning card. Do not assume currentTarget is always the button: a delegated ancestor listener has a different currentTarget, as the next chapter explains.
Ask a learner to draw arrows from each registered function to the objects it reads or changes. A function can be registered on a new target while retaining arrows to old state. cloneNode does not inspect those closures and rewrite their captured references to corresponding copied nodes. That application mapping must be designed explicitly.
CHAPTER 8 OF 18 · Find the responding listener
8. Explain a working copy through event delegation
Now change the design. One stable list container L has an event listener. Its handler receives appropriate bubbling events from buttons inside the list and deliberately identifies the card whose hint should change. There is no separately registered listener on either B1 or B2.
Insert C under L. In the stipulated event path, activating B2 can reach L's listener. The copied card now works without a listener copied onto B2. The behaviour comes from the ancestor's existing registration and the handler's routing logic.
That is an important counterexample to the inference it works, therefore cloneNode copied the listener. A visible response does not identify where its handler was registered. Record the event target, the currentTarget while L's listener runs and the card selected by the routing code.
Delegation still has scope and boundary conditions. The event must follow an appropriate path for that design, the handler must recognise the intended control, and nested content must not be mistaken for a different card. Shadow boundaries and non-bubbling event choices need their own contract rather than a blanket assumption.
Move C outside L in the paper trace while keeping every attribute unchanged. L's registration no longer supplies the same ancestor route. This changed context explains why a copy can work inside one host and fail inside another without any listener having been transferred by the cloning operation itself.
CHAPTER 9 OF 18 · Check handler and state boundaries
9. Distinguish an HTML handler attribute from addEventListener
An HTML attribute containing event-handler source is part of a different mechanism from an addEventListener registration made by application code. Ordinary element attributes are copied by the cloning algorithm. That can include event-handler content attributes.
This does not mean every copied handler attribute is guaranteed to execute in every environment. HTML's event-handler processing, scripting state and applicable execution policies still govern what happens. The point is the category: copied attribute text and a separately registered callback are not the same storage or setup path.
For a comparison, give O an ordinary data-note attribute in one column and an HTML handler attribute in another. Both are attributes for the purpose of examining the element's copied attribute list. Keep the addEventListener registration in a separate column associated with B1's EventTarget state.
Do not recommend moving all behaviour into inline handler attributes merely to make a clone appear to work. Choose a maintainable component setup appropriate to the application. This chapter explains a diagnostic distinction, not a shortcut around its execution policies or architecture.
The useful question after copying is which mechanism produced the response. Was it a copied content attribute, a registration explicitly added to B2, an ancestor listener or native control behaviour? Testing those alternatives individually is more informative than declaring that cloning sometimes copies listeners and sometimes does not.
CHAPTER 10 OF 18 · Check handler and state boundaries
10. Keep event-handler properties separate too
Assigning a function through an event-handler property such as onclick is another setup operation that must be distinguished from the corresponding HTML content attribute. The fact that both names contain onclick does not make every runtime assignment part of the element's copied attribute list.
In the controlled example, assign B1.onclick a function in script without adding a corresponding handler attribute to the markup. Cloning the element does not amount to rerunning that assignment against B2. The application must establish the copy's behaviour through its chosen initialisation path.
The exact HTML handler model links content attributes and IDL attributes through defined processing. Avoid explaining it as two unrelated bags that can never interact. For diagnosis, record the actual operation used to establish the original handler and inspect the copied attributes rather than inferring its origin from a property name alone.
A useful paper comparison has three original setups: addEventListener on B1, a scripted handler-property assignment on B1, and a handler content attribute present in B1's markup. Explain which copied structure exists before any new setup runs.
This prevents a false repair in which code inspects one property, sees a function on the original and concludes that the function must be ordinary copied markup. The platform's cloning and event-handler rules determine the relationship; the convenience of reading a property does not change which setup operations were performed.
CHAPTER 11 OF 18 · Check handler and state boundaries
11. Give copied structure its own application state
Suppose the application keeps a map from card objects to a record containing hint status, attempts and cleanup resources. There is a record for O. Creating C does not automatically tell that application-owned map to create a corresponding record keyed by C.
The same principle applies to a callback's closure and other state held outside the node structure. A deep copy includes the requested descendants under the cloning rules. Deep does not mean recursively duplicate every object that application code happens to associate with those descendants.
For the paper ledger, O maps to attempts three and hint revealed. The design must decide whether C starts as a new exercise with attempts zero and hint hidden, or deliberately carries a documented copy of some learning state. Neither policy follows merely from the subtree flag.
Keep element-specific platform rules separate from that application decision. HTML defines additional cloning steps for certain elements, and modern DOM rules also include specialised cases such as clonable shadow roots. Do not turn this ordinary practice-card example into a universal claim that no state beyond text and attributes can ever be copied.
The safe conclusion is precise: the application's own state association needs its own defined setup. Check the relevant element specifications when copying specialised controls or components. A vocabulary card made from ordinary sections, paragraphs and type-button controls is a bounded starting case, not proof about every HTML element or custom-element lifecycle.
CHAPTER 12 OF 18 · Check the destination
12. Do not treat matching classes as matching presentation conditions
O and C can have identical class attributes but render differently after insertion under different ancestors. CSS rules can depend on context, inherited values, container constraints and other conditions outside the copied subtree.
For a paper case, O sits in a wide practice region and C is inserted into a narrow review region. Both carry class practice-card. The copied label can wrap differently because the available space differs. That is a layout-context change, not evidence that the label failed to copy.
The same distinction matters when testing a supposedly nonresponsive button. A copied element might be disabled through an applicable attribute, covered by another element or outside the intended interaction region. Check those possibilities separately from whether its custom listener exists.
Do not make a screenshot carry more evidence than it contains. Two controls that look the same may have different registrations. Two controls with the same registrations may appear different because their hosts differ. Node structure, event handling and presentation need separate observations.
This guide's central registration case keeps presentation and event delivery conditions controlled. A production diagnosis should inspect the actual DOM, computed presentation and interaction path. Adding another callback cannot repair every reason a visitor cannot operate a copied control, and a new visual style does not establish that its behaviour was initialised correctly.
CHAPTER 13 OF 18 · Check the destination
13. Repair duplicated identifiers and their relationships
The cloning of ordinary attributes can preserve identifiers that should be unique when both copies coexist in the same document. A copied id can therefore create a separate defect even after B2's listener has been registered.
For the practice card, suppose O's hint has id hint-original and B1's accessible relationship points to it. A deep copy can retain both that identifier and the reference attribute text. Inserting C beside O without deliberately repairing identifiers leaves ambiguous or invalid relationships for the intended independent instances.
Do not repair only the copied hint's id while leaving its references unchanged. The new identifier and every relevant relationship that should target it need a coherent mapping. The appropriate attributes depend on the component; inspect labels, controls, descriptions and fragment links actually present in its structure.
A useful paper mapping is hint-original to hint-copy and title-original to title-copy. Then list which copied references should target the copied nodes and which intentionally point to a shared external resource. Blindly replacing every matching string is not a substitute for understanding the relationship.
After the mapping, test the actual reading and interaction path. A unique id alone does not prove that the correct label, hint or description is associated. Keep identifier repair separate from event registration in the review so that a working click does not conceal an incorrect relationship for another way of using the interface.
CHAPTER 14 OF 18 · Check the destination
14. Trace insertion and movement as separate operations
Creating C and inserting C are distinct stages. Initialisation code may run before or after insertion under the application's design, but it must know which instance it is configuring and which context its behaviour expects.
For a controlled sequence, create C, identify B2 and P2 within C, set the instance's starting state, establish its registrations and then insert it under the practice list. The example does not require a geometry measurement before insertion. If the real setup needs current rendered dimensions, that requirement changes the appropriate stage.
Now move an already initialised C from list L to review list R. Its own separately registered listeners do not become copied again merely because it moved. But a delegated handler on L may no longer supply its previous behaviour, while a handler on R may introduce another route.
Movement can therefore change the interaction context without creating new nodes. Cloning creates new node identities, while insertion or movement places a particular identity in a tree. Keep those verbs distinct in a log.
The changed-context test uses the same C before and after the move. If its response changes, inspect ancestor handling and application ownership instead of assuming the copy suddenly gained or lost an intrinsic ability to handle events. The evidence should identify which registrations remain on C and which surrounding paths changed.
CHAPTER 15 OF 18 · Establish instance ownership
15. Audit initialisation flags copied as attributes
An application sometimes marks an initialised component with a data attribute. Suppose O has data-ready set to yes after setup registers revealOriginal. A deep clone can preserve that attribute even though it did not transfer O's addEventListener registration to B2.
If the initialiser looks only at data-ready and returns immediately when it sees yes, C can be skipped. The copied flag says setup already happened, while the copy's actual registration record says it has not happened for B2.
This is a particularly useful counterexample because every individual operation can appear reasonable. Setup marked O, cloning copied an attribute, and the initialiser avoided repeating work. The inconsistency comes from treating copied markup as authoritative evidence about runtime ownership of a new instance.
Choose an initialisation policy that distinguishes new instances correctly. A framework or application may use an appropriate instance registry, a deliberate reset of copied markers or a creation path that sets up behaviour from a template. The right mechanism depends on the application; the requirement is that its evidence matches the target being initialised.
For the paper test, compare two copies with identical data-ready attributes. Explicitly initialise one under the corrected policy and leave the other skipped. Then record the actual listener targets and hint outcomes. The attribute values alone cannot prove that both copies received the same runtime setup.
CHAPTER 16 OF 18 · Establish instance ownership
16. Keep cleanup ownership explicit for every instance
A component's lifecycle includes removing or releasing what its setup established. If B2 receives a new listener, record how that registration is removed when C is retired. Do not assume cleaning up O also cleans up C, or that removing a node from one parent is a complete description of every application resource associated with it.
For the controlled case, initialise O and C independently with distinct instance-owned cleanup records. Retiring O invokes O's cleanup. C remains available under its own policy. This makes the intended independence visible.
A shared abort signal can deliberately link listener lifetimes, because registrations made with that signal follow the relevant abort rules. But sharing that signal is an explicit design choice during registration. It is not a relationship created automatically by cloning the card's markup.
The changed-context check aborts a shared controller after both listeners were deliberately registered with its signal. Both registrations can be affected under that setup. Compare this with independent controllers. The difference follows from the registration record, not from whether the buttons have matching class names.
Keep broader cancellation claims bounded. Removing a listener does not undo earlier application changes or prove every operation started by the component has stopped. The combined-abort guide develops signal-state ownership separately. Here, the practical requirement is that setup and cleanup refer to the actual instance and resources rather than to a visual resemblance.
CHAPTER 17 OF 18 · Establish instance ownership
17. Build a reproduction that distinguishes the mechanisms
Create one ordinary practice card with a type-button control and a hidden fictional hint. Establish one known addEventListener registration on its original button. Make a deep copy, insert it beside the original and record which control invokes which callback.
Restore that starting condition before changing the setup. In one test explicitly initialise the copy. In another use one ancestor listener with defined routing. In a third examine a handler content attribute under the environment's actual execution rules. Do not combine all three mechanisms before trying to identify which caused the response.
Retain node identities, attributes, insertion host, registered target, callback identity and the hint node actually changed. Include the copied initialisation-marker case and the closure-that-still-points-to-P1 case. Those two cases can reveal defects even when a handler is visibly present.
Test copied identifiers and reading relationships independently. Keyboard operation and focus behaviour also need review in the implemented component. A callback log showing one invocation is evidence about that invocation, not a complete usability result.
These examples remain paper traces. They do not claim a browser compatibility matrix or execution under a particular content policy. A real reproduction should record its browser, application version and exact setup. If a result differs, inspect later setup, ancestor listeners and element-specific cloning steps before describing the discrepancy as cloning copying callbacks unpredictably.
CHAPTER 18 OF 18 · Establish instance ownership
18. Report the missing layer instead of blaming the whole copy
A clear report says the clone contains B2 and its copied label, but the original setup registered F only on B1. C was inserted without an instance initialisation step, and no ancestor handler supplied the reveal action. That account explains both what copied successfully and what still needed setup.
Another report might say B2 does invoke F, but F closes over P1, so the original hint changes. A third might say the copied data-ready attribute caused the initialiser to skip B2. These are different mechanisms and should lead to different repairs.
The strongest explanation follows one original-to-copy mapping from creation through insertion, activation and cleanup. It shows which identities changed and which external references or resources were deliberately shared. That record remains useful when a later feature adds more controls or moves the component into another host.
For a learner, the final transfer check changes only the handling design. Start with direct listeners, move to delegation, then move C outside the delegated host. Predict the response from the registration and event path before looking at the screen. The prediction should not depend on whether the copy resembles O.
Cloning is useful when its scope stays clear. Let it create the structure promised by its contract. Let the application establish instance state, relationships and behaviour deliberately. Then verify the visitor's whole task, so that a card that looks complete also has a clear and independently controlled way to respond.
Continue through the verified reading route
Listener identity and options
Listener identity and options. Continue here for duplicate matching and deliberate listener replacement on a target.
Live collection traversal
Live collection traversal. Check selection membership when setup or cleanup traverses a changing group of elements.
Combined cancellation reasons
Combined cancellation reasons. Separate signal ownership and abort state from component structure.
Native form submission lifecycle
Native form submission lifecycle. Use this when a copied control participates in form submission rather than only a local hint action.
Connected practical checks
The Gold Standard of Websites | Retaining an Event’s Current Target Before Deferred Work Runs
The Gold Standard of Websites | Retaining an Event’s Current Target Before Deferred Work Runs. Retain the intended listener owner or matched action before deferred work and later replacement.
The Gold Standard of Websites | Separating ArrayBuffer Transfer from Copying Its Bytes
The Gold Standard of Websites | Separating ArrayBuffer Transfer from Copying Its Bytes. Compare DOM node cloning with the separate structured-clone contract for backing-buffer transfer and detachment.
Frequently asked questions
Does cloneNode(true) copy addEventListener registrations?
No. Requesting descendants expands the copied node structure. It does not duplicate the original targets' separately registered callbacks onto corresponding new targets. Initialise the copy through the application's chosen behaviour setup.
Why does my copy work even though I did not initialise its button?
Possible explanations include a delegated ancestor listener, a copied handler content attribute, native control behaviour or other code that initialised it later. Inspect which handler runs and where it was registered before attributing the response to cloning.
Can I register the same function on original and copy?
Yes, deliberately, but check what that function uses. A callback that closes over the original hint can act on the wrong instance when invoked from the copy. Registration target and captured application references are separate parts of the design.
Does a deep clone duplicate every piece of component state?
No. Application-owned maps, closures and resources need their own policy. Also consult element-specific platform rules: the ordinary light-DOM card example is not a universal statement about every specialised element, shadow root or custom-component lifecycle.
Why can a copied initialisation marker be misleading?
Because the attribute can be copied while the original addEventListener registration is not. A marker copied from an initialised original does not prove that the new target received runtime setup. Verify the instance's actual ownership and setup path.
What should the final check cover?
Check structure, new node identities, identifier relationships, listener targets, callback references, insertion context, state and cleanup. Then test the real interaction and reading path. A successful callback trace alone does not establish the complete behaviour or accessibility of the copied component.
Authoritative sources and further reading
WHATWG DOM — cloneNode and cloning a node. Defines structure copying, descendant handling and applicable specialised cloning steps; consulted 29 October 2026.
WHATWG DOM — EventTarget. Defines target-owned listener lists and explicit registration and removal.
WHATWG HTML — event handlers. Defines HTML handler content attributes and IDL handler processing; consulted 29 October 2026.
Return to the Websites subject guide, The Gold Standard of Education, or the How X Works hub.