mirror of
https://github.com/ohwgiles/laminar.git
synced 2024-10-27 20:34:20 +00:00
fe perf: insertAdjacentHTML is faster than innerHTML+=
This commit is contained in:
parent
23cb30fc0c
commit
7303e4d592
@ -667,14 +667,14 @@ const Run = templateId => {
|
|||||||
// a callback interface for handling unknown sequences.
|
// a callback interface for handling unknown sequences.
|
||||||
// Also, update the DOM directly rather than using a binding through
|
// Also, update the DOM directly rather than using a binding through
|
||||||
// Vue, the performance is noticeably better with large logs.
|
// Vue, the performance is noticeably better with large logs.
|
||||||
target.innerHTML += ansi_up.ansi_to_html(
|
target.insertAdjacentHTML('beforeend', ansi_up.ansi_to_html(
|
||||||
logToRender.replace(/\033\[\{([^:]+):(\d+)\033\\/g, (m, $1, $2) =>
|
logToRender.replace(/\033\[\{([^:]+):(\d+)\033\\/g, (m, $1, $2) =>
|
||||||
'~~~~LAMINAR_RUN~'+$1+':'+$2+'~'
|
'~~~~LAMINAR_RUN~'+$1+':'+$2+'~'
|
||||||
)
|
)
|
||||||
).replace(/~~~~LAMINAR_RUN~([^:]+):(\d+)~/g, (m, $1, $2) =>
|
).replace(/~~~~LAMINAR_RUN~([^:]+):(\d+)~/g, (m, $1, $2) =>
|
||||||
'<a href="jobs/'+$1+'" onclick="return LaminarApp.navigate(this.href);">'+$1+'</a>:'+
|
'<a href="jobs/'+$1+'" onclick="return LaminarApp.navigate(this.href);">'+$1+'</a>:'+
|
||||||
'<a href="jobs/'+$1+'/'+$2+'" onclick="return LaminarApp.navigate(this.href);">#'+$2+'</a>'
|
'<a href="jobs/'+$1+'/'+$2+'" onclick="return LaminarApp.navigate(this.href);">#'+$2+'</a>'
|
||||||
);
|
));
|
||||||
logToRender = '';
|
logToRender = '';
|
||||||
if (logComplete) {
|
if (logComplete) {
|
||||||
// output finished
|
// output finished
|
||||||
|
Loading…
Reference in New Issue
Block a user