uTools-Manuals/docs/javascript/Reference/Deprecated_and_obsolete_features.html
2019-04-21 11:50:48 +08:00

160 lines
5.2 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<article id="wikiArticle">
<div></div>
<p>本附录列出了那些已经被废弃的(仍然可用,但未来会被删除)或者已经过时的(已经被删除,不能再用了)JavaScript特性.</p>
<h2 id="废弃特性">废弃特性</h2>
<p>这些废弃的特性仍然可以使用,但你要保持谨慎,因为它们很可能会在未来的某个时候被删除.</p>
<h3 id="RegExp_Properties" name="RegExp_Properties">RegExp全局对象的属性</h3>
<p>下面的这些属性已经被废弃.注意,这和<a href="/en-US/docs/JavaScript/Reference/Global_Objects/String/replace" title="/en-US/docs/JavaScript/Reference/Global_Objects/String/replace">替换字符串</a>中使用的同名标记没有直接关系.</p>
<table class="standard-table">
<tbody>
<tr>
<th>属性</th>
<th>描述</th>
</tr>
<tr>
<td><code>$1, ..., $9</code></td>
<td>
<p>上次任意正则表达式的匹配操作中对应捕获分组的匹配结果.</p>
</td>
</tr>
<tr>
<td><code>$_</code></td>
<td><code>input属性别名</code>.</td>
</tr>
<tr>
<td><code>$*</code></td>
<td><code>multiline</code><code>属性别名</code>.</td>
</tr>
<tr>
<td><code>$&amp;</code></td>
<td><code>lastMatch</code><code>属性别名</code>.</td>
</tr>
<tr>
<td><code>$+</code></td>
<td><code>lastParen</code><code>属性别名</code>.</td>
</tr>
<tr>
<td><code>$`</code></td>
<td><code>leftContext</code><code>属性别名</code>.</td>
</tr>
<tr>
<td><code>$'</code></td>
<td><code>rightContext</code><code>属性别名</code>.</td>
</tr>
<tr>
<td><code>input</code></td>
<td>上次任意正则表达式匹配的目标字符串.</td>
</tr>
<tr>
<td><code>lastMatch</code></td>
<td>上次任意正则表达式成功匹配的子字符串.</td>
</tr>
<tr>
<td><code>lastParen</code></td>
<td>上次任意正则表达式的匹配操作中最后一个捕获分组的匹配结果.</td>
</tr>
<tr>
<td><code>leftContext</code></td>
<td>上次任意正则表达式成功匹配的子字符串左边的字符串</td>
</tr>
<tr>
<td><code>rightContext</code></td>
<td>
<table class="standard-table">
<tbody>
<tr>
</tr>
<tr>
<td>上次任意正则表达式成功匹配的子字符串右边的字符串</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p>应该使用下面这些正则实例上的同名属性来代替:</p>
<table class="standard-table">
<tbody>
<tr>
<th>属性</th>
<th>描述</th>
</tr>
<tr>
<td><code>global</code></td>
<td>该正则是否开启了全局匹配模式.</td>
</tr>
<tr>
<td><code>ignoreCase</code></td>
<td>该正则是否开启了忽略大小写模式.</td>
</tr>
<tr>
<td><code>lastIndex</code></td>
<td>上次成功匹配后的索引位置,会成为下次匹配的开始索引位置,只在全局匹配或粘滞匹配模式下可用.</td>
</tr>
<tr>
<td><code>multiline</code></td>
<td>该正则是否开启了多行模式.</td>
</tr>
<tr>
<td><code>source</code></td>
<td>正则的源码</td>
</tr>
</tbody>
</table>
<h3 id="RegExp_Methods" name="RegExp_Methods">RegExp全局对象的方法</h3>
<p><code>compile</code>方法已经被废弃.</p>
<p><code>valueOf</code>方法已经被废弃.使用<code>Object.valueOf来替代</code>.</p>
<h3 id="函数对象的属性">函数对象的属性</h3>
<p><code>caller</code><code>arguments属性已经废弃</code>,因为它们会泄漏函数调用者.你应该在函数内部使用<code>arguments</code>对象来代替<code>函数的arguments</code>属性.</p>
<h3 id="Date方法">Date方法</h3>
<p><code>getYear</code><code>setYear方法</code>因为会受千年虫问题的影响,所以已经被<code>getFullYear和</code><code>setFullYear</code>方法替代.同时你还应该用<code>toISOString</code>方法来代替已经废弃的<code>toGMTString方法</code>.</p>
<h3 id="Escape_Sequences" name="Escape_Sequences">转义序列</h3>
<p>八进制转义序列(反斜杠\后跟一位,两位,或三位的八进制数字)出现在字符串字面量和正则字面量中的的用法已经废弃.</p>
<p><code>escape函数</code><code>unescape函数已经废弃</code>,请使用<code>encodeURI</code>,<code>encodeURIComponent</code>,<code>decodeURI</code>或者<code>decodeURIComponent</code>来进行给定字符串的编码和解码工作.</p>
<h2 id="过时特性">过时特性</h2>
<p>这些过时的特性已经完全被删除,不能在当前版本或者未来版本的JavaScript中使用了.</p>
<h3 id="对象">对象</h3>
<table class="standard-table">
<tbody>
<tr>
<th>属性</th>
<th>描述</th>
</tr>
<tr>
<td><code>__count__</code></td>
<td>返回用户自定义对象上的可枚举自身属性的个数.</td>
</tr>
<tr>
<td><code>__parent__</code></td>
<td>指向一个对象的上下文.</td>
</tr>
</tbody>
</table>
<table class="standard-table">
<tbody>
<tr>
<th>方法</th>
<th>描述</th>
</tr>
<tr>
<td><code>eval</code></td>
<td>在指定对象的上下文上,将一个包含JavaScript代码的字符串求值.</td>
</tr>
</tbody>
</table>
<h3 id="函数">函数</h3>
<table class="standard-table">
<tbody>
<tr>
<th>属性</th>
<th>描述</th>
</tr>
<tr>
<td><code>arity</code></td>
<td>形参的数量</td>
</tr>
</tbody>
</table>
<p> </p>
</article>