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

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

@@ -2,11 +2,11 @@
<div> <div class="blockIndicator obsolete obsoleteHeader"><p><strong><span class="icon-only-inline" title="This is an obsolete API and is no longer guaranteed to work."><i class="icon-trash"> </i></span> 已废弃</strong><br/>This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.</p></div></div>
<p>代理方法<strong><code>handler.enumerate()</code></strong>决定了被代理对象在<a href="Reference/Statements/for...in" title="for...in语句以任意顺序遍历一个对象的可枚举属性。对于每个不同的属性语句都会被执行。"><code>for...in</code></a>中的行为。不过这个方法已经在ES2016标准中被移除了。</p>
<h2 id="语法">语法</h2>
<pre class="brush: js">var p = new Proxy(target, {
<pre><code class="language-javascript">var p = new Proxy(target, {
enumerate(target) {
}
});
</pre>
</code></pre>
<h3 id="参数">参数</h3>
<p>下列参数将会被用以调用 <code>enumerate</code> 方法。this将会指向处理器对象。</p>
<dl>
@@ -30,7 +30,7 @@
</ul>
<h2 id="Examples">Examples</h2>
<p>The following code traps <a href="Reference/Statements/for...in" title="for...in语句以任意顺序遍历一个对象的可枚举属性。对于每个不同的属性语句都会被执行。"><code>for...in</code></a> statements.</p>
<pre class="brush: js">var p = new Proxy({}, {
<pre><code class="language-javascript">var p = new Proxy({}, {
enumerate(target) {
console.log('called');
return ['a', 'b', 'c'][Symbol.iterator]();
@@ -41,16 +41,16 @@ for (var x in p) { // "called"
console.log(x); // "a"
} // "b"
// "c"
</pre>
</code></pre>
<p>The following code violates the invariant.</p>
<pre class="brush: js">var p = new Proxy({}, {
<pre><code class="language-javascript">var p = new Proxy({}, {
enumerate(target) {
return 1;
}
});
for (var x in p) {} // TypeError is thrown
</pre>
</code></pre>
<p>Note: Both examples make use of the shorthand syntax for <a href="/en-US/docs/Web/JavaScript/Reference/Functions/Method_definitions">method definitions</a>.</p>
<h2 id="Specifications">Specifications</h2>
<table class="standard-table">