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

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>
<p><strong><code>handler.ownKeys()</code></strong> 方法用于拦截 <a href="Reference/Global_Objects/Reflect/ownKeys" title="静态方法 Reflect.ownKeys() 返回一个由目标对象自身的属性键组成的数组。"><code>Reflect.ownKeys()</code></a>.</p>
<h2 id="语法">语法</h2>
<pre class="brush: js">var p = new Proxy(target, {
<pre><code class="language-javascript">var p = new Proxy(target, {
ownKeys: function(target) {
}
});
</pre>
</code></pre>
<h3 id="参数">参数</h3>
<p>下面的参数被传递给<code>ownKeys。this</code>被绑定在<code>handler上。</code></p>
<dl>
@@ -35,7 +35,7 @@
</ul>
<h2 id="示例">示例</h2>
<p>下面的代码拦截 <a href="Reference/Global_Objects/Object/getOwnPropertyNames" title="Object.getOwnPropertyNames()方法返回一个由指定对象的所有自身属性的属性名包括不可枚举属性但不包括Symbol值作为名称的属性组成的数组。"><code>Object.getOwnPropertyNames()</code></a>.</p>
<pre class="brush: js">var p = new Proxy({}, {
<pre><code class="language-javascript">var p = new Proxy({}, {
ownKeys: function(target) {
console.log('called');
return ['a', 'b', 'c'];
@@ -43,9 +43,9 @@
});
console.log(Object.getOwnPropertyNames(p)); // "called"
// [ 'a', 'b', 'c' ]</pre>
// [ 'a', 'b', 'c' ]</code></pre>
<p>下面的代码违反了约定</p>
<pre class="brush: js example-bad">var obj = {};
<pre><code class="language-js example-bad">var obj = {};
Object.defineProperty(obj, 'a', {
configurable: false,
enumerable: true,
@@ -62,7 +62,7 @@ console.log(Object.getOwnPropertyNames(p));
// TypeError: proxy [[OwnPropertyKeys]] 必须返回一个数组
// 数组元素类型只能是String或Symbol
</pre>
</code></pre>
<h2 id="标准">标准</h2>
<table class="standard-table">
<tbody>