perf: convert empty text nodes to comments

pull/5280/head
Van Nguyen 5 years ago
parent 82dc26a31c
commit 6df7989206

@ -54,7 +54,7 @@ export function space() {
}
export function empty() {
return text('');
return document.createComment('');
}
export function listen(node: EventTarget, event: string, handler: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | EventListenerOptions) {

@ -3,14 +3,14 @@ export default {
const btn = target.querySelector("button");
const clickEvent = new window.MouseEvent("click");
assert.equal(window.document.head.innerHTML.includes('<style>body { color: blue; }</style><style>body { color: green; }</style>'), true);
assert.equal(window.document.head.innerHTML.includes('<style>body { color: blue; }</style><!----><style>body { color: green; }</style>'), true);
await btn.dispatchEvent(clickEvent);
assert.equal(window.document.head.innerHTML.includes('<style>body { color: red; }</style><style>body { color: green; }</style>'), true);
assert.equal(window.document.head.innerHTML.includes('<style>body { color: red; }</style><!----><style>body { color: green; }</style>'), true);
await btn.dispatchEvent(clickEvent);
assert.equal(window.document.head.innerHTML.includes('<style>body { color: blue; }</style><style>body { color: green; }</style>'), true);
assert.equal(window.document.head.innerHTML.includes('<style>body { color: blue; }</style><!----><style>body { color: green; }</style>'), true);
}
};

Loading…
Cancel
Save