{"ScriptPreparationCode":"const input1 = document.getElementById(\u0027input1\u0027);\r\nconst input2 = document.getElementById(\u0027input2\u0027);\r\nconst input3 = document.getElementById(\u0027input3\u0027);\r\nconst input4 = document.getElementById(\u0027input4\u0027);\r\nconst input5 = document.getElementById(\u0027input5\u0027);\r\nconst input6 = document.getElementById(\u0027input6\u0027);\r\nconst input7 = document.getElementById(\u0027input7\u0027);\r\nconst input8 = document.getElementById(\u0027input8\u0027);\r\nconst input9 = document.getElementById(\u0027input9\u0027);\r\nconst input10 = document.getElementById(\u0027input10\u0027);","TestCases":[{"Name":"1 event listener on every input(10)","Code":"const onKeyDown = (e) =\u003E console.log({e});\r\n\r\ninput1.addEventListener(\u0027keydown\u0027, onKeyDown, false);\r\ninput2.addEventListener(\u0027keydown\u0027, onKeyDown, false);\r\ninput3.addEventListener(\u0027keydown\u0027, onKeyDown, false);\r\ninput4.addEventListener(\u0027keydown\u0027, onKeyDown, false);\r\ninput5.addEventListener(\u0027keydown\u0027, onKeyDown, false);\r\ninput6.addEventListener(\u0027keydown\u0027, onKeyDown, false);\r\ninput7.addEventListener(\u0027keydown\u0027, onKeyDown, false);\r\ninput8.addEventListener(\u0027keydown\u0027, onKeyDown, false);\r\ninput9.addEventListener(\u0027keydown\u0027, onKeyDown, false);\r\ninput10.addEventListener(\u0027keydown\u0027, onKeyDown, false);\r\n\r\n\r\ninput1.dispatchEvent(new Event(\u0027focus\u0027));\r\ninput1.dispatchEvent(new KeyboardEvent(\u0027keydown\u0027,{\u0027key\u0027:\u0027a\u0027}));\r\ninput2.dispatchEvent(new Event(\u0027focus\u0027));\r\ninput2.dispatchEvent(new KeyboardEvent(\u0027keydown\u0027,{\u0027key\u0027:\u0027a\u0027}));\r\ninput3.dispatchEvent(new Event(\u0027focus\u0027));\r\ninput3.dispatchEvent(new KeyboardEvent(\u0027keydown\u0027,{\u0027key\u0027:\u0027a\u0027}));\r\ninput4.dispatchEvent(new Event(\u0027focus\u0027));\r\ninput4.dispatchEvent(new KeyboardEvent(\u0027keydown\u0027,{\u0027key\u0027:\u0027a\u0027}));\r\ninput5.dispatchEvent(new Event(\u0027focus\u0027));\r\ninput5.dispatchEvent(new KeyboardEvent(\u0027keydown\u0027,{\u0027key\u0027:\u0027a\u0027}));\r\ninput6.dispatchEvent(new Event(\u0027focus\u0027));\r\ninput6.dispatchEvent(new KeyboardEvent(\u0027keydown\u0027,{\u0027key\u0027:\u0027a\u0027}));\r\ninput7.dispatchEvent(new Event(\u0027focus\u0027));\r\ninput7.dispatchEvent(new KeyboardEvent(\u0027keydown\u0027,{\u0027key\u0027:\u0027a\u0027}));\r\ninput8.dispatchEvent(new Event(\u0027focus\u0027));\r\ninput8.dispatchEvent(new KeyboardEvent(\u0027keydown\u0027,{\u0027key\u0027:\u0027a\u0027}));\r\ninput9.dispatchEvent(new Event(\u0027focus\u0027));\r\ninput9.dispatchEvent(new KeyboardEvent(\u0027keydown\u0027,{\u0027key\u0027:\u0027a\u0027}));\r\ninput10.dispatchEvent(new Event(\u0027focus\u0027));\r\ninput10.dispatchEvent(new KeyboardEvent(\u0027keydown\u0027,{\u0027key\u0027:\u0027a\u0027}));","IsDeferred":false},{"Name":"1 window event listener for every input(10)","Code":"const listener = (id) =\u003E (e) =\u003E {\r\n if (e.target.id === id) {\r\n console.log(e.target)\r\n }\r\n}\r\n\r\nwindow.addEventListener(\u0027keydown\u0027, listener(\u0027input1\u0027), false);\r\nwindow.addEventListener(\u0027keydown\u0027, listener(\u0027input2\u0027), false);\r\nwindow.addEventListener(\u0027keydown\u0027, listener(\u0027input3\u0027), false);\r\nwindow.addEventListener(\u0027keydown\u0027, listener(\u0027input4\u0027), false);\r\nwindow.addEventListener(\u0027keydown\u0027, listener(\u0027input5\u0027), false);\r\nwindow.addEventListener(\u0027keydown\u0027, listener(\u0027input6\u0027), false);\r\nwindow.addEventListener(\u0027keydown\u0027, listener(\u0027input7\u0027), false);\r\nwindow.addEventListener(\u0027keydown\u0027, listener(\u0027input8\u0027), false);\r\nwindow.addEventListener(\u0027keydown\u0027, listener(\u0027input9\u0027), false);\r\nwindow.addEventListener(\u0027keydown\u0027, listener(\u0027input10\u0027), false);\r\n\r\ninput1.dispatchEvent(new Event(\u0027focus\u0027));\r\ninput1.dispatchEvent(new KeyboardEvent(\u0027keydown\u0027,{\u0027key\u0027:\u0027a\u0027}));\r\ninput2.dispatchEvent(new Event(\u0027focus\u0027));\r\ninput2.dispatchEvent(new KeyboardEvent(\u0027keydown\u0027,{\u0027key\u0027:\u0027a\u0027}));\r\ninput3.dispatchEvent(new Event(\u0027focus\u0027));\r\ninput3.dispatchEvent(new KeyboardEvent(\u0027keydown\u0027,{\u0027key\u0027:\u0027a\u0027}));\r\ninput4.dispatchEvent(new Event(\u0027focus\u0027));\r\ninput4.dispatchEvent(new KeyboardEvent(\u0027keydown\u0027,{\u0027key\u0027:\u0027a\u0027}));\r\ninput5.dispatchEvent(new Event(\u0027focus\u0027));\r\ninput5.dispatchEvent(new KeyboardEvent(\u0027keydown\u0027,{\u0027key\u0027:\u0027a\u0027}));\r\ninput6.dispatchEvent(new Event(\u0027focus\u0027));\r\ninput6.dispatchEvent(new KeyboardEvent(\u0027keydown\u0027,{\u0027key\u0027:\u0027a\u0027}));\r\ninput7.dispatchEvent(new Event(\u0027focus\u0027));\r\ninput7.dispatchEvent(new KeyboardEvent(\u0027keydown\u0027,{\u0027key\u0027:\u0027a\u0027}));\r\ninput8.dispatchEvent(new Event(\u0027focus\u0027));\r\ninput8.dispatchEvent(new KeyboardEvent(\u0027keydown\u0027,{\u0027key\u0027:\u0027a\u0027}));\r\ninput9.dispatchEvent(new Event(\u0027focus\u0027));\r\ninput9.dispatchEvent(new KeyboardEvent(\u0027keydown\u0027,{\u0027key\u0027:\u0027a\u0027}));\r\ninput10.dispatchEvent(new Event(\u0027focus\u0027));\r\ninput10.dispatchEvent(new KeyboardEvent(\u0027keydown\u0027,{\u0027key\u0027:\u0027a\u0027}));","IsDeferred":false}]}