{"ScriptPreparationCode":"var el = document.createElement(\u0027div\u0027);\r\nel.className = \u0027foo bar baz hello world\u0027;\r\nvar xs = \u0027hello\u0027;\r\nvar xre = new RegExp(\u0027\\\\b\u0027 \u002B xs \u002B \u0027\\\\b\u0027);\r\nvar cache = new Map();","TestCases":[{"Name":"className const regex","Code":"return xre.test(el.className);\r\n","IsDeferred":false},{"Name":"className cached regex","Code":"let s = xs; // ensure local var instead of closure var\r\nlet re = cache.get(s);\r\nif (!re) {\r\n re = new RegExp(\u0027\\\\b\u0027 \u002B s \u002B \u0027\\\\b\u0027);\r\n cache.set(s, re);\r\n}\r\nreturn re.test(el.className);\r\n","IsDeferred":false},{"Name":"className new regex","Code":"return new RegExp(\u0027\\\\b\u0027 \u002B xs \u002B \u0027\\\\b\u0027).test(el.className);","IsDeferred":false},{"Name":"classList contains","Code":"return el.classList.contains(xs);","IsDeferred":false},{"Name":"className split includes","Code":"return el.className.split(\u0027 \u0027).includes(xs);","IsDeferred":false},{"Name":"className indexOf scan","Code":"let s = xs; // ensure local var instead of closure var\r\nlet c = el.className;\r\nlet sl = s.length;\r\nlet cl = c.length;\r\nlet i = c.indexOf(s);\r\n//console.debug(i);\r\nif (i === 0) {\r\n let j = i \u002B sl;\r\n if (j === cl || c[j] === \u0027 \u0027)\r\n return true;\r\n}\r\nwhile (i !== -1) {\r\n let j = i \u002B sl;\r\n if (c[i - 1] === \u0027 \u0027 \u0026\u0026 (j === cl || c[j] === \u0027 \u0027))\r\n return true;\r\n i = c.indexOf(s, j \u002B 1);\r\n //console.debug(i);\r\n}\r\nreturn false;\r\n","IsDeferred":false}]}