MCPcopy Index your code
hub / github.com/layerJS/layerJS / manipulations

Function manipulations

test/e2e/mutationobserver/mutationobserver_spec.js:250–288  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

248 parentElement.innerHTML = '';
249
250 var manipulations = function() {
251 var startTime, endTime;
252 var result = {};
253 var numberOfChildElements = 100;
254 var numberOfSubChildElements = 100;
255
256 startTime = new Date();
257 for (var i = 0; i < numberOfChildElements; i++) {
258 var childElement = document.createElement('div');
259 childElement.id = childElement.innerHTML = 'child_' + i;
260 parentElement.appendChild(childElement);
261
262 for (var x = 0; x < numberOfSubChildElements; x++) {
263 var subChildElement = document.createElement('div');
264 subChildElement.id = subChildElement.innerHTML = 'child_' + i + '_' + x;
265 childElement.appendChild(subChildElement);
266 }
267 }
268
269 endTime = new Date();
270 result.adding = (endTime - startTime) + ' ms';
271
272 startTime = new Date();
273
274 for (var i = 0; i < numberOfChildElements; i++) {
275 var childElement = document.getElementById('child_' + i);
276 childElement.setAttribute('custom', i.toString());
277
278 for (var x = 0; x < numberOfSubChildElements; x++) {
279 var subChildElement = document.getElementById('child_' + i + '_' + x);
280 subChildElement.setAttribute('custom', x.toString());
281 subChildElement.className="aclass";
282 }
283 }
284
285 endTime = new Date();
286 result.modifying = (endTime - startTime) + ' ms';
287 return result;
288 };
289
290
291 var info = {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected