Introduce benchmark tests and improve snapshot attributes traversing (#897)
* housekeeping: refine test utils * setup benchmark tests * improve snapshot attributes loop perf
This commit is contained in:
@@ -445,8 +445,15 @@ function serializeNode(
|
||||
);
|
||||
const tagName = getValidTagName(n as HTMLElement);
|
||||
let attributes: attributes = {};
|
||||
for (const { name, value } of Array.from((n as HTMLElement).attributes)) {
|
||||
attributes[name] = transformAttribute(doc, tagName, name, value);
|
||||
const len = (n as HTMLElement).attributes.length;
|
||||
for (let i = 0; i < len; i++) {
|
||||
const attr = (n as HTMLElement).attributes[i];
|
||||
attributes[attr.name] = transformAttribute(
|
||||
doc,
|
||||
tagName,
|
||||
attr.name,
|
||||
attr.value,
|
||||
);
|
||||
}
|
||||
// remote css
|
||||
if (tagName === 'link' && inlineStylesheet) {
|
||||
|
||||
Reference in New Issue
Block a user