mirror of
https://github.com/svgdotjs/svg.js.git
synced 2024-07-31 20:21:32 +02:00
858f19e9f8
- words() and element() added to Dom - svg() now returns the _parent_ of the imported element, when outerHTML is true (which means an element gets replaces)
22 lines
593 B
JavaScript
22 lines
593 B
JavaScript
SVG.bench.describe('Change textContent 10000 times', function(bench) {
|
|
var data = 'M 100 200 C 200 100 300 0 400 100 C 500 200 600 300 700 200 C 800 100 900 100 900 100'
|
|
|
|
var node = bench.draw.plain('').node
|
|
|
|
|
|
bench.test('using appendChild', function() {
|
|
for (var i = 0; i < 1000000; i++) {
|
|
while (node.hasChildNodes()) {
|
|
node.removeChild(node.lastChild)
|
|
}
|
|
|
|
node.appendChild(document.createTextNode('test'+i))
|
|
}
|
|
})
|
|
bench.test('using textContent', function() {
|
|
for (var i = 0; i < 1000000; i++) {
|
|
node.textContent = 'test'+i
|
|
}
|
|
})
|
|
})
|