SUBMIT
{"ScriptPreparationCode":"const card = { number: false, cvc: false, expire: false };\r\nlet msg = document.getElementById(\u0027msg\u0027);\r\nlet submit = document.getElementById(\u0027submit\u0027);\r\nlet number = document.getElementById(\u0027number\u0027);\r\nlet cvc = document.getElementById(\u0027cvc\u0027);\r\nlet expire = document.getElementById(\u0027expire\u0027);\r\nconst onChangeHandler = function(event) {\r\n const key = event.target.id;\r\n if(!event.empty) {\r\n card[key] = true;\r\n card.cvc ? event.target.addEventListener(\u0027change\u0027, onChangeHandler): undefined;\r\n card.expire ? event.target.addEventListener(\u0027change\u0027, onChangeHandler): undefined;\r\n }\r\n card[key] ? event.target.removeEventListener(\u0027change\u0027, onChangeHandler): undefined;\r\n if(card.number \u0026\u0026 card.cvc \u0026\u0026 card.expire) {\r\n submit.removeAttribute(\u0027disabled\u0027);\r\n submit.innerText = submit.disabled.toString();\r\n }\r\n};\r\nnumber.addEventListener(\u0027change\u0027, this.onChangeHandler);\r\nfunction _isEvent(prop) {\r\n if (0 !== prop.indexOf(\u0027on\u0027)) {\r\n return false;\r\n }\r\n\r\n return true;\r\n}\r\n\r\nfunction _getEvents(obj) {\r\n var result = [];\r\n\r\n for (var prop in obj) {\r\n if (_isEvent(prop)) {\r\n prop = prop.substr(2); // remove \u0022on\u0022 at the beginning\r\n result.push(prop);\r\n }\r\n }\r\n\r\n return result;\r\n}\r\n\r\nfunction getEvents() {\r\n const result = {};\r\n\r\n result[\u0027window\u0027] = _getEvents(window, hasOwnProperty);\r\n \r\n const arr = Object.getOwnPropertyNames(window);\r\n \r\n for (let i = 0; i \u003C arr.length; i\u002B\u002B) {\r\n const element = arr[i];\r\n \r\n let resultArray = [];\r\n\r\n try {\r\n const obj = window[element];\r\n\r\n if (!obj || !obj[\u0027prototype\u0027]) {\r\n continue;\r\n }\r\n\r\n proto = obj[\u0027prototype\u0027];\r\n\r\n resultArray = _getEvents(proto);\r\n\r\n } catch (err) {\r\n // console.error(\u0060failed to get events of %o\u0060, element);\r\n }\r\n\r\n result[element] = resultArray;\r\n }\r\n\r\n return result;\r\n}\r\nmsg.innerText = getEvents();","TestCases":[{"Name":"a","Code":"number.value = \u00224242 4242 4242 4242\u0022;\r\nnumber.dispatchEvent(new Event(\u0027change\u0027));\r\ncvc.value = \u0022333\u0022;\r\ncvc.dispatchEvent(new Event(\u0027change\u0027));\r\nexpire.value = \u002202/22\u0022;\r\nexpire.dispatchEvent(new Event(\u0027change\u0027));\r\n","IsDeferred":false},{"Name":"b","Code":"number.value = \u00224242 4242 4242 4242\u0022;\r\nnumber.dispatchEvent(new Event(\u0027change\u0027));\r\ncvc.value = \u0022333\u0022;\r\ncvc.dispatchEvent(new Event(\u0027change\u0027));\r\nexpire.value = \u002202/22\u0022;\r\nexpire.dispatchEvent(new Event(\u0027change\u0027));\r\n","IsDeferred":false}]}