script: escape html elements in widget log to avoid cyclic json error
This commit is contained in:
parent
3d12e85e56
commit
e2c48bd6ac
2 changed files with 6 additions and 1 deletions
|
|
@ -56,7 +56,7 @@ class Vm {
|
|||
this.globals.console = {
|
||||
...console,
|
||||
log: (...msg)=>{
|
||||
msg = msg.map(m => typeof m == 'object' ? JSON.stringify(m) : m)
|
||||
msg = msg.map(m => typeof m == 'object' ? JSON.stringify(m, this.jsonReplacer) : m)
|
||||
this.getWidget().log(msg.join(' '))
|
||||
}
|
||||
}
|
||||
|
|
@ -143,6 +143,10 @@ class Vm {
|
|||
|
||||
}
|
||||
|
||||
jsonReplacer(key, value) {
|
||||
return value instanceof HTMLElement ? `<${value.tagName}#${value.id}>` : value
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default Vm
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue