{"ScriptPreparationCode":"function noop(){};\r\n\r\nconst attrs = {\r\n id: \u0027test\u0027,\r\n onclick: noop,\r\n class: \u0027test\u0027\r\n};\r\n\r\nfunction getAttrs() {\r\n return attrs;\r\n}\r\n\r\nfunction getElem() {\r\n return document.createElement(\u0027div\u0027);\r\n}","TestCases":[{"Name":"RegEx","Code":"const el = getElem();\r\nconst attrs = getAttrs();\r\nconst re = /^on/;\r\nObject.keys(attrs).forEach( attr =\u003E {\r\n if( re.test( attr ) ) {\r\n el[ attr ] = attrs[ attr ];\r\n } else {\r\n el.setAttribute( attr, attrs[ attr ] );\r\n }\r\n});","IsDeferred":false},{"Name":"Substr","Code":"const el = getElem();\r\nconst attrs = getAttrs();\r\nObject.keys(attrs).forEach( attr =\u003E {\r\n if( attr.substr( 0, 2 ) === \u0027on\u0027 ) {\r\n el[ attr ] = attrs[ attr ];\r\n } else {\r\n el.setAttribute( attr, attrs[ attr ] );\r\n }\r\n});","IsDeferred":false},{"Name":"charAt","Code":"const el = getElem();\r\nconst attrs = getAttrs();\r\nObject.keys(attrs).forEach( attr =\u003E {\r\n if( attr.charAt( 0 ) === \u0027o\u0027 \u0026\u0026 attr.charAt( 1 ) === \u0027n\u0027 ) {\r\n el[ attr ] = attrs[ attr ];\r\n } else {\r\n el.setAttribute( attr, attrs[ attr ] );\r\n }\r\n});","IsDeferred":false},{"Name":"Array access","Code":"const el = getElem();\r\nconst attrs = getAttrs();\r\nObject.keys(attrs).forEach( attr =\u003E {\r\n if( attr[ 0 ] === \u0027o\u0027 \u0026\u0026 attr[ 1 ] === \u0027n\u0027 ) {\r\n el[ attr ] = attrs[ attr ];\r\n } else {\r\n el.setAttribute( attr, attrs[ attr ] );\r\n }\r\n});","IsDeferred":false}]}