{"ScriptPreparationCode":"const CLOSE_KEYWORDS = [\u0027close\u0027, \u0027exit\u0027, \u0027quit\u0027, \u0027cancel\u0027, \u0027dismiss\u0027];\r\nconst attrCount = 1000; // adjust for testing\r\nconst matchIndex = 0; // index where matching attribute is placed (0 = early match)\r\n\r\nconst el = document.createElement(\u0027div\u0027);\r\n\r\n// Generate many attributes\r\nfor (let i = 0; i \u003C attrCount; i\u002B\u002B) {\r\n const value = (i === matchIndex) ? \u0027please close this\u0027 : \u0060attr${i}\u0060;\r\n el.setAttribute(\u0060data-${i}\u0060, value);\r\n}\r\n\r\n// Warmup\r\ncheckWithEarlyExit(el, CLOSE_KEYWORDS);\r\ncheckWithFullJoin(el, CLOSE_KEYWORDS);\r\n\r\n\r\n","TestCases":[{"Name":"for loop","Code":"function checkWithEarlyExit(el, keywords) {\r\n for (const attr of el.attributes) {\r\n const val = attr.value.toLowerCase();\r\n if (keywords.some(keyword =\u003E val.includes(keyword))) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n}","IsDeferred":false},{"Name":"string","Code":"function checkWithFullJoin(el, keywords) {\r\n const allAttrValues = Array.from(el.attributes, attr =\u003E attr.value.toLowerCase()).join(\u0027 \u0027);\r\n return keywords.some(keyword =\u003E allAttrValues.includes(keyword));\r\n}","IsDeferred":false}]}