mirror of
https://github.com/liriliri/eruda.git
synced 2026-04-01 10:18:35 +08:00
Dev: Add $0 reference
This commit is contained in:
@@ -305,7 +305,7 @@ function transMsg(msg)
|
||||
msg = 'Object ' + JSON.stringify(msg);
|
||||
}
|
||||
|
||||
return util.escape(msg);
|
||||
return util.escape(util.toStr(msg));
|
||||
}
|
||||
|
||||
function transMultipleMsg(args)
|
||||
@@ -328,6 +328,5 @@ function transCode(code)
|
||||
function txtToHtml(str)
|
||||
{
|
||||
return str.replace(/\n/g, '<br/>')
|
||||
.replace(/\t/g, ' ')
|
||||
.replace(/ /g, ' ');
|
||||
.replace(/\t/g, ' ');
|
||||
}
|
||||
|
||||
@@ -93,6 +93,7 @@ export default class Elements extends Tool
|
||||
this._curCssStore = new CssStore(el);
|
||||
this._highlight.setEl(el);
|
||||
this._rmDefComputedStyle = true;
|
||||
window.$0 = el;
|
||||
|
||||
this._render();
|
||||
}
|
||||
|
||||
@@ -2380,6 +2380,33 @@ module.exports = (function ()
|
||||
return exports;
|
||||
})({});
|
||||
|
||||
/* ------------------------------ toStr ------------------------------ */
|
||||
|
||||
var toStr = _.toStr = (function (exports)
|
||||
{
|
||||
/* Convert value to a string.
|
||||
*
|
||||
* |Name |Type |Desc |
|
||||
* |------------------------------|
|
||||
* |val |* |Value to convert|
|
||||
* |return|string|Resulted string |
|
||||
*
|
||||
* ```javascript
|
||||
* toStr(null); // -> ''
|
||||
* toStr(1); // -> '1'
|
||||
* toStr(false); // -> 'false'
|
||||
* toStr([1, 2, 3]); // -> '1,2,3'
|
||||
* ```
|
||||
*/
|
||||
|
||||
function exports(val)
|
||||
{
|
||||
return val == null ? '' : val.toString();
|
||||
}
|
||||
|
||||
return exports;
|
||||
})({});
|
||||
|
||||
/* ------------------------------ trim ------------------------------ */
|
||||
|
||||
var trim = _.trim = (function (exports)
|
||||
|
||||
Reference in New Issue
Block a user