语法高亮,滚动条美化,设置页面调整

This commit is contained in:
fofolee
2019-04-19 02:41:09 +08:00
parent 1e8f76c000
commit 359d29ee0b
1590 changed files with 12328 additions and 11441 deletions

View File

@@ -6,7 +6,7 @@
<p><strong><code>function.displayName</code></strong> 属性获取函数的显示名称</p>
<h2 id="Description_描述">Description 描述</h2>
<p>当一个函数的 <code>displayName</code> 属性被定义,这个函数的 <code>displayName</code> 属性将返回显示名称。</p>
<pre class="brush: js">function doSomething() {}
<pre><code class="language-javascript">function doSomething() {}
console.log(doSomething.displayName); // "undefined"
@@ -15,9 +15,9 @@ var popup = function(content) { console.log(content); };
popup.displayName = 'Show Popup';
console.log(popup.displayName); // "Show Popup"
</pre>
</code></pre>
<p>可以在函数表达式重定义函数的显示名称<a href="Reference/Functions" title="有关更多示例和说明请参阅有关函数的JavaScript指南。">function expression</a>:</p>
<pre class="brush: js">var object = {
<pre><code class="language-javascript">var object = {
someMethod: function() {}
};
@@ -27,9 +27,9 @@ console.log(object.someMethod.displayName); // logs "someMethod"
try { someMethod } catch(e) { console.log(e); }
// ReferenceError: someMethod is not defined
</pre>
</code></pre>
<p>可以动态修改函数的显示名称:</p>
<pre class="brush: js">var object = {
<pre><code class="language-javascript">var object = {
// anonymous
someMethod: function(value) {
arguments.callee.displayName = 'someMethod (' + value + ')';
@@ -40,14 +40,14 @@ console.log(object.someMethod.displayName); // "undefined"
object.someMethod('123')
console.log(object.someMethod.displayName); // "someMethod (123)"
</pre>
</code></pre>
<h2 id="Examples_例子">Examples 例子</h2>
<p>这个显示名称通常在控制台和配置文件中,用它来提醒对它背后的真实函数名 <a href="Reference/Global_Objects/Function/name" title="name 属性返回一个函数声明的名称。"><code>func.name</code></a>的引用。例如:</p>
<p>通过如下的举例,显示的名称应该显示像"function My Function()"</p>
<pre class="brush: js">var a = function() {};
<pre><code class="language-javascript">var a = function() {};
a.displayName = 'My Function';
a; // "function My Function()"</pre>
a; // "function My Function()"</code></pre>
<h2 id="Specifications_规范">Specifications 规范</h2>
<p>不属于任何规范</p>
<h2 id="Browser_compatibility_浏览器兼容性">Browser compatibility 浏览器兼容性</h2>