{"ScriptPreparationCode":"const elementCount = 100000;\r\nwindow.testBody = document.getElementById(\u0027testBody\u0027);\r\n\r\n// Create a Bunch of DOM elements.\r\n// Keep a refrence to all of them to test the other loops.\r\nwindow.entities = [];\r\nwindow.entitiesObject = {};\r\nfor (let i = 0; i \u003C elementCount; i\u002B\u002B) {\r\n let elm = document.createElement(\u0027div\u0027);\r\n const str = i % 4;\r\n elm.classList.add(\u0060test-${str}\u0060);\r\n elm.setAttribute(\u0060test\u0060, str);\r\n // Add to body for query selector tests.\r\n window.testBody.appendChild(elm);\r\n // Add to array for loop tests.\r\n window.entities.push(elm);\r\n if (!window.entitiesObject[str]) {\r\n window.entitiesObject[str] = [];\r\n }\r\n window.entitiesObject[str].push(elm);\r\n}\r\n","TestCases":[{"Name":"querySelectorAll with .class","Code":"const randomID = 0|Math.random()*4;\r\nconst clName = \u0060.test-${randomID}\u0060;\r\nconst result = window.testBody.querySelectorAll(clName);","IsDeferred":false},{"Name":"querySelectorAll with [attribute]","Code":"const randomID = 0|Math.random()*4;\r\nconst clName = \u0060[test=\u0022${randomID}\u0022]\u0060;\r\nconst result = Array.from(window.testBody.querySelectorAll(clName));","IsDeferred":false},{"Name":"filter with classList","Code":"const randomID = 0|Math.random()*4;\r\nconst clName = \u0060test-${randomID}\u0060;\r\nconst result = entities.filter(elm =\u003E elm.classList.contains(clName))","IsDeferred":false},{"Name":"filter with className","Code":"const randomID = 0|Math.random()*4;\r\nconst clName = \u0060test-${randomID}\u0060;\r\nconst result = entities.filter(elm =\u003E elm.className === clName)","IsDeferred":false},{"Name":"filter with getAttribute","Code":"const randomID = 0|Math.random()*4;\r\nconst result = entities.filter(elm =\u003E elm.getAttribute(\u0027test\u0027) === randomID)","IsDeferred":false},{"Name":"for with classList","Code":"const randomID = 0|Math.random()*4;\r\nconst result = [];\r\nconst clName = \u0060test-${randomID}\u0060;\r\nconst length = entities.length;\r\nfor (let i=0; i \u003C length; i\u002B\u002B) {\r\n const elm = entities[i];\r\n if (elm.classList.contains(clName)) {\r\n result.push(elm);\r\n }\r\n}","IsDeferred":false},{"Name":"for with className","Code":"const randomID = 0|Math.random()*4;\r\nconst result = [];\r\nconst clName = \u0060test-${randomID}\u0060;\r\nconst length = entities.length;\r\nfor (let i=0; i \u003C length; i\u002B\u002B) {\r\n const elm = entities[i];\r\n if (elm.className === clName) {\r\n result.push(elm);\r\n }\r\n}","IsDeferred":false},{"Name":"for with getAttribute","Code":"const randomID = 0|Math.random()*4;\r\nconst result = [];\r\nconst length = entities.length;\r\nfor (let i=0; i \u003C length; i\u002B\u002B) {\r\n const elm = entities[i];\r\n if (elm.getAttribute(\u0027test\u0027) === randomID) {\r\n result.push(elm);\r\n }\r\n}","IsDeferred":false},{"Name":"getElementsByClassName","Code":"const randomID = 0|Math.random()*4;\r\nconst clName = \u0060test-${randomID}\u0060;\r\nconst result = window.testBody.getElementsByClassName(clName);","IsDeferred":false},{"Name":"Object Property","Code":"const randomID = 0|Math.random()*4;\r\nconst result = [];\r\nconst clName = \u0060test-${randomID}\u0060;\r\nconst elm = entitiesObject[clName];\r\nif (elm) {\r\n result = elm;\r\n}","IsDeferred":false}]}