mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2026-04-28 14:42:35 +08:00
语法高亮,滚动条美化,设置页面调整
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
<div></div>
|
||||
<p><code><strong>add()</strong></code> 方法在 <code>WeakSet</code> 对象的最后一个元素后添加新的对象。</p>
|
||||
<h2 id="语法">语法</h2>
|
||||
<pre class="syntaxbox"><code><em>ws</em>.add(value);</code>
|
||||
</pre>
|
||||
<pre><code class="language-javascript"><code><em>ws</em>.add(value);</code>
|
||||
</code></pre>
|
||||
<h3 id="参数">参数</h3>
|
||||
<dl>
|
||||
<dt>value</dt>
|
||||
@@ -12,7 +12,7 @@
|
||||
<h3 id="返回值">返回值</h3>
|
||||
<p><code>WeakSet</code> 对象。</p>
|
||||
<h2 id="使用_add_方法">使用 <code>add</code> 方法</h2>
|
||||
<pre class="brush: js">var ws = new WeakSet();
|
||||
<pre><code class="language-javascript">var ws = new WeakSet();
|
||||
|
||||
ws.add(window); // 添加 window 对象进 WeakSet 中
|
||||
|
||||
@@ -21,7 +21,7 @@ ws.has(window); // true
|
||||
// Weakset 仅取得对象作为参数
|
||||
ws.add(1);
|
||||
// 结果为 "TypeError: Invalid value used in weak set" 在 Chrome 浏览器中
|
||||
// 并且 "TypeError: 1 is not a non-null object" 在 Firefox 浏览器中</pre>
|
||||
// 并且 "TypeError: 1 is not a non-null object" 在 Firefox 浏览器中</code></pre>
|
||||
<h2 id="规范">规范</h2>
|
||||
<table class="standard-table">
|
||||
<tbody>
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
<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><code><strong>clear()</strong></code> 方法用于删除 <code>WeakSet</code> 对象的所有元素,但是已经不是 ECMAScript 的一部分了。</p>
|
||||
<h2 id="语法">语法</h2>
|
||||
<pre class="syntaxbox"><em>ws</em>.clear();</pre>
|
||||
<pre><code class="language-javascript"><em>ws</em>.clear();</code></pre>
|
||||
<h2 id="示例">示例</h2>
|
||||
<h3 id="使用_clear方法">使用 <code>clear方法</code></h3>
|
||||
<pre class="brush: js example-bad">var ws = new WeakSet();
|
||||
<pre><code class="language-js example-bad">var ws = new WeakSet();
|
||||
|
||||
ws.add(window);
|
||||
ws.has(window); // true
|
||||
@@ -13,7 +13,7 @@ ws.has(window); // true
|
||||
ws.clear();
|
||||
|
||||
ws.has(window); // false
|
||||
</pre>
|
||||
</code></pre>
|
||||
<h2 id="规范">规范</h2>
|
||||
<p>没有规范或草案。该方法原本计划包括在 ECMAScript 6,但是在草案 revision 28 (October 14, 2014) 被抛弃了。浏览器原先的实现不久后也被移除了,它从来不是标准的一分子。</p>
|
||||
<h2 id="浏览器支持">浏览器支持</h2>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div></div>
|
||||
<p><code><strong>delete()</strong></code> 方法从 <code>WeakSet 对象中</code>移除指定的元素。</p>
|
||||
<h2 id="语法">语法</h2>
|
||||
<pre class="syntaxbox"><code><em>ws</em>.delete(value);</code></pre>
|
||||
<pre><code class="language-javascript"><code><em>ws</em>.delete(value);</code></code></pre>
|
||||
<h3 id="参数">参数</h3>
|
||||
<dl>
|
||||
<dt>value</dt>
|
||||
@@ -12,7 +12,7 @@
|
||||
<p>如果在 <code>WeakSet</code> 对象中成功移除元素则返回 true。如果 key 没有在 WeakSet 中<font face="Consolas, Liberation Mono, Courier, monospace">找到或者 key 不是一个对象,则返回 false。</font></p>
|
||||
<h2 id="示例">示例</h2>
|
||||
<h3 id="使用_delete_方法">使用 <code>delete</code> 方法</h3>
|
||||
<pre class="brush: js">var ws = new WeakSet();
|
||||
<pre><code class="language-javascript">var ws = new WeakSet();
|
||||
var obj = {};
|
||||
|
||||
ws.add(window);
|
||||
@@ -21,7 +21,7 @@ ws.delete(obj); // 返回 false。因为 obj 没有被删除
|
||||
ws.delete(window); // 返回 true。成功地移除了元素
|
||||
|
||||
ws.has(window); // 返回 false。因为 WeakSet 中已经不存在 window 对象
|
||||
</pre>
|
||||
</code></pre>
|
||||
<h2 id="规范">规范</h2>
|
||||
<table class="standard-table">
|
||||
<tbody>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div></div>
|
||||
<p><code><strong>has()</strong></code> 方法根据 <code>WeakSet</code> 是否存在相应对象返回布尔值。</p>
|
||||
<h2 id="语法">语法</h2>
|
||||
<pre class="syntaxbox"><code><em>ws</em>.has(value);</code></pre>
|
||||
<pre><code class="language-javascript"><code><em>ws</em>.has(value);</code></code></pre>
|
||||
<h3 id="参数">参数</h3>
|
||||
<dl>
|
||||
<dt>value</dt>
|
||||
@@ -15,13 +15,13 @@
|
||||
</dl>
|
||||
<h2 id="示例">示例</h2>
|
||||
<h3 id="使用_has_方法">使用 <code>has</code> 方法</h3>
|
||||
<pre class="brush: js">var ws = new WeakSet();
|
||||
<pre><code class="language-javascript">var ws = new WeakSet();
|
||||
var obj = {};
|
||||
ws.add(window);
|
||||
|
||||
mySet.has(window); // 返回 true
|
||||
mySet.has(obj); // 返回 false
|
||||
</pre>
|
||||
</code></pre>
|
||||
<h2 id="规范">规范</h2>
|
||||
<table class="standard-table">
|
||||
<tbody>
|
||||
|
||||
Reference in New Issue
Block a user