Fix: Eval expression

This commit is contained in:
surunzi
2016-06-06 17:02:02 +08:00
parent 2cde71e74d
commit 4a4c398486
3 changed files with 18 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "eruda",
"version": "0.6.3",
"version": "0.6.4",
"description": "Console for Mobile Browsers",
"main": "dist/eruda.js",
"scripts": {

View File

@@ -279,7 +279,18 @@ var cmdList = require('./cmdList.json'),
var regJsUrl = /https?:\/\/([0-9.\-A-Za-z]+)(?::(\d+))?\/[A-Z.a-z0-9/]*\.js/g;
var evalJs = jsInput => eval.call(window, jsInput);
var evalJs = jsInput =>
{
var ret;
try {
ret = eval.call(window, `(${jsInput})`);
} catch (e) {
ret = eval.call(window, jsInput);
}
return ret;
};
function errToStr(err)
{
@@ -292,7 +303,10 @@ function errToStr(err)
function transMsg(msg, noEscape)
{
if (util.isFn(msg))
if (util.isEl(msg))
{
msg = msg.outerHTML;
} else if (util.isFn(msg))
{
msg = msg.toString();
} else if (util.isObj(msg))

View File

@@ -34,12 +34,12 @@ export default class Elements extends Tool
this._select = new Select();
this._bindEvent();
this._initConfig();
this._setEl(this._htmlEl);
}
show()
{
super.show();
if (!this._curEl) this._setEl(this._htmlEl);
this._render();
}
overrideEventTarget()