<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/dom7@4.0.4/dom7.min.js"></script>
function range(size, startAt = 0) {
return [Array(size).keys()].map((i) => i + startAt);
}
range(500).map((link) => {
const a = document.createElement("a");
const text = `My Title Text ${link}`;
const linkText = document.createTextNode(text);
a.appendChild(linkText);
a.href = `http://example.com/${link}`;
a.classList.add('test-link')
document.body.appendChild(a);
});
jQuery('a.test-link').addClass('new-test-link');
Dom7('a.test-link').each(function(element, index) {
console.log( element, index );
});
jQuery('a.test-link').each(function(index, element) {
console.log( index, element );
});
Dom7('a.test-link').attr('data-test', 'test-value');
jQuery('a.test-link').attr('data-test', 'test-value');
Dom7('a.test-link').css('color', 'black');
jQuery('a.test-link').css('color', 'black');
Dom7('a.test-link').removeAttr('title');
jQuery('a.test-link').removeAttr( "title" );
Dom7('a.test-link').attr({
alt: "Beijing Brush Seller",
title: "photo by Kelly Clark"
});
jQuery('a.test-link').attr({
alt: "Beijing Brush Seller",
title: "photo by Kelly Clark"
});
Dom7('a.test-link').toggleClass('new-test-link');
jQuery('a.test-link').toggleClass('new-test-link');
Dom7('a.test-link').removeClass('new-test-link');
jQuery('a.test-link').removeClass('new-test-link');
Dom7('a.test-link').addClass('new-test-link');
jQuery('a.test-link').css({
left: '100px',
top: '200px',
color: 'red',
width: '300px',
marginLeft: '17px',
'padding-right': '20px'
});
Dom7('a.test-link').css({
left: '100px',
top: '200px',
color: 'red',
width: '300px',
marginLeft: '17px',
'padding-right': '20px'
});
--enable-precise-memory-info
flag.
Test case name | Result |
---|---|
jQuery addClass | |
Dom7 each | |
jQuery each | |
Dom7 set attr | |
jQuery set attr | |
Dom7 css | |
jQuery css | |
Dom7 removeAttr | |
jQuery removeAttr | |
Dom7 set attr (Object) | |
jQuery set attr (Object) | |
Dom7 toggleClass | |
jQuery toggleClass | |
Dom7 removeClass | |
jQuery removeClass | |
Dom7 addClass | |
jQuery css (Object) | |
Dom7 css (Object) |
Test name | Executions per second |
---|---|
jQuery addClass | 2723.3 Ops/sec |
Dom7 addClass | 3652.9 Ops/sec |
jQuery removeClass | 3613.7 Ops/sec |
Dom7 removeClass | 4348.9 Ops/sec |
jQuery toggleClass | 847.7 Ops/sec |
Dom7 toggleClass | 2918.5 Ops/sec |
jQuery set attr (Object) | 2567.3 Ops/sec |
Dom7 set attr (Object) | 2799.2 Ops/sec |
jQuery removeAttr | 2182.8 Ops/sec |
Dom7 removeAttr | 8725.1 Ops/sec |
jQuery css | 3426.2 Ops/sec |
Dom7 css | 4347.8 Ops/sec |
jQuery set attr | 5096.6 Ops/sec |
Dom7 set attr | 5374.0 Ops/sec |
jQuery each | 441.7 Ops/sec |
Dom7 each | 442.0 Ops/sec |
jQuery css (Object) | 520.1 Ops/sec |
Dom7 css (Object) | 1212.0 Ops/sec |
It looks like you're providing a JSON-formatted string, but without the actual data inside it.
Please provide the actual JSON data or copy-paste the contents of the square-bracketed block into this chat window, and I'll do my best to help with whatever questions or tasks you have!