{"ScriptPreparationCode":"HTMLElement.prototype.getBoolAttr = function getBoolAttr(attr) {\r\n const a = this.getAttribute(attr);\r\n if (a == null) {\r\n return this[attr];\r\n }\r\n return a !== \u0022false\u0022;\r\n};\r\n\r\nHTMLElement.prototype.getNumAttr = function getNumAttr(attr) {\r\n const a = this.getAttribute(attr);\r\n if (a == null || a === \u0022\u0022) {\r\n return this[attr];\r\n }\r\n const v = \u002Ba;\r\n if (Number.isNaN(v)) {\r\n console.error(\u0060${this.tagName}. Expected number for attribute [${attr}] but pointed \u0027${a}\u0027\u0060);\r\n return this[attr];\r\n }\r\n return v;\r\n};\r\n\r\nHTMLElement.prototype.getStrAttr = function getStrAttr(attr) {\r\n const a = this.getAttribute(attr);\r\n if (a == null) {\r\n return this[attr];\r\n }\r\n return a;\r\n};\r\n\r\nHTMLElement.prototype.getAttr = function getAttr(attr, type = \u0022string\u0022) {\r\n const a = this.getAttribute(attr);\r\n if (a == null) {\r\n return this[attr];\r\n }\r\n switch (type) {\r\n case \u0022bool\u0022:\r\n return a !== \u0022false\u0022;\r\n case \u0022number\u0022: {\r\n const v = \u002Ba;\r\n if (Number.isNaN(v)) {\r\n console.error(\u0060${this.tagName}. Expected number for attribute [${attr}] but pointed \u0027${a}\u0027\u0060);\r\n return this[attr];\r\n }\r\n return v;\r\n }\r\n default:\r\n return a; // string\r\n }\r\n};\r\n\r\nHTMLElement.prototype.getAttr2 = function getAttr(attr, type = 0) {\r\n const a = this.getAttribute(attr);\r\n if (a == null) {\r\n return this[attr];\r\n }\r\n switch (type) {\r\n case 1:\r\n return a !== \u0022false\u0022;\r\n case 2: {\r\n const v = \u002Ba;\r\n if (Number.isNaN(v)) {\r\n console.error(\u0060${this.tagName}. Expected number for attribute [${attr}] but pointed \u0027${a}\u0027\u0060);\r\n return this[attr];\r\n }\r\n return v;\r\n }\r\n default:\r\n return a; // string\r\n }\r\n};","TestCases":[{"Name":"getBoolAttr","Code":"const el = document.getElementById(\u0022t1\u0022)\r\nel.test = el.getBoolAttr(\u0022readonly\u0022)","IsDeferred":false},{"Name":"getAttr","Code":"const el = document.getElementById(\u0022t1\u0022)\r\nel.test2 = el.getAttr(\u0022readonly\u0022, \u0027bool\u0027)","IsDeferred":false},{"Name":"getAttr2","Code":"const el = document.getElementById(\u0022t1\u0022)\r\nel.test3 = el.getAttr(\u0022readonly\u0022, 1)","IsDeferred":false}]}