diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 21:46:22 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 21:46:22 -0500 |
commit | a065e04d529da1d847b5062a12c46d916408bf32 (patch) | |
tree | fe0f8bcec1ff39a3c499a2708222dcf15224ff70 /files/zh-cn/web | |
parent | 218934fa2ed1c702a6d3923d2aa2cc6b43c48684 (diff) | |
download | translated-content-a065e04d529da1d847b5062a12c46d916408bf32.tar.gz translated-content-a065e04d529da1d847b5062a12c46d916408bf32.tar.bz2 translated-content-a065e04d529da1d847b5062a12c46d916408bf32.zip |
update based on https://github.com/mdn/yari/issues/2028
Diffstat (limited to 'files/zh-cn/web')
65 files changed, 0 insertions, 6124 deletions
diff --git a/files/zh-cn/web/api/cameracontrol/getpreviewstream/index.html b/files/zh-cn/web/api/cameracontrol/getpreviewstream/index.html deleted file mode 100644 index be1756631d..0000000000 --- a/files/zh-cn/web/api/cameracontrol/getpreviewstream/index.html +++ /dev/null @@ -1,64 +0,0 @@ ---- -title: CameraControl.getPreviewStream -slug: Web/API/CameraControl/getPreviewStream -translation_of: Archive/B2G_OS/API/CameraControl/getPreviewStream ---- -<p>{{APIRef("Camera API")}}{{ non-standard_header() }}</p> - -<h2 id="概述">概述</h2> - -<p>该方法用来根据指定的配置,从摄像头获取到一个{{domxref("MediaStream")}}数据流,你可以从该数据流中捕获到静态的照片.</p> - -<div class="note"> -<p><strong>注:使用该方法获取到的数据流仅能用来捕获静态的照片</strong>.如果你想录制视频,那么必须使用{{domxref("CameraControl.getPreviewStreamVideoMode()")}}方法来代替.</p> -</div> - -<h2 id="语法">语法</h2> - -<pre>CameraControl.getPreviewStream(options, onsuccess[, onerror]);</pre> - -<h3 id="参数">参数</h3> - -<dl> - <dt><code>options</code></dt> - <dd>一个包含有两个属性<code>width</code>和<code>height的对象</code>.该对象可以通过{{domxref("CameraCapabilities")}}<code>.previewSizes属性获取到.</code></dd> - <dt><code>onsuccess</code></dt> - <dd>一个回调函数,会被传入一个参数,这个参数是一个{{domxref("MediaStream")}}数据流对象,可以使用该数据流对象捕获静态的图像.</dd> - <dt><code>onerror</code> {{optional_inline()}}</dt> - <dd>一个回调函数,会被传入一个参数,这个参数是一个表示错误原因的字符串.如果在尝试获取<code>MediaStream</code>数据流对象时发生了错误,则会调用该函数.</dd> -</dl> - -<h2 id="示例">示例</h2> - -<p>这个例子演示了如何通过使用{{domxref("MediaStream")}}数据流对象来从摄像头捕获并播放静态的图片.</p> - -<pre class="brush: js">var display = document.getElementsByTagName('video')[0]; -var options = { - camera: navigator.mozCameras.getListOfCameras()[0] -}; - -function onStreamReady( stream ) { - display.mozSrcObject = stream; - display.play(); -} - -function onAccessCamera( camera ) { - var size = camera.capabilities.previewSizes[0]; - - camera.getPreviewStream(size, onStreamReady); -}; - -navigator.mozCameras.getCamera(options, onAccessCamera) -</pre> - -<h2 id="Specification" name="Specification">规范</h2> - -<p>不属于任何规范.当<a class="external" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html" rel="external" title="http://dev.w3.org/2011/webrtc/editor/getusermedia.html">WebRTC Capture and Stream API</a>实现时,该方法应该会被删除.</p> - -<h2 id="相关链接">相关链接</h2> - -<ul> - <li>{{domxref("CameraControl")}}</li> - <li>{{domxref("MediaStream")}}</li> - <li>The <code>mozSrcObject</code> property on {{domxref("HTMLMediaElement")}}</li> -</ul> diff --git a/files/zh-cn/web/api/cameracontrol/index.html b/files/zh-cn/web/api/cameracontrol/index.html deleted file mode 100644 index 3be97dac90..0000000000 --- a/files/zh-cn/web/api/cameracontrol/index.html +++ /dev/null @@ -1,88 +0,0 @@ ---- -title: CameraControl -slug: Web/API/CameraControl -translation_of: Archive/B2G_OS/API/CameraControl ---- -<p>{{APIRef("Camera API")}}</p> - -<p>{{ non-standard_header() }}</p> - -<p><span class="seoSummary">When you use the {{domxref("CameraManager.getCamera()")}} method to get a reference to a camera, you specify a callback function to be invoked on success. That function receives as a parameter a <code>CameraControl</code> object. You can use its methods and properties to manage and make use of the camera.</span></p> - -<h2 id="Properties">Properties</h2> - -<dl> - <dt>{{domxref("CameraControl.capabilities")}} {{readonlyinline}}</dt> - <dd>A {{domxref("CameraCapabilities")}} object indicating all the capabilities for the given camera.</dd> - <dt>{{domxref("CameraControl.effect")}}</dt> - <dd>A string defining the effect to be used by the camera (<code>none</code> by default). Its value must be one of the values available in {{domxref("CameraCapabilities.effects")}}.</dd> - <dt>{{domxref("CameraControl.exposureCompensation")}} {{readonlyinline}}</dt> - <dd>A value used to compensate the camera exposure. This attribute is read-only; to change the exposure, you need to call the {{domxref("CameraControl.setExposureCompensation()")}} method.</dd> - <dt>{{domxref("CameraControl.flashMode")}}</dt> - <dd>A string that defines how the flash, if any, is to be used; this is <code>auto</code> by default if the device has a flash, <code>none</code> otherwise. When set, its value must be chosen from the list of options specified by {{domxref("CameraCapabilities.flashModes")}}<code>.</code></dd> - <dt>{{domxref("CameraControl.focalLength")}} {{readonlyinline}}</dt> - <dd>A number that express the camera's focal length in millimeters.</dd> - <dt>{{domxref("CameraControl.focusAreas")}}</dt> - <dd>An <a href="/en-US/docs/JavaScript/Reference/Global_Objects/Array" title="/en-US/docs/JavaScript/Reference/Global_Objects/Array"><code>Array</code></a> of one or more objects that define where the camera will perform auto-focusing.</dd> - <dt>{{domxref("CameraControl.focusDistanceFar")}} {{readonlyinline}}</dt> - <dd>This value is a distance in meter used with {{domxref("CameraControl.focusDistanceNear")}} to defined the image's depth of field. The value for this property may be <code><a href="/en-US/docs/JavaScript/Reference/Global_Objects/Infinity" title="/en-US/docs/JavaScript/Reference/Global_Objects/Infinity">Infinity</a></code>.</dd> - <dt>{{domxref("CameraControl.focusDistanceNear")}} {{readonlyinline}}</dt> - <dd>This value is a distance in meter used with {{domxref("CameraControl.focusDistanceFar")}} to defined the image's depth of field.</dd> - <dt>{{domxref("CameraControl.focusDistanceOptimum")}} {{readonlyinline}}</dt> - <dd>This value is a distance in meter where the subject will appear sharpest.</dd> - <dt>{{domxref("CameraControl.focusMode")}}</dt> - <dd>A string that defines which kind of focus mode the camera should use (<code>auto</code> or <code>fixed</code> by default). Its value must be chosen from {{domxref("CameraCapabilities.focusModes")}}.</dd> - <dt>{{domxref("CameraControl.meteringAreas")}}</dt> - <dd>An <a href="/en-US/docs/JavaScript/Reference/Global_Objects/Array" title="/en-US/docs/JavaScript/Reference/Global_Objects/Array"><code>Array</code></a> of one or more objects that define where the camera will perform auto-focusing.</dd> - <dt>{{domxref("CameraControl.onShutter")}}</dt> - <dd>A handler for the camera's "shutter" event, to trigger a shutter sound and/or a visual shutter indicator.</dd> - <dt>{{domxref("CameraControl.onClosed")}}</dt> - <dd>A handler called when a new <code>CameraControl</code> object in the same app takes over the camera.</dd> - <dt>{{domxref("CameraControl.onRecorderStateChange")}}</dt> - <dd>A function to call when the recorder changes state, either because the recording process encountered an error, or because one of the recording limits (see {{domxref("CameraControl.startRecording()")}}) was reached.</dd> - <dt>{{domxref("CameraControl.sceneMode")}}</dt> - <dd>A string that defines which scene mode the camera is to use (<code>auto</code> by default). Its value must be chosen from {{domxref("CameraCapabilities.sceneModes")}}.</dd> - <dt>{{domxref("CameraControl.whiteBalanceMode")}}</dt> - <dd>A string that defines which white balance mode the camera is to use (<code>auto</code> by default). Its value must be chosen from {{domxref("CameraCapabilities.whiteBalanceModes")}}.</dd> - <dt>{{domxref("CameraControl.zoom")}}</dt> - <dd>A number that defines which kind of zoom factor mode the camera is to use (1 by default). Its value must be chosen from {{domxref("CameraCapabilities.zoomRatios")}}.</dd> -</dl> - -<h2 id="Methods">Methods</h2> - -<dl> - <dt>{{ domxref("CameraControl.autoFocus()") }}</dt> - <dd>Tells the camera to attempt to focus the image.</dd> - <dt>{{ domxref("CameraControl.getPreviewStream()") }}</dt> - <dd>Gets a video stream from the camera; you can use this in an arbitrary context.</dd> - <dt>{{ domxref("CameraControl.getPreviewStreamVideoMode()") }}</dt> - <dd>Gets a video stream from the camera based on a specific video mode.</dd> - <dt>{{ domxref("CameraControl.release()") }}</dt> - <dd>Releases the camera so that other applications can use it.</dd> - <dt>{{ domxref("CameraControl.resumePreview()") }}</dt> - <dd>Resumes the preview video stream after it's been paused by a call to {{domxref("CameraControl.takePicture()")}}.</dd> - <dt>{{ domxref("CameraControl.setExposureCompensation()") }}</dt> - <dd>Lets you specify the exposure compensation factor.</dd> - <dt>{{ domxref("CameraControl.startRecording()") }}</dt> - <dd>Lets you start recording a video stream.</dd> - <dt>{{ domxref("CameraControl.stopRecording()") }}</dt> - <dd>Lets you stop recording a video stream.</dd> - <dt>{{ domxref("CameraControl.takePicture()") }}</dt> - <dd>Lets you capture a single image, receiving it as a {{domxref("Blob")}}.</dd> -</dl> - -<h2 id="Specification" name="Specification">Specification</h2> - -<p>{{page("/en-US/docs/Web/API/Navigator.MozCameras","Specification")}}</p> - -<h2 id="Permissions">Permissions</h2> - -<p>{{page("/en-US/docs/Web/API/Navigator.MozCameras","Permissions")}}</p> - -<h2 id="See_also">See also</h2> - -<ul> - <li>{{ domxref("CameraManager") }}</li> - <li>{{ domxref("CameraCapabilities") }}</li> - <li>{{ domxref("navigator.mozCamera") }}</li> -</ul> diff --git a/files/zh-cn/web/api/identitymanager/index.html b/files/zh-cn/web/api/identitymanager/index.html deleted file mode 100644 index 35dab1a6c2..0000000000 --- a/files/zh-cn/web/api/identitymanager/index.html +++ /dev/null @@ -1,43 +0,0 @@ ---- -title: IdentityManager -slug: Web/API/IdentityManager -translation_of: Archive/IdentityManager ---- -<p>{{APIRef("Persona")}}{{non-standard_header}}</p> - -<p>The <strong><code>IdentityManager</code></strong> of the <a href="/en-US/docs/Persona" title="BrowserID">BrowserID protocol</a> exposes the BrowserID API, via {{domxref("navigator.id")}}. This API has gone through several significant revisions. Each generation is listed separately below.</p> - -<h2 id="ObserverMethods" name="ObserverMethods">The "Observer" API (Current)</h2> - -<p>The Observer API introduces much-requested features, such as an improved post-verification experience for first-time users, automatic persistent logins, and easier integration with native applications.</p> - -<dl> - <dt>{{ domxref("IdentityManager.watch()")}}</dt> - <dd>Registers callbacks to be invoked when a user logs into or out of a website.</dd> - <dt>{{ domxref("IdentityManager.request()")}}</dt> - <dd>Requests a signed identity assertion from the user.</dd> - <dt>{{ domxref("IdentityManager.logout()")}}</dt> - <dd>Logs the user out of a website and prevents the <code>onlogin</code> action from automatically firing on their next visit.</dd> -</dl> - -<div class="note"> -<p>Users with third-party cookies disabled may experience problems logging in using the Observer API as detailed in <a href="https://github.com/mozilla/browserid/issues/2999" title="https://github.com/mozilla/browserid/issues/2999">issue 2999</a>.</p> -</div> - -<h2 id="CallbackMethods" name="CallbackMethods">The "Callback" API (Current)</h2> - -<p>The Callback API was introduced in November 2011. It improved upon the initial API by allowing options to be passed to <code>navigator.id.get()</code> and offering experimental support for BrowserID-managed persistent sessions.</p> - -<dl> - <dt>{{ domxref("IdentityManager.get()")}}</dt> - <dd>Gets the user's BrowserID in a signed assertion.</dd> -</dl> - -<h2 id="VerifiedEmailMethods" name="VerifiedEmailMethods">The "VerifiedEmail" API (Deprecated)</h2> - -<p>The VerifiedEmail API was BrowserID's first API. It was deprecated at the end of 2011.</p> - -<dl> - <dt>{{ domxref("IdentityManager.getVerifiedEmail()")}} {{ deprecated_inline() }}</dt> - <dd>Gets the user's BrowserID in a signed assertion. This method is deprecated; {{ domxref("navigator.id.get()")}} is backwards compatible and can be used instead.</dd> -</dl> diff --git a/files/zh-cn/web/api/identitymanager/watch/index.html b/files/zh-cn/web/api/identitymanager/watch/index.html deleted file mode 100644 index 1660ccdacf..0000000000 --- a/files/zh-cn/web/api/identitymanager/watch/index.html +++ /dev/null @@ -1,59 +0,0 @@ ---- -title: IdentityManager.watch() -slug: Web/API/IdentityManager/watch -translation_of: Archive/IdentityManager/watch ---- -<p>{{ ApiRef("Persona") }}</p> - -<div class="note"><strong>注意:</strong> 不是所有的浏览器都支持这项功能. 使用 Persona 的网站必须在他们的页面中包含 <a href="https://login.persona.org/include.js" title="https://login.persona.org/include.js">polyfill library</a> .</div> - -<h3 id="Summary" name="Summary">概要</h3> - -<p>This function registers callbacks that respond to a <a href="/en-US/docs/BrowserID" title="BrowserID">Persona</a> user logging in or out.</p> - -<h3 id="Syntax" name="Syntax">语法</h3> - -<pre class="brush:js;">navigator.id.watch({ - loggedInUser: 'bob@example.org', - onlogin: function(assertion) { - // A user has logged in! Here you need to: - // 1. Send the assertion to your backend for verification and to create a session. - // 2. Update your UI. - }, - onlogout: function() { - // A user has logged out! Here you need to: - // Tear down the user's session by redirecting the user or making a call to your backend. - } -}); -</pre> - -<h4 id="参数">参数</h4> - -<dl> - <dt><code>loggedInUser </code>{{ optional_inline() }}</dt> - <dd><strong>NOTE: </strong>This parameter was renamed from <code>loggedInEmail</code> in early September. Both names will continue to work for the time being, but code <strong>should</strong> be changed to use <code>loggedInUser</code> instead.</dd> - <dd>The email address of the currently logged in user. This should be a string containing the user's email address if the website believes that a user is currently logged in, or <code>null</code> otherwise. If the website is unsure, this should be set to <code>undefined</code> or omitted.</dd> - <dd>Persona compares its knowledge of the local user to the value of <code>loggedInUser</code> to determine which callback—<code>onlogin</code>, <code>onlogout</code>, or none at all—to automatically invoke when your page loads. If <code>loggedInUser</code> is <code>undefined</code> or omitted, Persona <em>will</em> invoke either <code>onlogin</code> or <code>onlogout</code>, depending on whether or not a local user should be logged in to your site. These callbacks are not invoked automatically if both BrowserID and <code>loggedInUser</code> agree on the local user's state.</dd> - <dd>Note that Persona may automatically call <em>either</em> <code>onlogin</code> or <code>onlogout</code> when your page loads, but not <em>both</em>. If <code>loggedInUser</code> is set to <code><span class="link-mailto">foo@example.com</span></code>, but Persona believes <code><span class="link-mailto">bar@example.com</span></code> should be logged in, only <code>onlogin</code> will be called. It will have an assertion for <code><span class="link-mailto">bar@example.com</span></code> as its first parameter.</dd> - <dt><code>onlogin</code></dt> - <dd>A function which will be invoked and passed a single argument, an assertion, when the user logs in. This function should send the assertion to the site's backend for verification. If verification succeeds, the backend should establish a session for the user and the function should update the UI as appropriate.</dd> - <dt><code>onlogout</code></dt> - <dd>A function that will be invoked, without any arguments, when the user logs out. This should tear down the user's session by making a call to the site's backend, or by redirecting the user.</dd> -</dl> - -<h3 id="Example" name="Example">示例</h3> - -<p>需要示例.</p> - -<h3 id="Specification" name="Specification">技术规范</h3> - -<p>没有包含在任何技术规范中.</p> - -<h3 id="查看其它内容">查看其它内容</h3> - -<ul> - <li><a href="/en/BrowserID" title="BrowserID">BrowserID</a></li> - <li>{{domxref("navigator.id")}}</li> - <li>{{domxref("navigator.id.logout()")}}</li> - <li>{{domxref("navigator.id.request()")}}</li> -</ul> diff --git a/files/zh-cn/web/api/indexeddb_api/using_indexeddb_in_chrome/index.html b/files/zh-cn/web/api/indexeddb_api/using_indexeddb_in_chrome/index.html deleted file mode 100644 index d9d9aa2cbf..0000000000 --- a/files/zh-cn/web/api/indexeddb_api/using_indexeddb_in_chrome/index.html +++ /dev/null @@ -1,27 +0,0 @@ ---- -title: Using IndexedDB in chrome -slug: Web/API/IndexedDB_API/Using_IndexedDB_in_chrome -translation_of: Mozilla/Tech/XPCOM/Using_IndexedDB_in_chrome ---- -<p>indexedDB API 通常被用来在用户的浏览器端存储来自JavaScript的数据。(点击 <a href="/en-US/docs/IndexedDB/Using_IndexedDB" title="/en-US/docs/IndexedDB/Using_IndexedDB">Using IndexedDB</a> 复习)。然而,使用system-privileged JavaScript的 <code><a href="/en-US/docs/Mozilla/Tech/XPCOM/Language_Bindings/Components.utils.importGlobalProperties">Components.utils.importGlobalProperties()</a> </code>函数也能获取这些API:</p> - -<pre class="brush: js">Components.utils.importGlobalProperties(["indexedDB"]); - -// From here on, it's like using IndexedDB from content -var req = indexedDB.open("my-database"); -// ...</pre> - -<p>如果你要创建一个 sandbox ,并且打算<code>在sandbox中使用indexedDB,那么在</code> <code><a href="/en-US/docs/Mozilla/Tech/XPCOM/Language_Bindings/Components.utils.Sandbox">Sandbox</a></code> 的构造函数中使用 <code>wantGlobalProperties配置项:</code></p> - -<pre class="brush: js">var options = { - "wantGlobalProperties": ["indexedDB"] -} -var principal = Cc["@mozilla.org/systemprincipal;1"].createInstance(Ci.nsIPrincipal); -var sandbox = Components.utils.Sandbox(principal, options); - -// The sandbox will have access to indexedDB -var sandboxScript = 'var req = indexedDB.open("my-database");'; -Components.utils.evalInSandbox(sandboxScript, sandbox); -</pre> - -<p>在Firefox 33之前,你可能要使用<code>nsIIndexedDatabaseManager的initWindowless</code>方法,从chrome的代码中方法获取indexedDB。这种方法在Firefox 33时,已经被移除。</p> diff --git a/files/zh-cn/web/api/navigator/id/index.html b/files/zh-cn/web/api/navigator/id/index.html deleted file mode 100644 index c2d8597274..0000000000 --- a/files/zh-cn/web/api/navigator/id/index.html +++ /dev/null @@ -1,45 +0,0 @@ ---- -title: Navigator.id -slug: Web/API/Navigator/id -translation_of: Archive/Navigator-id ---- -<div>{{ ApiRef("Persona") }}</div> - -<p>{{ non-standard_header() }}</p> - -<div class="note"><strong>注意:</strong> 这个功能的支持还没有构建到任何浏览器中,使用 Persona 的网站必须包含托管在 <a class="link-https" href="https://login.persona.org/include.js" title="https://login.persona.org/include.js">https://login.persona.org/include.js</a> 上的填充库。</div> - -<h2 id="Summary" name="Summary">概述</h2> - -<p><a href="https://developer.mozilla.org/en-US/docs/Persona" title="BrowserID">BrowserID 协议</a>定义了 {{ domxref ("window.navigator")}} 对象上的一个新的 <code>id</code> 属性,通过这个属性暴露 BrowserID API。这个 API 已经经历了几个重要修订。下面独立列出了每代 API。</p> - -<h2 id="ObserverMethods" name="ObserverMethods">观察者 API(当前)</h2> - -<p>观察者 API 引入了非常请求化的特性,诸如一个为新手用户改进的提交-验证体验、自动持久化登入和更简单的本地应用集成。</p> - -<dl> - <dt>{{ domxref("navigator.id.watch()")}}</dt> - <dd>登记在用户登入或登出网站时调用的回调。</dd> - <dt>{{ domxref("navigator.id.request()")}}</dt> - <dd>从用户请求一个签名的身份断言。</dd> - <dt>{{ domxref("navigator.id.logout()")}}</dt> - <dd>把用户登出网站并阻止 <code>onlogin</code> 行为在他们下次访问时触发。</dd> -</dl> - -<h2 id="CallbackMethods" name="CallbackMethods">回调 API(当前)</h2> - -<p>回调 API 在 2011 年 11 月被引入。它通过允许传递给 <code>navigator.id.get()</code>和提供 BrowserID 管理的持久会话的实验性支持改进了初始的 API。</p> - -<dl> - <dt>{{ domxref("navigator.id.get()")}}</dt> - <dd>Gets the user's BrowserID in a signed assertion.</dd> -</dl> - -<h2 id="VerifiedEmailMethods" name="VerifiedEmailMethods">VerifiedEmail API(弃用)</h2> - -<p>VerifiedEmail API 是 BrowserID 的第一个 API。它在 2011 年末被弃用。</p> - -<dl> - <dt>{{ domxref("navigator.id.getVerifiedEmail()")}} {{ deprecated_inline() }}</dt> - <dd>在一个签名的断言里获取用户的 BrowserID。这个方法已经弃用了;{{ domxref("navigator.id.get()")}} 是向后兼容的替代方法。</dd> -</dl> diff --git a/files/zh-cn/web/api/navigator/mozsettings/index.html b/files/zh-cn/web/api/navigator/mozsettings/index.html deleted file mode 100644 index bd96466118..0000000000 --- a/files/zh-cn/web/api/navigator/mozsettings/index.html +++ /dev/null @@ -1,32 +0,0 @@ ---- -title: Navigator.mozSettings -slug: Web/API/Navigator/mozSettings -translation_of: Archive/B2G_OS/API/Navigator/mozSettings ---- -<p>{{APIRef("Firefox OS")}}{{ non-standard_header() }}</p> - -<p>{{ B2GOnlyHeader2('certified') }}</p> - -<h2 id="Summary" name="Summary">概述</h2> - -<p>返回一个{{ domxref("SettingsManager") }}对象,你可以使用返回的对象来修改设备的各项设置.</p> - -<h2 id="Syntax" name="Syntax">语法</h2> - -<pre class="eval">var settings = window.navigator.mozSettings; -</pre> - -<h2 id="Value" name="Value">值</h2> - -<p><code>navigator.mozSettings</code>是一个{{domxref("SettingsManager")}}对象,你可以使用该对象来修改设备的各项设置.</p> - -<h2 id="Specification" name="Specification">规范</h2> - -<p>目前还不属于任何的规范,不过这个API将作为<a class="external" href="http://www.w3.org/2012/sysapps/" rel="external" title="http://www.w3.org/2012/sysapps/">System Applications Working Group</a>规范的一部分在W3C上讨论.</p> - -<h2 id="相关链接">相关链接</h2> - -<ul> - <li>{{domxref("SettingsManager")}}</li> - <li>{{domxref("SettingsLock")}}</li> -</ul> diff --git a/files/zh-cn/web/api/navigator/mozsms/index.html b/files/zh-cn/web/api/navigator/mozsms/index.html deleted file mode 100644 index c6c9aff864..0000000000 --- a/files/zh-cn/web/api/navigator/mozsms/index.html +++ /dev/null @@ -1,112 +0,0 @@ ---- -title: Navigator.mozSms -slug: Web/API/Navigator/mozSms -translation_of: Archive/B2G_OS/API/Navigator/mozSms ---- -<p>{{APIRef("Firefox OS")}}</p> - -<p>{{ non-standard_header() }}</p> - -<p>{{ obsolete_header(25) }}</p> - -<p>{{ B2GOnlyHeader2('certified') }}</p> - -<p>返回 {{ domxref("SmsManager") }} 对象,你可以通过该对象进行短消息的收发操作。</p> - -<div class="note"> -<p>注意: <strong>废弃! </strong>该对象已被废弃,请参考使用: {{ domxref("window.navigator.mozMobileMessage") }}。</p> -</div> - -<h2 id="Syntax" name="Syntax">语法</h2> - -<pre class="eval">var sms = window.navigator.mozSms; -</pre> - -<h2 id="参数说明">参数说明</h2> - -<p>这是一个非标准接口,不过该接口有在 W3C 部分提及: <a href="http://www.w3.org/2012/sysapps/" title="http://www.w3.org/2012/sysapps/">System Application Working Group</a>.</p> - -<table class="standard-table"> - <thead> - <tr> - <th scope="col">Specification</th> - <th scope="col">Status</th> - <th scope="col">Comment</th> - </tr> - </thead> - <tbody> - <tr> - <td>{{SpecName('Messaging')}}</td> - <td>{{Spec2('Messaging')}}</td> - <td>Editor Draft (WIP).</td> - </tr> - </tbody> -</table> - -<h2 id="浏览器兼容">浏览器兼容</h2> - -<p>For obvious reasons, support is primarily expected on mobile browsers.</p> - -<p>{{ CompatibilityTable() }}</p> - -<div id="compat-desktop"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{ CompatNo() }}</td> - <td>{{ CompatNo() }}</td> - <td>{{ CompatNo() }}</td> - <td>{{ CompatNo() }}</td> - <td>{{ CompatNo() }}</td> - </tr> - </tbody> -</table> -</div> - -<div id="compat-mobile"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{ CompatNo() }}</td> - <td>{{ CompatGeckoMobile("12.0") }}</td> - <td>{{ CompatNo() }}</td> - <td>{{ CompatNo() }}</td> - <td>{{ CompatNo() }}</td> - </tr> - </tbody> -</table> -</div> - -<h2 id="Preferences_availability">Preferences & availability</h2> - -<ul> - <li>WebSMS is disabled by default and can be enabled setting the preference <code>dom.sms.enabled</code> to true.</li> - <li>A comma-separated whitelist of allowed hostnames that are allowed to use the WebSMS API must be specified using the <code>dom.sms.whitelist</code> preference. This string is empty by default.</li> - <li>WebSMS is only available to certified apps on Firefox OS (B2G).</li> -</ul> - -<h2 id="参阅">参阅</h2> - -<ul> - <li><a href="/en-US/docs/API/WebSMS" title="/en-US/docs/API/WebSMS">WebSMS API</a></li> - <li>{{ domxref("SmsManager") }}</li> - <li>{{ domxref("window.navigator.mozTelephony") }} for controlling telephone calls.</li> -</ul> diff --git a/files/zh-cn/web/api/using_the_browser_api/index.html b/files/zh-cn/web/api/using_the_browser_api/index.html deleted file mode 100644 index a829b11d58..0000000000 --- a/files/zh-cn/web/api/using_the_browser_api/index.html +++ /dev/null @@ -1,214 +0,0 @@ ---- -title: Using the browser API -slug: Web/API/Using_the_Browser_API -tags: - - API - - B2G - - Firefox OS - - WebAPI - - 指南 - - 浏览器 - - 非标准 -translation_of: Mozilla/Gecko/Chrome/API/Browser_API/Using ---- -<p>{{ non-standard_header() }}</p> - -<p>{{ B2GOnlyHeader2('privileged') }}</p> - -<h2 id="概述">概述</h2> - -<p>HTML Browser API 是对 HTML {{HTMLElement("iframe")}} 元素的扩展,允许 web app 用来实现浏览器或浏览器类似的应用。主要涉及到两个方面:</p> - -<ul> - <li>使 <code>iframe</code> 看起来像嵌入内容的顶层浏览器窗口。这就意味着 <span id="summary_alias_container"><span id="short_desc_nonedit_display"><a href="/en-US/docs/DOM/window.top" title="/en-US/docs/DOM/window.top"><code>window.top</code></a>, <a href="/en-US/docs/DOM/window.parent" title="/en-US/docs/DOM/window.parent"><code>window.parent</code></a>, <a href="/en-US/docs/DOM/window.frameElement" title="/en-US/docs/DOM/window.frameElement"><code>window.frameElement</code></a>, 等不应该反映 frame 的继承关系。</span></span>Optionally, the notion that the embedded is an Open Web App can be expressed as well.</li> - <li>用来操作和监听嵌入内容状态的变化的 API。</li> -</ul> - -<p>除此之外,也可以表示成嵌入的内容就是一个 <a href="/en-US/docs/Apps" title="/en-US/docs/Apps">Open Web App</a>。在那种情况下,页面内容就会在适当的 app 上下文(如权限)中被装载。</p> - -<h2 id="用法">用法</h2> - -<p>{{HTMLElement("iframe")}} 可以通过设置 {{htmlattrxref("mozbrowser","iframe")}} 属性而转化为浏览器框架</p> - -<pre class="brush: html"><iframe src="http://hostname.tld" mozbrowser></pre> - -<p>要想嵌入一个 Open Web App, 必须要提供 {{htmlattrxref("mozapp","iframe")}} 以及 app manifest 路径。</p> - -<pre><iframe src="http://hostname.tld" mozapp='http://path/to/manifest.webapp' mozbrowser></pre> - -<p>最后, {{HTMLElement("iframe")}} 的内容可以在它单独的子进程中装载,通过使用{{htmlattrxref("remote","iframe")}} 属性可以单独嵌入到此页面的框架中。</p> - -<pre><iframe src="http://hostname.tld" mozbrowser remote></pre> - -<div class="warning"> -<p><strong>警告:</strong> That last attribute is necessary for security reasons if you plan to load content from an untrusted/unknown origin. If you don't use it, you take the risk of your application being compromised by a malicious web site.</p> -</div> - -<h2 id="权限">权限</h2> - -<p>想要嵌入到 browser frame 中的任何应用必须要在其中的 <a href="/en-US/docs/Web/Apps/Manifest" title="/en-US/docs/Web/Apps/Manifest">app manifest</a> 拥有 <code>browser </code>权限。</p> - -<pre class="brush: json">{ - "permissions": { - "browser": {} - } -}</pre> - -<p>此外,要嵌入一个 Open Web App, app 必须具有 <code>embed-apps</code> 权限。</p> - -<pre class="brush: json">{ - "permissions": { - "browser": {}, - "embed-apps": {} - } -}</pre> - -<h2 id="额外方法">额外方法</h2> - -<p>Firefox OS 扩展了 {{domxref("HTMLIFrameElement")}} DOM 接口以支持 browser {{HTMLElement("iframe")}} 所产生的需求。这些新的方法赋予 {{HTMLElement("iframe")}} 了一些强大的功能:</p> - -<h3 id="Navigation_方法">Navigation 方法</h3> - -<p>这些方法能够使 {{HTMLElement("iframe")}} 根据历史记录进行导航。此处也有必要来实现 back, forward, stop, and reload 按钮。</p> - -<ul> - <li>{{domxref("HTMLIFrameElement.reload","reload()")}}: 重载 {{HTMLElement("iframe")}}.</li> - <li>{{domxref("HTMLIFrameElement.stop","stop()")}}: 停止装载{{HTMLElement("iframe")}}'s content.</li> - <li>{{domxref("HTMLIFrameElement.getCanGoBack","getCanGoBack()")}}: 判断是否可以回到前一页面.</li> - <li>{{domxref("HTMLIFrameElement.goBack","goBack()")}}:回到{{HTMLElement("iframe")}}历史记录的前一个位置</li> - <li>{{domxref("HTMLIFrameElement.getCanGoForward","getCanGoForward()")}}: 得知是否可以到达历史记录的后一个页面。</li> - <li>{{domxref("HTMLIFrameElement.goForward","goForward()")}}: Changes the location of the {{HTMLElement("iframe")}} for the next location in its browsing history.</li> -</ul> - -<h3 id="性能方法">性能方法</h3> - -<p>Those methods are used to manage the resources used by a browser {{HTMLElement("iframe")}}. This is especially useful for implementing tabbed browser application.</p> - -<ul> - <li>{{domxref("HTMLIFrameElement.setVisible","setVisible()")}}: Changes the visibility state of a browser {{HTMLElement("iframe")}}. This can influence resources allocation and some function usage such as {{domxref("window.requestAnimationFrame","requestAnimationFrame")}}.</li> - <li>{{domxref("HTMLIFrameElement.getVisible","getVisible()")}}: Allows knowing the current visibility state of the browser {{HTMLElement("iframe")}}.</li> - <li>{{domxref("HTMLIFrameElement.purgeHistory","purgeHistory()")}}: Allows clearing all the resources (cookies, localStorage, cache, etc.) associated with the browser {{HTMLElement("iframe")}}.</li> -</ul> - -<h3 id="Event_方法">Event 方法</h3> - -<p>In order to manage the browser {{HTMLElement("iframe")}}'s content, many new events were added (see below). The following methods are used to deal with those events:</p> - -<ul> - <li>The {{HTMLElement("iframe")}} gains support for the methods of the {{domxref("EventTarget")}} interface: {{domxref("EventTarget.addEventListener","addEventListener()")}}, {{domxref("EventTarget.removeEventListener","removeEventListener()")}}, and {{domxref("EventTarget.dispatchEvent","dispatchEvent()")}}.</li> - <li>{{domxref("HTMLIFrameElement.sendMouseEvent","sendMouseEvent()")}}: Allows sending a {{domxref("MouseEvent")}} to the {{HTMLElement("iframe")}}'s content.</li> - <li>{{domxref("HTMLIFrameElement.sendTouchEvent","sendTouchEvent()")}}: Allows sending a {{domxref("TouchEvent")}} to the {{HTMLElement("iframe")}}'s content. Note that this method is available for touch enabled devices only.</li> - <li>{{domxref("HTMLIFrameElement.addNextPaintListener","addNextPaintListener()")}}: Allows defining a handler to listen for the next {{event("MozAfterPaint")}} event in the browser {{HTMLElement("iframe")}}.</li> - <li>{{domxref("HTMLIFrameElement.removeNextPaintListener","removeNextPaintListener()")}}: Allows removing a handler previously set with {{domxref("HTMLIFrameElement.addNextPaintListener","addNextPaintListener()")}}.</li> -</ul> - -<h3 id="其他方法">其他方法</h3> - -<p>Those methods are utilities, useful for apps that host a browser {{HTMLElement("iframe")}}.</p> - -<ul> - <li>{{domxref("HTMLIFrameElement.getScreenshot","getScreenshot()")}}: Allows taking a screenshot of the browser {{HTMLElement("iframe")}}'s content. This is particularly useful to get thumbnails of tabs in a tabbed browser app.</li> -</ul> - -<h2 id="Events">Events</h2> - -<p>In order to allow an application to manage the browser {{HTMLElement("iframe")}}, the application can listen for new events about what's happening within the browser {{HTMLElement("iframe")}}. The following new events can be listened for:</p> - -<ul> - <li>{{event("mozbrowserasyncscroll")}}: Sent when the scroll position within a browser {{HTMLElement("iframe")}} changes.</li> - <li>{{event("mozbrowserclose")}}: Sent when {{domxref("window.close()")}} is called within a browser {{HTMLElement("iframe")}}.</li> - <li>{{event("mozbrowsercontextmenu")}}: Sent when a browser {{HTMLElement("iframe")}} tries to open a context menu. This allows handling {{HTMLElement("menuitem")}} element available within the browser {{HTMLElement("iframe")}}'s content.</li> - <li>{{event("mozbrowsererror")}}: Sent when an error occurred while trying to load content within a browser {{HTMLElement("iframe")}}.</li> - <li>{{event("mozbrowsericonchange")}}: Sent when the favicon of a browser {{HTMLElement("iframe")}} changes.</li> - <li>{{event("mozbrowserloadend")}}: Sent when the browser {{HTMLElement("iframe")}} has finished loading all its assets.</li> - <li>{{event("mozbrowserloadstart")}}: Sent when the browser {{HTMLElement("iframe")}} starts to load a new page.</li> - <li>{{event("mozbrowserlocationchange")}}: Sent when a browser {{HTMLElement("iframe")}}'s location changes.</li> - <li>{{event("mozbrowseropenwindow")}}: Sent when {{domxref("window.open()")}} is called within a browser {{HTMLElement("iframe")}}.</li> - <li>{{event("mozbrowsersecuritychange")}}: Sent when the SSL state changes within a browser {{HTMLElement("iframe")}}.</li> - <li>{{event("mozbrowsershowmodalprompt")}}: Sent when {{domxref("window.alert","alert()")}}, {{domxref("window.confirm","confirm()")}}, or {{domxref("window.prompt","prompt()")}} is called within a browser {{HTMLElement("iframe")}}.</li> - <li>{{event("mozbrowsertitlechange")}}: Sent when the document.title changes within a browser {{HTMLElement("iframe")}}.</li> - <li>{{event("mozbrowserusernameandpasswordrequired")}}: Sent when an HTTP authentification is requested.</li> - <li>{{event("mozbrowseropensearch")}}: Sent when a link to a search engine is found.</li> -</ul> - -<h2 id="示例">示例</h2> - -<p>In this example we'll see how to implement a very basic browser app.</p> - -<h3 id="HTML">HTML</h3> - -<p>In the HTML we just add a URL bar, a "Go" and "Stop" button, and a browser {{HTMLElement("iframe")}}.</p> - -<pre class="brush: html"><header> - <input id="url"> - <button id="go">Go</button> - <button id="stop">Stop</button> -</header> - -<iframe src="about:blank" mozbrowser remote></iframe> -</pre> - -<h3 id="CSS">CSS</h3> - -<p>We switch between the go and stop button with a little css trick.</p> - -<pre class="brush: css">button:disabled { - display: none; -}</pre> - -<h3 id="JavaScript">JavaScript</h3> - -<p>Now we can add the required functionalities:</p> - -<pre class="brush: js">document.addEventListener("DOMContentLoaded", function () { - var url = document.getElementById("url"); - var go = document.getElementById("go"); - var stop = document.getElementById("stop"); - - var browser = document.getElementsByTagName("iframe")[0]; - - // This function is used to switch the Go and Stop button - // If the browser is loading content, "Go" is disabled and "Stop" is enabled - // Otherwise, "Go" is enabled and "Stop" is disabled - function uiLoading(isLoading) { - go.disabled = isLoading; - stop.disabled = !isLoading; - } - - go.addEventListener("touchend", function () { - browser.setAttribute("src", url.value); - }); - - stop.addEventListener("touchend", function () { - browser.stop(); - }); - - // When the browser starts loading content, we switch the "Go" and "Stop" buttons - browser.addEventListener('mozbrowserloadstart', function () { - uiLoading(true); - }); - - // When the browser finishes loading content, we switch back the "Go" and "Stop" buttons - browser.addEventListener('mozbrowserloadend', function () { - uiLoading(false); - }); - - // In case of error, we also switch back the "Go" and "Stop" buttons - browser.addEventListener('mozbrowsererror', function (event) { - uiLoading(false); - alert("Loading error: " + event.detail); - }); - - // When a user follows a link, we make sure the new location is displayed in the address bar - browser.addEventListener('mozbrowserlocationchange', function (event) { - url.value = event.detail; - }); -});</pre> - -<h2 id="参考">参考</h2> - -<ul> - <li>{{HTMLElement("iframe")}}</li> - <li>{{domxref("HTMLIFrameElement")}}</li> - <li>Stat of <a href="https://wiki.mozilla.org/WebAPI/BrowserAPI" title="https://wiki.mozilla.org/WebAPI/BrowserAPI">implementation on WikiMo</a></li> -</ul> diff --git a/files/zh-cn/web/api/webvr_api/webvr_environment_setup/index.html b/files/zh-cn/web/api/webvr_api/webvr_environment_setup/index.html deleted file mode 100644 index d3ede8add1..0000000000 --- a/files/zh-cn/web/api/webvr_api/webvr_environment_setup/index.html +++ /dev/null @@ -1,110 +0,0 @@ ---- -title: WebVR环境配置 -slug: Web/API/WebVR_API/WebVR_environment_setup -translation_of: Archive/WebVR/WebVR_environment_setup ---- -<p>{{draft("WebVR API文档目前正在更新中以涵盖1.0版本规范, 因此这些信息中的一部分将会过时。如果你对此有任何疑问请联系 ~~chrisdavidmills。")}}</p> - -<p class="summary">在这篇文章中, 我们将带你了解配置你的WebVR测试环境所需要做的工作 — 包括硬件和软件配置以及一些常见的错误的解决方法.</p> - -<h2 id="硬件">硬件</h2> - -<p>首先来看WebVR的硬件需求。</p> - -<h3 id="头戴式显示器与位置追踪器">头戴式显示器与位置追踪器</h3> - -<p>目前有几款产品可作为VR头戴式显示器,其中最好的是<a href="https://developer.oculus.com/">Oculus Rift</a>,它具有坚固的头戴式显示器和安装在三脚架或监视器上的位置追踪相机。Oculus Rift DK2 目前的零售价是350美元(约2410人民币),但是随着技术的进步和越来越多的头戴设备的出现,预计Oculus Rigt的价格会下降。</p> - -<p><img alt="" src="https://mdn.mozillademos.org/files/11037/hw-setup.png" style="display: block; height: 78px; margin: 0px auto; width: 70%;"></p> - -<p>对于那些没有能力购买整套VR设备的人,也有其他便宜的产品可以选择。一个VR头戴式显示器其实就是一个高分辨率的屏幕,这个屏幕前面有一组眼镜。显示屏显示的是两个并排的有些偏移和渐晕的屏幕影像的副本,人的两眼各看其中一个,这样就给用户带来立体感,这些对于创建VR景象都是至关重要的。</p> - -<p><img alt="" src="https://mdn.mozillademos.org/files/10695/stereoscopic.png" style="display: block; height: 540px; margin: 0px auto; width: 960px;"></p> - -<p>你可以使用支持的浏览器去感受几近相同的体验,比如使用 Android <a href="https://nightly.mozilla.org/">Nightly</a>版的火狐浏览器—— 如同谷歌的<a href="https://www.google.com/get/cardboard/">Google Cardboard</a>的想法那样,你可以用任何能固定在头部的装置将手机固定在双眼前面,然后通过手机运行VR软件。这里主要的缺点就是没有位置追踪器,手机处理器没有桌面PC的处理器强大,所以体验上相对就没有那么真实(你转动头部的时候你可能得不到和PC上相同的体验,它有可能比较卡),但是,作为一个便宜的入门的设备,它还是不错的。</p> - -<h3 id="一台计算机:用于渲染VR场景">一台计算机:用于渲染VR场景</h3> - -<p>VR硬件需要提供高精度,低延迟的数据,来提供令人满意的用户体验 — 显示刷新需要达到60fps,否则,用户会觉得卡顿、抖动。为了保证达到这点,单位时间有大量的数据需要处理。因此,运行VR应用的计算机的配置要求比较高。最理想的是,你有台带独显的高配的笔记本或台式电脑,如新版MacBook Pro 15“/ 17”或Mac Pro,或Windows游戏本。如果你的电脑运行比较慢,你的体验会比较糟糕。</p> - -<h2 id="软件">软件</h2> - -<p>要运行WebVR软件,你需要如下描述的软件设置。</p> - -<h3 id="Oculus_Rift_SDK">Oculus Rift SDK</h3> - -<p>如果你使用Oculus Rift,你需要在你的系统上下载并安装 <a href="https://developer.oculus.com/downloads/">Oculus Rift SDK</a> 。它包含了VR软件所需的运行环境和<em>OculusWorldDemo</em>示例软件,它对排除故障很有用。</p> - -<h3 id="Firefox_Nightly与WebVR_Enabler_Add-on_(或其他可替代的)">Firefox Nightly与WebVR Enabler Add-on (或其他可替代的)</h3> - -<p>要设置浏览器,请按照下列步骤操作:</p> - -<ol> - <li>Firefox <a href="https://nightly.mozilla.org/">Nightly</a> 和<a href="https://www.mozilla.org/en-US/firefox/developer/">Developer Edition</a> 都支持WebVR。如果你还没装选择其中之一安装,注意安装最新的版本。</li> - <li>然后,安装 <a class="external external-icon" href="http://www.mozvr.com/downloads/webvr-addon-0.1.0.xpi">WebVR Enabler Add-on</a> — 这将启用WebVR并禁用多处理浏览(<a class="basiclink-blue" href="https://wiki.mozilla.org/Electrolysis">E10S</a>),这是一种新的Firefox浏览功能,目前与WebVR不兼容。</li> - <li>最后,重启浏览器。</li> -</ol> - -<div class="note"> -<p><strong>Note</strong>: 手动开启对WebVR的支持,你可以进入 <a>about:config</a> 然后打开dom.vr*选项。 WebVR Enabler Add-on更加的fang方便,它一次可以完成您所需要的一切。</p> -</div> - -<div class="note"> -<p><strong>Note</strong>: 对于移动端用户,Android版Firefox在<a href="http://nightly.mozilla.org/">Nightly builds</a>中也支持WebVR,但是现在还没优化,欢迎反馈意见。</p> -</div> - -<div class="note"> -<p><strong>Note</strong>: 还有可用的WebVR支持的实验性Chrome产品。 要了解更多,请查看Brandon Jones的 <a class="external external-icon" href="http://blog.tojicode.com/2014/07/bringing-vr-to-chrome.html">Bringing VR to Chrome</a>。</p> -</div> - -<h3 id="显示配置">显示配置</h3> - -<p>为了获得最佳性能,以下步骤的显示器配置非常重要。 不这样做会导致过度抖动和延迟。 我们正在努力改进这些方面,使WebVR真正的即插即用,但是现在最好的结果需要手动配置。</p> - -<h4 id="Windows">Windows</h4> - -<p>在控制面板中,先进入<em>Display > Screen Resolution(显示 > 屏幕分辨率)</em>. 设置<em>:</em></p> - -<ul> - <li><em>Orientation</em> to <em>Landscape (flipped). // 横向(翻转)</em></li> - <li><em>Multiple displays</em> to <em>Extend these displays</em>. // 扩展这些显示器</li> -</ul> - -<p><img alt="" src="https://mdn.mozillademos.org/files/10683/win-screen-resolution.png" style="display: block; height: 573px; margin: 0px auto; width: 644px;"></p> - -<p>然后,进入 <em>Advanced Settings > Monitor > Monitor Settings(高级显示设置 > 监视器 > 监视器设置),</em> 设置屏幕刷新频率为 <em>60Hz</em>.</p> - -<p><img alt="" src="https://mdn.mozillademos.org/files/10685/win-monitor.png" style="display: block; height: 573px; margin: 0px auto; width: 644px;"></p> - -<h4 id="Mac">Mac</h4> - -<p>首先,进入System Preferences > Displays > Display. 设置:</p> - -<ul> - <li><em>Optimize for</em> to <em>Rift</em></li> - <li><em>Rotation</em> to <em>90°</em></li> - <li><em>Refresh</em> to <em>60Hz</em></li> -</ul> - -<p><em><img alt="" src="https://mdn.mozillademos.org/files/10691/mac-displays.png" style="display: block; height: 528px; margin: 0px auto; width: 1342px;"></em></p> - -<p>然后,进入 <em>System Preferences <span class="gray5 light px1">> </span>Displays <span class="gray5 light px1">> </span>Arrangement</em> 设置<em>Arrangement</em>为<em>Mirrored</em>.</p> - -<p><img alt="" src="https://mdn.mozillademos.org/files/10693/mac-displays-mirrored.png" style="display: block; height: 528px; margin: 0px auto; width: 668px;"></p> - -<h2 id="故障排除">故障排除</h2> - -<p>在这个部分,我们提供一些故障排除方法。</p> - -<dl> - <dt>我的头戴式显示器或者位置追踪器相机不工作</dt> - <dd>尝试使用Oculus Rift SDK附带的OculusWorldDemo测试系统,如果您使用的是其他的VR硬件设备,则使用配套的测试系统。 如果您的硬件设备完全不工作,请确保已完全按照随附手册中的说明进行设置。 常见的错误包括将镜头盖留在追踪相机上和忘记插入USB电缆。</dd> - <dt>我的头戴式显示器或者位置追踪器相机还是不工作</dt> - <dd>一个常见的问题是追踪摄像机停止工作,所以你仍然可以看到图像,但它不会跟着你的头一起旋转。 提示:如果摄像机工作,相机的蓝色指示灯将亮起。 如果WebVR应用程序仍然不工作,并且OculusWorldDemo正常运行,请尝试重新启动浏览器 —— Nightly仍然处于实验性阶段,有时会出现异常。</dd> - <dt>即使我正确的配置了 {{anch("Display configuration")}},我看到显示的图像卡顿抖动</dt> - <dd>有可能是您的显卡太慢,您没有独显,或者当Oculus Rift打开时,您的计算机没有切换到显卡。 但我们不能确定适用于所有的电脑。无论哪种情况,你可以通过测试看看发生了什么,比如在Mac上使用<a href="https://gfx.io/">gfxCardStatus</a>软件来测试。 它会让你看到在什么时候集成或独显会切换,或强制使用某一个。 如果它返回消息“您正在使用gfxCardStatus不支持的系统,请确保您使用的是具有双GPU的MacBook Pro。 那么你可能没有GPU,你需要一个更快的处理器或选择容忍。 对于Windows,目前没有类似的应用程序,您必须手动进行更改。</dd> - <dt>我的VR设备旁的第二个监视器表现很奇怪。</dt> - <dd>如果你有第二个监视器(或者笔记本的外接显示器),当你使用 VR设备的时候最好将它断开,否则,有时候它会造成奇怪的问题。</dd> - <dt>Linux系统可以使用吗?</dt> - <dd>WebVR在Linux系统上目前不能使用。未完待续</dd> -</dl> diff --git a/files/zh-cn/web/css/-moz-binding/index.html b/files/zh-cn/web/css/-moz-binding/index.html deleted file mode 100644 index 5a26aec3c2..0000000000 --- a/files/zh-cn/web/css/-moz-binding/index.html +++ /dev/null @@ -1,114 +0,0 @@ ---- -title: '-moz-binding' -slug: Web/CSS/-moz-binding -tags: - - CSS - - CSS参考 - - NeedsBrowserCompatibility - - NeedsUpdate - - XBL - - 不规范的 -translation_of: Archive/Web/CSS/-moz-binding ---- -<div>{{Non-standard_header}}{{CSSRef}}</div> - -<p><strong><code>-moz-binding</code></strong> 属性被基于 Mozilla 的应用程序用于附加 <a href="/zh-CN/docs/XBL">XBL</a> 绑定到 DOM 元素。</p> - -<p>{{cssinfo}}</p> - -<h2 id="语法">语法</h2> - -<pre class="brush:css">/* <uri> value */ --moz-binding: url(http://www.example.org/xbl/htmlBindings.xml#checkbox); - -/* Global values */ --moz-binding: inherited; --moz-binding: initial; --moz-binding: unset; -</pre> - -<h3 id="取值">取值</h3> - -<dl> - <dt><uri></dt> - <dd>The URI for the XBL binding (including the fragment identifier).</dd> - <dt><code>none</code></dt> - <dd>No XBL binding is applied to the element.</dd> -</dl> - -<h3 id="正式语法">正式语法</h3> - -<pre class="syntaxbox">{{csssyntax}}</pre> - -<h2 id="示例">示例</h2> - -<pre class="brush: css">.exampleone { - -moz-binding: url(http://www.example.org/xbl/htmlBindings.xml#radiobutton); -}</pre> - -<h2 id="规范">规范</h2> - -<p>Not part of any specification.</p> - -<h2 id="浏览器兼容性">浏览器兼容性</h2> - -<div class="bc-old"> -<p>{{CompatibilityTable}}</p> - -<div id="compat-desktop"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari (WebKit)</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatNo}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - </tr> - </tbody> -</table> -</div> - -<div id="compat-mobile"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - </tr> - </tbody> -</table> -</div> - -<p id="compatNote_1">1. XBL is deprecated and being removed (See {{bug(1397874)}}).</p> - -<h2 id="参见">参见</h2> - -<ul> - <li><a href="/en-US/docs/XBL/XBL_1.0_Reference/Binding_Attachment_and_Detachment">XBL 参考文档:绑定的固定与脱离</a></li> - <li><a href="/en-US/docs/Mozilla/Tech/XUL/Tutorial/Introduction_to_XBL">XUL 教程:XBL 简介</a></li> -</ul> -</div> diff --git a/files/zh-cn/web/css/-moz-border-bottom-colors/index.html b/files/zh-cn/web/css/-moz-border-bottom-colors/index.html deleted file mode 100644 index b5f5ca73d6..0000000000 --- a/files/zh-cn/web/css/-moz-border-bottom-colors/index.html +++ /dev/null @@ -1,131 +0,0 @@ ---- -title: '-moz-border-bottom-colors' -slug: Web/CSS/-moz-border-bottom-colors -translation_of: Archive/Web/CSS/-moz-border-bottom-colors ---- -<div>{{Non-standard_header}}{{CSSRef}}</div> - -<p>在Mozilla Firefox中, the <code>-moz-border-bottom-colors</code> CSS 属性的作用是给元素添加下边框的颜色。</p> - -<p>When an element has a border that is larger than a single CSS pixel, each line of pixels uses the next color specified in this property, from the outside in. This eliminates the need for nested boxes. If the border is wider than the number of specified colors, the remaining part of the border is the innermost color specified.</p> - -<p>{{cssinfo}}</p> - -<p>It does not apply</p> - -<ol> - <li>if {{Cssxref("border-style")}} is <code>dashed</code> or <code>dotted</code>.</li> - <li>to tables with <code>border-collapse: collapse</code>.</li> -</ol> - -<h2 id="Syntax">Syntax</h2> - -<pre class="brush:css">/* Single <color> value */ --moz-border-bottom-colors: #f0f0f0; - -/* Multiple <color> values */ --moz-border-bottom-colors: #f0f0f0 #a0a0a0 #505050 #000000; - -/* Global values */ --moz-border-bottom-colors: inherit; --moz-border-bottom-colors: initial; --moz-border-bottom-colors: unset; -</pre> - -<h3 id="Values(属性值)">Values(属性值)</h3> - -<p>Accepts a white-space separated list of color values.</p> - -<dl> - <dt><颜色></dt> - <dd>Specifies the color of a line of pixels of the bottom border. <code>transparent</code> is valid. See {{cssxref("<color>")}} values for possible units.</dd> - <dt>none</dt> - <dd>Default, no colors are drawn or {{cssxref("border-color")}} is used, if specified.</dd> -</dl> - -<h3 id="Formal_syntax">Formal syntax</h3> - -<pre class="syntaxbox">{{csssyntax}}</pre> - -<h2 id="Example">Example</h2> - -<pre class="brush:html"><div id="example">Example</div> -</pre> - -<pre class="brush:css">#example { - padding: 20px; - background-color: gray; - border: 10px solid black; - -moz-border-top-colors: #e00 #c30 #c50 #c60 #c70 #c80 #c90 #ca0 #cb0 #cc0; - -moz-border-right-colors: red #f60 #f80 #f90 #fa0 #fb0 #fc0 #fd0 #fe0 #ff0; - -moz-border-bottom-colors: red #f60 #f80 #f90 #fa0 #fb0 #fc0 #fd0 #fe0 #ff0; - -moz-border-left-colors: #e00 #c30 #c50 #c60 #c70 #c80 #c90 #ca0 #cb0 #cc0; -} -</pre> - -<p>{{EmbedLiveSample("Example", 120, 90)}}</p> - -<h2 id="Specifications">Specifications</h2> - -<p>This property is not part of any specification.</p> - -<h2 id="Browser_compatibility">Browser compatibility</h2> - -<p>{{CompatibilityTable}}</p> - -<div id="compat-desktop"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatNo}}</td> - <td>{{CompatGeckoDesktop("1.7")}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - </tr> - </tbody> -</table> -</div> - -<div id="compat-mobile"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - </tr> - </tbody> -</table> -</div> - -<h2 id="See_also">See also</h2> - -<ul> - <li>{{cssxref("border-color")}}</li> - <li>{{Cssxref("-moz-border-right-colors")}}</li> - <li>{{Cssxref("-moz-border-top-colors")}}</li> - <li>{{Cssxref("-moz-border-left-colors")}}</li> -</ul> diff --git a/files/zh-cn/web/css/-ms-overflow-style/index.html b/files/zh-cn/web/css/-ms-overflow-style/index.html deleted file mode 100644 index 895b1cf043..0000000000 --- a/files/zh-cn/web/css/-ms-overflow-style/index.html +++ /dev/null @@ -1,50 +0,0 @@ ---- -title: '-ms-overflow-style' -slug: Web/CSS/-ms-overflow-style -tags: - - CSS - - CSS属性 - - 参考 -translation_of: Archive/Web/CSS/-ms-overflow-style ---- -<div>{{CSSRef}}</div> - -<div>{{non-standard_header}}</div> - -<div></div> - -<p><strong><code>-ms-overflow-style</code></strong> 的<a href="/en-US/docs/Web/CSS">CSS</a> 属性是一个 <a href="/en-US/docs/Web/CSS/Microsoft_CSS_extensions">Microsoft extension</a> 用于控制元素内容溢出时滚动条的行为。</p> - -<p>{{cssinfo}}</p> - -<h2 id="Syntax" name="Syntax">语法</h2> - -<h3 id="Values" name="Values">Values</h3> - -<dl> - <dt><code>auto</code></dt> - <dt> 初始值等同于<code>inherit</code>.</dt> - <dd></dd> - <dt><code>none</code></dt> - <dd>永远不会显示滚动条,但是如果元素的内容溢出,仍然可以滚动元素。</dd> - <dt><code>scrollbar</code></dt> - <dd>如果元素的内容溢出,则显示“传统”滚动条。“传统的”滚动条不会自动隐藏,也不会覆盖元素的内容。因此,内容的布局区域的大小将通过滚动条的宽度(垂直滚动条)或高度(水平滚动条)来减少。</dd> - <dt><code>-ms-autohiding-scrollbar</code></dt> - <dd>如果元素的内容溢出,则使用自动隐藏滚动条。自动隐藏滚动条在滚动期间或指针与页面交互后不久显示,在滚动和指针交互停止后不久隐藏。当它们可见时,自动隐藏的滚动条会覆盖元素的内容。</dd> -</dl> - -<h3 id="Formal_syntax" name="Formal_syntax">语法形式</h3> - -<pre class="syntaxbox"> {{csssyntax}} -</pre> - -<h2 id="Specifications" name="Specifications">说明书</h2> - -<p>不是任何规范的一部分</p> - -<h2 id="另请参阅">另请参阅</h2> - -<ul> - <li>{{CSSxRef("scrollbar-width")}}</li> - <li>{{CSSxRef("::-webkit-scrollbar")}}</li> -</ul> diff --git a/files/zh-cn/web/css/_doublecolon_-ms-check/index.html b/files/zh-cn/web/css/_doublecolon_-ms-check/index.html deleted file mode 100644 index 6ebbdb1ea4..0000000000 --- a/files/zh-cn/web/css/_doublecolon_-ms-check/index.html +++ /dev/null @@ -1,169 +0,0 @@ ---- -title: '::-ms-check' -slug: 'Web/CSS/::-ms-check' -translation_of: 'Archive/Web/CSS/::-ms-check' ---- -<div>{{CSSRef}}</div> - -<div>{{non-standard_header}}</div> - -<div> </div> - -<p><strong><code>::-ms-check这个css伪类是微软扩展的用以表达</code></strong> checkboxes 和 radio 的勾选状态,其中 checkboxes 和 radio分别通过 <a href="/en-US/docs/Web/HTML/Element/input/checkbox"><input type="checkbox"></a> 和 <a href="/en-US/docs/Web/HTML/Element/input/radio"><input type="radio"></a>创建</p> - -<p>只有IE浏览器和微软Edge浏览器支持该伪类。</p> - -<h2 id="Allowable_properties" name="Allowable_properties">属性支持性</h2> - -<p>只有以下css属性可以在选择器里使用 <code>::-ms-check</code> 伪类. 其他属性会被自动忽略</p> - -<ul> - <li>{{cssxref("background-clip")}}</li> - <li>{{cssxref("background-color")}}</li> - <li>{{cssxref("background-image")}}</li> - <li>{{cssxref("background-origin")}}</li> - <li>{{cssxref("background-repeat")}}</li> - <li>{{cssxref("background-size")}}</li> - <li>{{cssxref("border-bottom-color")}}</li> - <li>{{cssxref("border-bottom-left-radius")}}</li> - <li>{{cssxref("border-bottom-right-radius")}}</li> - <li>{{cssxref("border-bottom-style")}}</li> - <li>{{cssxref("border-bottom-width")}}</li> - <li>{{cssxref("border-left-color")}}</li> - <li>{{cssxref("border-left-style")}}</li> - <li>{{cssxref("border-left-width")}}</li> - <li>{{cssxref("border-right-color")}}</li> - <li>{{cssxref("border-right-style ")}}</li> - <li>{{cssxref("border-right-width")}}</li> - <li>{{cssxref("border-top-color")}}</li> - <li>{{cssxref("border-top-left-radius")}}</li> - <li>{{cssxref("border-top-right-radius ")}}</li> - <li>{{cssxref("border-top-style")}}</li> - <li>{{cssxref("border-top-width")}}</li> - <li>{{cssxref("box-shadow")}}</li> - <li>{{cssxref("box-sizing")}}</li> - <li>{{cssxref("color")}}</li> - <li>{{cssxref("cursor")}}</li> - <li>{{cssxref("display")}} (values <code>block</code>, <code>inline-block</code>, <code>none</code>)</li> - <li>{{cssxref("@font-face")}}</li> - <li>{{cssxref("font-size")}}</li> - <li>{{cssxref("font-style")}}</li> - <li>{{cssxref("font-weight")}}</li> - <li>{{cssxref("height")}}</li> - <li>{{cssxref("margin-bottom")}}</li> - <li>{{cssxref("margin-left")}}</li> - <li>{{cssxref("margin-right")}}</li> - <li>{{cssxref("margin-top")}}</li> - <li><code>-ms-background-position-x</code></li> - <li><code>-ms-background-position-y</code></li> - <li>{{cssxref("-ms-high-contrast-adjust")}}</li> - <li>{{cssxref("opacity")}}</li> - <li>{{cssxref("outline-color")}}</li> - <li>{{cssxref("outline-style")}}</li> - <li>{{cssxref("outline-width")}}</li> - <li>{{cssxref("padding-bottom")}}</li> - <li>{{cssxref("padding-left")}}</li> - <li>{{cssxref("padding-right")}}</li> - <li>{{cssxref("padding-top")}}</li> - <li>{{cssxref("transform")}}</li> - <li>{{cssxref("transform-origin")}}</li> - <li>{{cssxref("visibility")}}</li> - <li>{{cssxref("width")}}</li> -</ul> - -<h2 id="Syntax" name="Syntax">语法</h2> - -<pre class="syntaxbox"> {{csssyntax}} -</pre> - -<h2 id="Example" name="Example">例子</h2> - -<h3 id="HTML">HTML</h3> - -<pre class="brush: html"><form> - <label for="redButton">Red</label> - <input type="radio" id="redButton"><br> - <label for="greenCheckbox">Green</label> - <input type="checkbox" id="greenCheckbox"> -</form></pre> - -<h3 id="CSS">CSS</h3> - -<pre class="brush: css">input, label { - display: inline; -} - -input[type=radio]::-ms-check { - border-color: red; /* This will make the border red when the button is checked. */ - color: red; /* This will make the circle red when the button is checked. */ -} - -input[type=checkbox]::-ms-check { - border-color: green; /* This will make the box green when the button is checked. */ - color: green; /* This will make the checkmark green when the button is checked. */ -} -</pre> - -<h3 id="结果">结果</h3> - -<p>可以尝试下面的例子, 左边的截屏显示当用户不在ie浏览器或Edge浏览器上运行时勾选上按钮时的情况</p> - -<p>{{ EmbedLiveSample('Examples', '', '', 'https://mdn.mozillademos.org/files/15814/ie11-example.PNG', 'Web/CSS/::-ms-check') }}</p> - -<h2 id="Specifications" name="Specifications">详述</h2> - -<p>无</p> - -<h2 id="Browser_compatibility" name="Browser_compatibility">浏览器兼容性</h2> - -<p>{{CompatibilityTable}}</p> - -<div id="compat-desktop"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>10.0</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - </tr> - </tbody> -</table> -</div> - -<div id="compat-mobile"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>Firefox OS</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>iOS WebKit</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - </tr> - </tbody> -</table> -</div> diff --git a/files/zh-cn/web/css/_doublecolon_-ms-clear/index.html b/files/zh-cn/web/css/_doublecolon_-ms-clear/index.html deleted file mode 100644 index ef01ab3b21..0000000000 --- a/files/zh-cn/web/css/_doublecolon_-ms-clear/index.html +++ /dev/null @@ -1,22 +0,0 @@ ---- -title: '::-ms-clear' -slug: 'Web/CSS/::-ms-clear' -translation_of: 'Archive/Web/CSS/::-ms-clear' ---- -<div>{{ CSSRef() }}</div> - -<p>{{ Non-standard_header() }}</p> - -<h3 id="概述">概述</h3> - -<p><strong><code>::-ms-clear</code></strong> CSS <a href="/en/CSS/Pseudo-elements" title="en/CSS/Pseudo-elements">伪元素</a> 代表文本输入框 {{HTMLElement("input")}} 边缘的一个按钮(清除按钮),用于清除文本框 {{HTMLElement("input")}} 的当前值。这个按钮和伪元素是不标准的,目前只有Internet Explorer 10+可用,需要带上前缀。只有文本框 {{HTMLElement("input")}} 聚焦且非空的情况下该按钮才会出现。</p> - -<h3 id="Specification" name="Specification">规范</h3> - -<p>不属于任何规范。</p> - -<p>微软在MSDN上有 <a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh465740.aspx">一篇描述</a> 。</p> - -<h3 id="Bugs">Bugs</h3> - -<p>在设置了 {{cssxref("text-align")}}<code>: right 的文本框</code> {{HTMLElement("input")}} 中,如果清除按钮出现,则会裁剪文本框右侧边缘的内容。解决方案是使用 {{cssxref("display")}}<code>: none 隐藏该按钮。详情见</code> <a href="https://connect.microsoft.com/IE/feedback/details/776537">IE bug 776537</a> 。</p> diff --git a/files/zh-cn/web/css/overflow-clip-box/index.html b/files/zh-cn/web/css/overflow-clip-box/index.html deleted file mode 100644 index fdef49313b..0000000000 --- a/files/zh-cn/web/css/overflow-clip-box/index.html +++ /dev/null @@ -1,81 +0,0 @@ ---- -title: overflow-clip-box -slug: Web/CSS/overflow-clip-box -translation_of: Mozilla/Gecko/Chrome/CSS/overflow-clip-box ---- -<h2 id="Summary" name="Summary" style="line-height: 30px;">Summary</h2> -<p> </p> -<h2 id="Syntax" name="Syntax" style="line-height: 30px;">Syntax</h2> -<pre class="twopartsyntaxbox" style="font-size: 12px;"><a href="/en-US/docs/CSS/Value_definition_syntax" title="/en-US/docs/CSS/Value_definition_syntax">Formal syntax</a>: {{csssyntax("overflow-clip-box")}}</pre> -<pre style="font-size: 12px;">overflow-clip-box: padding-box; -overflow-clip-box: content-box; -</pre> -<h3 id="Values" name="Values" style="line-height: 24px;">Values</h3> -<p>padding-box</p> -<p>content-box</p> -<h2 id="Examples" style="line-height: 30px;">Examples</h2> -<pre style="font-size: 12px;"> </pre> -<h2 id="Specifications" style="line-height: 30px;">Specifications</h2> -<table class="standard-table"> - <thead> - <tr> - <th>Specification</th> - <th>Status</th> - <th>Comment</th> - </tr> - </thead> - <tbody> - <tr> - <td>{{SpecName('CSS2.1', 'visufx.html#overflow-clipping', 'Overflow and clipping')}}</td> - <td>{{Spec2('CSS2.1')}}</td> - <td> </td> - </tr> - </tbody> -</table> -<h2 id="Browser_Compatibility" name="Browser_Compatibility" style="line-height: 30px;">Browser compatibility</h2> -<p>{{ CompatibilityTable() }}</p> -<div id="compat-desktop"> - <table class="compat-table"> - <tbody> - <tr> - <th style="line-height: 16px;">Feature</th> - <th style="line-height: 16px;">Firefox (Gecko)</th> - <th style="line-height: 16px;">Chrome</th> - <th style="line-height: 16px;">Internet Explorer</th> - <th style="line-height: 16px;">Opera</th> - <th style="line-height: 16px;">Safari (WebKit)</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{ CompatGeckoDesktop("30.0") }}<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=966992">Bug</a></td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - </tr> - </tbody> - </table> -</div> -<div id="compat-mobile"> - <table class="compat-table"> - <tbody> - <tr> - <th style="line-height: 16px;">Feature</th> - <th style="line-height: 16px;">Firefox Mobile (Gecko)</th> - <th style="line-height: 16px;">Android</th> - <th style="line-height: 16px;">IE Phone</th> - <th style="line-height: 16px;">Opera Mobile</th> - <th style="line-height: 16px;">Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - </tr> - </tbody> - </table> -</div> -<p> </p> diff --git a/files/zh-cn/web/events/domlinkadded/index.html b/files/zh-cn/web/events/domlinkadded/index.html deleted file mode 100644 index d066512013..0000000000 --- a/files/zh-cn/web/events/domlinkadded/index.html +++ /dev/null @@ -1,57 +0,0 @@ ---- -title: DOMLinkAdded -slug: Web/Events/DOMLinkAdded -translation_of: Archive/Add-ons/Events/DOMLinkAdded ---- -<p>当把一个<a href="/en-US/docs/HTML/Element/link"><code><link></code></a>元素插入到文档中的时候,会触发<code>DOMLinkAdded</code>事件.</p> - -<h2 id="基本信息">基本信息</h2> - -<dl> - <dt style="float: left; text-align: right; width: 120px;">规范</dt> - <dd style="margin: 0pt 0pt 0pt 120px;">附加组件私有</dd> - <dt style="float: left; text-align: right; width: 120px;">接口</dt> - <dd style="margin: 0pt 0pt 0pt 120px;">Event</dd> - <dt style="float: left; text-align: right; width: 120px;">是否冒泡</dt> - <dd style="margin: 0pt 0pt 0pt 120px;">是</dd> - <dt style="float: left; text-align: right; width: 120px;">能否取消默认行为</dt> - <dd style="margin: 0pt 0pt 0pt 120px;">能</dd> - <dt style="float: left; text-align: right; width: 120px;">目标</dt> - <dd style="margin: 0pt 0pt 0pt 120px;">window, <a href="/en-US/docs/XUL/browser">browser</a></dd> - <dt style="float: left; text-align: right; width: 120px;">默认行为</dt> - <dd style="margin: 0pt 0pt 0pt 120px;">无</dd> -</dl> - -<h2 id="属性">属性</h2> - -<table class="standard-table"> - <thead> - <tr> - <th scope="col">Property</th> - <th scope="col">Type</th> - <th scope="col">Description</th> - </tr> - </thead> - <tbody> - <tr> - <td><code>target</code> {{readonlyInline}}</td> - <td>{{domxref("EventTarget")}}</td> - <td>The event target (the topmost target in the DOM tree).</td> - </tr> - <tr> - <td><code>type</code> {{readonlyInline}}</td> - <td>{{domxref("DOMString")}}</td> - <td>The type of event.</td> - </tr> - <tr> - <td><code>bubbles</code> {{readonlyInline}}</td> - <td>{{jsxref("Boolean")}}</td> - <td>Whether the event normally bubbles or not.</td> - </tr> - <tr> - <td><code>cancelable</code> {{readonlyInline}}</td> - <td>{{jsxref("Boolean")}}</td> - <td>Whether the event is cancellable or not.</td> - </tr> - </tbody> -</table> diff --git a/files/zh-cn/web/events/mozafterpaint/index.html b/files/zh-cn/web/events/mozafterpaint/index.html deleted file mode 100644 index fc3b766b45..0000000000 --- a/files/zh-cn/web/events/mozafterpaint/index.html +++ /dev/null @@ -1,179 +0,0 @@ ---- -title: MozAfterPaint -slug: Web/Events/MozAfterPaint -translation_of: Archive/Add-ons/Events/MozAfterPaint ---- -<p><code>MozAfterPaint事件在页面呈现给用户屏幕时触发,并提供页面重绘的信息,主要应用于页面优化审查。</code></p> - -<p><code>注意</code>MozAfterPaint并非在页面重绘时立即触发,而是在重绘并合成后发生。这意味着有部分内容触发时已经呈现给客户。</p> - -<div class="note"><strong>Note:</strong> - -<ul> - <li>This event is available to add-ons but since Firefox 4 it is <strong>not</strong> available to web pages by default. It can only be made available to web pages by setting the preference <code>dom.send_after_paint_to_content</code> to <code>true</code>. (源于<strong> </strong><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=539356"><strong>Bug 539356</strong></a>, 这个属性设置为<code>true</code>, 所有的<code>MozAfterPaint</code> 时间都被发动到web页面. 更多信息请查看 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=829330"><strong>Bug 829330</strong></a>)</li> - <li>Web pages that want to take an action after a repaint of the page can use <a href="/en-US/docs/Web/API/window/requestAnimationFrame">requestAnimationFrame</a> with a callback that sets a timeout of zero to then call the code that takes the desired post-repaint action.</li> - <li>If the handler for this event does anything that triggers repainting (such as changing the style of an element), an infinite loop will probably be triggered.</li> - <li>Repainting of areas scrolled outside the viewport is reported, but repainting of areas scrolled outside <code>overflow:auto</code> elements and the like is not.</li> - <li>Repainting in windowed plug-ins (which is most plug-ins on Windows and GTK) is not reported.</li> -</ul> -</div> - -<h2 id="General_info">General info</h2> - -<dl> - <dt style="float: left; text-align: right; width: 120px;">Specification</dt> - <dd style="margin: 0 0 0 120px;"><em>Add-ons specific</em></dd> - <dt style="float: left; text-align: right; width: 120px;">Interface</dt> - <dd style="margin: 0 0 0 120px;">Event</dd> - <dt style="float: left; text-align: right; width: 120px;">Bubbles</dt> - <dd style="margin: 0 0 0 120px;">Yes</dd> - <dt style="float: left; text-align: right; width: 120px;">Cancelable</dt> - <dd style="margin: 0 0 0 120px;">Yes</dd> - <dt style="float: left; text-align: right; width: 120px;">Target</dt> - <dd style="margin: 0 0 0 120px;">window</dd> - <dt style="float: left; text-align: right; width: 120px;">Default Action</dt> - <dd style="margin: 0 0 0 120px;">None</dd> -</dl> - -<h2 id="Properties">Properties</h2> - -<table class="standard-table"> - <thead> - <tr> - <th scope="col">Property</th> - <th scope="col">Type</th> - <th scope="col">Description</th> - </tr> - </thead> - <tbody> - <tr> - <td><code>target</code> {{readonlyInline}}</td> - <td>{{domxref("EventTarget")}}</td> - <td>The event target (the topmost target in the DOM tree).</td> - </tr> - <tr> - <td><code>type</code> {{readonlyInline}}</td> - <td>{{domxref("DOMString")}}</td> - <td>The type of event.</td> - </tr> - <tr> - <td><code>bubbles</code> {{readonlyInline}}</td> - <td><code>boolean</code></td> - <td>Does the event normally bubble?</td> - </tr> - <tr> - <td><code>cancelable</code> {{readonlyInline}}</td> - <td><code>boolean</code></td> - <td>Is it possible to cancel the event?</td> - </tr> - <tr> - <td><code>boundingClientRect</code></td> - <td>clientRect</td> - <td>The equivalent of {{domxref("Element.getBoundingClientRect", "getBoundingClientRect()")}} for the repainted zone. Read only.</td> - </tr> - <tr> - <td><code>clientRects</code></td> - <td>clientRectList</td> - <td>The equivalent of {{domxref("Element.getClientRects", "getClientRects()")}} for the repainted zone. Read only.</td> - </tr> - <tr> - <td><code>transactionId</code></td> - <td><code>uint64_t</code></td> - <td>The transaction id of the composition that just occurred to present something to the user. Read only.</td> - </tr> - </tbody> -</table> - -<h2 id="Example">Example</h2> - -<p>This example highlights elements that get repainted while hovering the document with a cursor.</p> - -<pre class="brush: js">(function(){ - var store = []; - - // every repaint will be logged in store - window.addEventListener("MozAfterPaint", log, false); - - if ( document.body ) - bind(); - else - window.addEventListener("load", bind, false); - - function log(e){ - store.push( [(new Date).getTime(), e.clientRects] ); - } - - function bind(){ - // clicking anywhere on the document will prevent other repaint to be logged - // as well as display the visual "repaint heatmap" - document.body.addEventListener("click", function onClick(){ - window.removeEventListener("MozAfterPaint", log, false); - - for ( var pos = 0; pos < store.length; pos++ ) { - var rects = store[pos][1]; - - for ( var i = 0; i < rects.length; i++ ) { - // will simply "draw" semi-transparent red divs where - // repaints where recorded - var rect = rects[i]; - var div = document.createElement("div"); - - with (div.style) { - background = "red"; - opacity = "0.1"; - position = "absolute"; - top = rect.top + "px"; - left = rect.left + "px"; - width = (rect.right - rect.left) + "px"; - height = (rect.bottom - rect.top) + "px"; - } - - document.body.appendChild( div ); - } - } - - document.body.removeEventListener("click", onClick, false); - }, false); - } -})(); -</pre> - -<p>This example is for measuring how long something took to paint to the user.</p> - -<pre class="brush: js">// Suppose we want to measure how long it takes to paint the -// next frame after a click event is fired on element "target". - -let winUtils = window.QueryInterface(Ci.nsIInterfaceRequestor) - .getInterface(Ci.nsIDOMWindowUtils); - -// The last transaction id is the last id that was sent to the -// compositor before our script started to execute. -let lastTransactionId = winUtils.lastTransactionId; -let start = window.performance.now(); - -// Set up our MozAfterPaint listener, but we only care about -// MozAfterPaint events where the transaction id is GREATER -// than lastTransactionId. This is to account for the possibility -// that a composite is underway at the time this script is running. -addEventListener("MozAfterPaint", function onPaint(event) { - if (event.transactionId > lastTransactionId) { - // Since the transaction id is greater than the last transaction - // id, that means we're safe to assume that whatever effect that - // clicking on the "target" element was supposed to have, if the - // change should have been instantaneous, then it has been presented - // to the user. - let finish = window.performance.now(); - alert(`Time to present: ${finish - start}ms`); - removeEventListener("MozAfterPaint", onPaint); - } -}); - -document.getElementById("target").click(); - -</pre> - -<h2 id="See_also">See also</h2> - -<ul> - <li><a href="/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIDOMWindowUtils#isMozAfterPaintPendingen-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIDOMWindowUtils#isMozAfterPaintPending">nsIDOMWindowUtils.isMozAfterPaintPending</a></li> -</ul> diff --git a/files/zh-cn/web/events/tabopen/index.html b/files/zh-cn/web/events/tabopen/index.html deleted file mode 100644 index 7d668792be..0000000000 --- a/files/zh-cn/web/events/tabopen/index.html +++ /dev/null @@ -1,57 +0,0 @@ ---- -title: TabOpen -slug: Web/Events/TabOpen -translation_of: Archive/Add-ons/Events/TabOpen ---- -<p><code>TabOpen</code>事件在一个新的<a href="/en-US/docs/XUL/tab"><code>标签页</code></a>打开时触发.</p> - -<h2 id="常规信息">常规信息</h2> - -<dl> - <dt style="float: left; text-align: right; width: 120px;">规范</dt> - <dd style="margin: 0pt 0pt 0pt 120px;"><em>附加组件特有</em></dd> - <dt style="float: left; text-align: right; width: 120px;">接口</dt> - <dd style="margin: 0pt 0pt 0pt 120px;">Event</dd> - <dt style="float: left; text-align: right; width: 120px;">是否冒泡</dt> - <dd style="margin: 0pt 0pt 0pt 120px;">是</dd> - <dt style="float: left; text-align: right; width: 120px;">能否取消默认行为</dt> - <dd style="margin: 0pt 0pt 0pt 120px;">否</dd> - <dt style="float: left; text-align: right; width: 120px;">目标</dt> - <dd style="margin: 0pt 0pt 0pt 120px;"><a href="/en-US/docs/XUL/tab"><code>tab</code></a></dd> - <dt style="float: left; text-align: right; width: 120px;">默认行为</dt> - <dd style="margin: 0pt 0pt 0pt 120px;">None</dd> -</dl> - -<h2 id="属性">属性</h2> - -<table class="standard-table"> - <thead> - <tr> - <th scope="col">Property</th> - <th scope="col">Type</th> - <th scope="col">Description</th> - </tr> - </thead> - <tbody> - <tr> - <td><code>target</code> {{readonlyInline}}</td> - <td>{{domxref("EventTarget")}}</td> - <td>The event target (the topmost target in the DOM tree).</td> - </tr> - <tr> - <td><code>type</code> {{readonlyInline}}</td> - <td>{{domxref("DOMString")}}</td> - <td>The type of event.</td> - </tr> - <tr> - <td><code>bubbles</code> {{readonlyInline}}</td> - <td>{{jsxref("Boolean")}}</td> - <td>Whether the event normally bubbles or not.</td> - </tr> - <tr> - <td><code>cancelable</code> {{readonlyInline}}</td> - <td>{{jsxref("Boolean")}}</td> - <td>Whether the event is cancellable or not.</td> - </tr> - </tbody> -</table> diff --git a/files/zh-cn/web/guide/api/camera/index.html b/files/zh-cn/web/guide/api/camera/index.html deleted file mode 100644 index 64fe08d634..0000000000 --- a/files/zh-cn/web/guide/api/camera/index.html +++ /dev/null @@ -1,219 +0,0 @@ ---- -title: 使用Camera API -slug: Web/Guide/API/Camera -translation_of: Archive/B2G_OS/API/Camera_API/Introduction ---- -<p>通过<a class="link-https" href="https://wiki.mozilla.org/Platform/Features/Camera_API">Camera API</a>,你可以使用手机的摄像头拍照,然后把拍到的照片发送给当前网页.这些操作主要是通过一个<code>input元素</code>来实现的,其中该元素的<code>type属性必须为"file",</code><code>accept属性要允许图片格式,</code>这样才能知道这个文件选择框是用来选择图片的.,完整的HTML结构看起来是这样的:</p> -<pre class="brush: html"><input type="file" id="take-picture" accept="image/*"> -</pre> -<p>当用户激活这个HTML元素的时候,系统会呈现给用户一个选择界面,其中一个选项是选择本地的图片文件,另一个选项是要通过摄像头直接 拍摄照片作为所选文件.如果用户选择了摄像头,则会进入手机的拍照模式.拍照结束后,,用户可以选择确定还是放弃.如果接受了,则该照片会作为所选文件发 送给那个<code><input type="file"></code>元素,同时触发该元素的<code>onchange事件</code>.</p> -<h2 id="获取到所拍摄照片的引用">获取到所拍摄照片的引用</h2> -<p>通过<a href="/en/Using_files_from_web_applications" title="en/Using_files_from_web_applications">File API</a>,你可以获取到用户所拍摄的照片或者所选择的图片文件的引用:</p> -<pre class="brush: js">var takePicture = document.querySelector("#take-picture"); -takePicture.onchange = function (event) { - // 获得图片文件的引用 - var files = event.target.files, - file; - if (files && files.length > 0) { - file = files[0]; - } -}; -</pre> -<h2 id="在网页中展示图片">在网页中展示图片</h2> -<p>如果你获取到了那张照片的引用(也就是File对象),你就可以使用{{ domxref("window.URL.createObjectURL()") }}方法创建一个指向那个照片的URL,然后把得到的URL赋给<code>img</code>元素的<code>src属性</code>:</p> -<pre class="brush: js">// 获取到img元素 -var showPicture = document.querySelector("#show-picture"); - -// 获取到window.URL对象 -var URL = window.URL || window.webkitURL; - -// 创建一个对象URL字符串 -var imgURL = URL.createObjectURL(file); - -// 设置img元素的src属性为那个URL -showPicture.src = imgURL; - -// 释放那个对象URL,提高性能 -URL.revokeObjectURL(imgURL); -</pre> -<p>如果浏览器不支持<code>createObjectURL()</code>方法,还可以使用{{ domxref("FileReader") }}来实现:</p> -<pre class="brush: js">// 如果createObjectURL方法不可用 -var fileReader = new FileReader(); -fileReader.onload = function (event) { - showPicture.src = event.target.result; -}; -fileReader.readAsDataURL(file); -</pre> -<h2 id="完整的示例代码">完整的示例代码</h2> -<p>这里有一个<a class="external" href="http://robnyman.github.com/camera-api/">完整的使用Camera API的demo</a>,下面是这个demo的完整代码:</p> -<h3 id="HTML页面">HTML页面:</h3> -<pre class="brush: html"><!DOCTYPE html> -<html> - <head> - <meta charset="utf-8"> - <title>Camera API</title> - <link rel="stylesheet" href="css/base.css" type="text/css" media="screen"> - </head> - - <body> - - <div class="container"> - <h1>Camera API</h1> - - <section class="main-content"> - <p>A demo of the Camera API, currently implemented in Firefox and Google Chrome on Android. Choose to take a picture with your device's camera and a preview will be shown through createObjectURL or a FileReader object (choosing local files supported too).</p> - - <p> - <input type="file" id="take-picture" accept="image/*"> - </p> - - <h2>Preview:</h2> - <p> - <img src="about:blank" alt="" id="show-picture"> - </p> - - <p id="error"></p> - - </section> - - <p class="footer">All the code is available in the <a href="https://github.com/robnyman/robnyman.github.com/tree/master/camera-api">Camera API repository on GitHub</a>.</p> - </div> - - - <script src="js/base.js"></script> - - - </body> -</html> -</pre> -<h3 id="JavaScript文件">JavaScript文件:</h3> -<pre class="brush: js">(function () { - var takePicture = document.querySelector("#take-picture"), - showPicture = document.querySelector("#show-picture"); - - if (takePicture && showPicture) { - // Set events - takePicture.onchange = function (event) { - // Get a reference to the taken picture or chosen file - var files = event.target.files, - file; - if (files && files.length > 0) { - file = files[0]; - try { - // Get window.URL object - var URL = window.URL || window.webkitURL; - - // Create ObjectURL - var imgURL = URL.createObjectURL(file); - - // Set img src to ObjectURL - showPicture.src = imgURL; - - // Revoke ObjectURL - URL.revokeObjectURL(imgURL); - } - catch (e) { - try { - // Fallback if createObjectURL is not supported - var fileReader = new FileReader(); - fileReader.onload = function (event) { - showPicture.src = event.target.result; - }; - fileReader.readAsDataURL(file); - } - catch (e) { - // - var error = document.querySelector("#error"); - if (error) { - error.innerHTML = "Neither createObjectURL or FileReader are supported"; - } - } - } - } - }; - } -})(); -</pre> -<h2 id="浏览器兼容性">浏览器兼容性</h2> -<p>{{ CompatibilityTable() }}</p> -<div id="compat-desktop"> - <table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Camera API</td> - <td>{{ CompatNo() }}</td> - <td>{{ CompatNo() }}</td> - <td>{{ CompatNo() }}</td> - <td>{{ CompatNo() }}</td> - <td>{{ CompatNo() }}</td> - </tr> - <tr> - <td><code><a href="/en-US/docs/DOM/window.URL.createObjectURL" title="/en-US/docs/DOM/window.URL.createObjectURL">createObjectURL()</a></code></td> - <td>16</td> - <td>{{CompatGeckoDesktop("8.0")}}</td> - <td>10+</td> - <td>{{CompatNo()}}</td> - <td>{{CompatNo()}}</td> - </tr> - <tr> - <td>{{domxref("FileReader")}}</td> - <td>16</td> - <td>{{CompatGeckoDesktop("1.9.2")}}</td> - <td>10+</td> - <td>11.6+</td> - <td>{{CompatNo()}}</td> - </tr> - </tbody> - </table> -</div> -<div id="compat-mobile"> - <table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Camera API</td> - <td>3.0</td> - <td>{{ CompatVersionUnknown() }}</td> - <td>{{ CompatGeckoMobile("10.0") }}</td> - <td>{{ CompatNo() }}</td> - <td>{{ CompatNo() }}</td> - <td>{{ CompatNo() }}</td> - </tr> - <tr> - <td><code><a href="/en-US/docs/DOM/window.URL.createObjectURL" title="/en-US/docs/DOM/window.URL.createObjectURL">createObjectURL()</a></code></td> - <td>4</td> - <td>{{CompatVersionUnknown()}}</td> - <td>{{CompatGeckoMobile("10.0")}}</td> - <td>{{CompatNo()}}</td> - <td>{{CompatNo()}}</td> - <td>{{CompatNo()}}</td> - </tr> - <tr> - <td>{{domxref("FileReader")}}</td> - <td>3</td> - <td>{{CompatVersionUnknown()}}</td> - <td>{{CompatGeckoMobile("10.0")}}</td> - <td>{{CompatNo()}}</td> - <td>11.1</td> - <td>{{CompatNo()}}</td> - </tr> - </tbody> - </table> -</div> -<p> </p> diff --git a/files/zh-cn/web/guide/css/getting_started/xml_data/index.html b/files/zh-cn/web/guide/css/getting_started/xml_data/index.html deleted file mode 100644 index bbdbd784f5..0000000000 --- a/files/zh-cn/web/guide/css/getting_started/xml_data/index.html +++ /dev/null @@ -1,241 +0,0 @@ ---- -title: XML 数据 -slug: Web/Guide/CSS/Getting_started/XML_data -tags: - - CSS - - Web - - 中级 - - 实例 - - 开始学CSS - - 指南 - - 需要更新 -translation_of: Archive/Beginner_tutorials/XML_data ---- -<p>{{ CSSTutorialTOC() }}</p> - -<p>此页面包含一个如何使用CSS和XML数据的示例。</p> - -<p>你将创建一个XML文档范例,和使之在浏览器中展现的样式表。</p> - -<p>这是 <a href="../../../../en/CSS/Getting_Started" rel="internal">CSS tutorial</a> 第二部分的第三节。<br> - 前一章节: <a href="/en-US/docs/Web/Guide/CSS/Getting_Started/SVG_and_CSS" title="https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Getting_Started/SVG_and_CSS">SVG</a><br> - 后一章节: <a href="/en/CSS/Getting_Started/XBL_bindings" title="https://developer.mozilla.org/en/CSS/Getting_Started/XBL_bindings">XBL binding</a></p> - -<h3 id="Information:_XML_data" name="Information:_XML_data">信息: XML 数据</h3> - -<p><em><a href="/en/XML" title="en/XML">XML</a></em> (eXtensible Markup Language 可扩展标记语言) 是一种可用于任何类型的结构化数据的通用型语言。</p> - -<p>默认情况下,Mozilla 浏览器会将 XML 按照非常类似XML文件的原始数据的方式展现。你可以看到定义数据结构的具体的标签。</p> - -<p>通过将你的XML文档与CSS样式表链接,你可以定义展现XML的其他方式。为了实现这一点,样式表建立了映射规则,将XML文档中的标签映射为HTML中使用的展现类型。</p> - -<table style="background-color: #fffff4; border: 1px solid #36b; margin-bottom: 1em; padding: 1em;"> - <caption>示例</caption> - <tbody> - <tr> - <td>XML文档中的数据采用<<code>INFO></code> 标签。你希望文档中的 <small>INFO</small> 元素像 HTML 的段落一样展现。. - <p>在该文档的样式表中,你指定了 <small>INFO</small> 元素的展现方式:</p> - - <div style="width: 30em;"> - <pre class="eval"> -INFO { - display: block; - margin: 1em 0; - } -</pre> - </div> - </td> - </tr> - </tbody> -</table> - -<p>在display属性中最常用的值是:</p> - -<table style="margin-left: 2em;"> - <tbody> - <tr> - <td style="padding-right: 2em;"><code>block</code></td> - <td>Displayed like HTML's <small>DIV</small> (for headings, paragraphs)</td> - </tr> - <tr> - <td><code>inline</code></td> - <td>Displayed like HTML's <small>SPAN</small> (for emphasis within text)</td> - </tr> - </tbody> -</table> - -<p>如同对待HTML一样,通过设置字体、间距和其他细节来添加你自己的样式规则。</p> - -<table style="background-color: #f4f4f4; border: 1px solid #36b; margin-bottom: 1em; padding: 1em;"> - <caption>更多细节</caption> - <tbody> - <tr> - <td>其他display的值可以展现类似于列表项目的元素,或者类似表格组件的元素。 - <p>请查看CSS规范中的<a class="external" href="http://www.w3.org/TR/CSS21/visuren.html#propdef-display">The display property</a> ,来获取全部display类型。</p> - - <p>单独使用CSS,display的结构必须与文档结构一致。其它方式是修改display的结构—例如:使用XBL添加内容,使用JavaScript修改DOM。</p> - - <p>请查看 <a href="/en/XML" title="en/XML">XML</a> 页面,来获取更多关于XML in Mozilla的信息。</p> - </td> - </tr> - </tbody> -</table> - -<h3 id="Action:_An_XML_demonstration" name="Action:_An_XML_demonstration">实例: XML 演示</h3> - -<p>新建一个 XML 文件: <code>doc9.xml </code>。复制粘帖以下内容,注意滚动以获得全部:</p> - -<div style="width: 48em; height: 12em; overflow: auto;"> -<pre><?xml version="1.0"?> -<!-- XML demonstration --> - -<?xml-stylesheet type="text/css" href="style9.css"?> - -<!DOCTYPE planet> -<planet> - -<ocean> -<name>Arctic</name> -<area>13,000</area> -<depth>1,200</depth> -</ocean> - -<ocean> -<name>Atlantic</name> -<area>87,000</area> -<depth>3,900</depth> -</ocean> - -<ocean> -<name>Pacific</name> -<area>180,000</area> -<depth>4,000</depth> -</ocean> - -<ocean> -<name>Indian</name> -<area>75,000</area> -<depth>3,900</depth> -</ocean> - -<ocean> -<name>Southern</name> -<area>20,000</area> -<depth>4,500</depth> -</ocean> - -</planet> -</pre> -</div> - -<p>新建一个 CSS 文件: <code>style9.css 。</code>复制粘帖以下内容,注意滚动以获得全部:</p> - -<div style="width: 48em; height: 12em; overflow: auto;"> -<pre>/*** XML demonstration ***/ - -planet:before { - display: block; - width: 8em; - font-weight: bold; - font-size: 200%; - content: "Oceans"; - margin: -.75em 0px .25em -.25em; - padding: .1em .25em; - background-color: #cdf; - } - -planet { - display: block; - margin: 2em 1em; - border: 4px solid #cdf; - padding: 0px 1em; - background-color: white; - } - -ocean { - display: block; - margin-bottom: 1em; - } - -name { - display: block; - font-weight: bold; - font-size: 150%; - } - -area { - display: block; - } - -area:before { - content: "Area: "; - } - -area:after { - content: " million km\B2"; - } - -depth { - display: block; - } - -depth:before { - content: "Mean depth: "; - } - -depth:after { - content: " m"; - } -</pre> -</div> - -<p>在你的浏览器中打开该文档:</p> - -<table style="border: 2px outset #36b; padding: 1em;"> - <tbody> - <tr> - <td> - <div style="border: 2px solid #cdf; border-bottom: none; padding: .5em 8em 1em .5em;"> - <p style="font-size: 150%; font-weight: bold; margin: -1em 0px 0px 0px; padding: .1em .25em; background-color: #cdf; width: 8em;">Oceans</p> - - <p style="font-size: 75%; margin: .25em 0px 0px 0px; line-height: 110%;"><strong>Arctic</strong><br> - Area: 13,000 million km²<br> - Mean depth: 1,200 m</p> - - <p style="font-size: 75%; margin: .5em 0px 0px 0px; line-height: 110%;"><strong>Atlantic</strong><br> - Area: 87,000 million km²<br> - Mean depth: 3,900 m</p> - - <p style="font-size: 75%; margin: .5em 0px 0px 0px; line-height: 110%;"><strong>. . .</strong></p> - </div> - </td> - </tr> - </tbody> -</table> - -<p><br> - 此演示的注解:</p> - -<ul> - <li>Unicode 字符 上标 2(在 "million km²" 中),在CSS文件中被编码为 <code>\B2</code> 。</li> - <li>标题 "Oceans" 有一个负的上边距,所以它可以上移至边框顶部显示。</li> -</ul> - -<p> </p> - -<table style="background-color: #fffff4; border: 1px solid #36b; margin-bottom: 1em; padding: 1em;"> - <caption>挑战</caption> - <tbody> - <tr> - <td>修改样式表使文档可以作为表格展现。 - <p>(请参见 CSS 规范的 <a class="external" href="http://www.w3.org/TR/CSS21/tables.html">Tables</a> 章节作为参考。)</p> - </td> - </tr> - </tbody> -</table> - -<h4 id="What_next.3F" name="What_next.3F">接下来?</h4> - -<p>如果你难以理解此页面,或者你有其他意见,请提交到讨论页: <a href="/Talk:en/CSS/Getting_Started/XML_data" title="Talk:en/CSS/Getting_Started/XML_data">Discussion</a> 。</p> - -<p>这是本教程的最后一页。请查看此 wiki 的 <a href="/en/CSS" title="en/CSS">CSS</a> 主页,获取更多Mozilla CSS 信息。</p> diff --git a/files/zh-cn/web/javascript/ecmascript_7_support_in_mozilla/index.html b/files/zh-cn/web/javascript/ecmascript_7_support_in_mozilla/index.html deleted file mode 100644 index 55732f87ad..0000000000 --- a/files/zh-cn/web/javascript/ecmascript_7_support_in_mozilla/index.html +++ /dev/null @@ -1,82 +0,0 @@ ---- -title: Mozilla对下一代ECMAScript 的支持 -slug: Web/JavaScript/ECMAScript_7_support_in_Mozilla -tags: - - ECMAScript 2015 - - ECMAScript 2016 - - ECMAScript 2017 - - ECMAScript 2018 - - new features -translation_of: Archive/Web/JavaScript/ECMAScript_Next_support_in_Mozilla ---- -<div>{{jsSidebar("New_in_JS")}}</div> - -<p>下一代 ECMAScript 是指在 ECMAScript 2015 被推出后的 ECMA-262 标准(通常被称为 <a href="/en-US/docs/Web/JavaScript">JavaScript</a>)的新特性。新版本的 ECMAScript 规范会每年发布。</p> - -<p>你可以在 <a href="https://github.com/tc39/ecma262">tc39/ecma262</a> 这个仓库中看见当前的规范草案。</p> - -<p><a href="https://mail.mozilla.org/listinfo/es-discuss">es-discuss</a> 是一个关于 ECMAScript 标准有关反馈的渠道。</p> - -<h2 id="ECMAScript_2016">ECMAScript 2016</h2> - -<p>下面的 ECMAScript 2016 特性已实现:</p> - -<p> </p> - -<ul> - <li>{{jsxref("Array.prototype.includes()")}} (Firefox 43)</li> - <li>{{jsxref("TypedArray.prototype.includes()")}} (Firefox 43)</li> -</ul> - -<h2 id="ECMAScript_2017">ECMAScript 2017</h2> - -<p>下面的 ECMAScript 2017 特性已实现:</p> - -<p> </p> - -<ul> - <li>{{jsxref("Object.values()")}} 和 {{jsxref("Object.entries()")}} (Firefox 47)</li> - <li>{{jsxref("String.prototype.padEnd()")}} (Firefox 48)</li> - <li>{{jsxref("String.prototype.padStart()")}} (Firefox 48)</li> - <li>{{jsxref("Object.getOwnPropertyDescriptors()")}} (Firefox 50)</li> - <li>异步函数 - <ul> - <li>{{jsxref("Statements/async_function", "异步函数语句")}} (Firefox 52)</li> - <li>{{jsxref("Operators/async_function", "异步函数表达式")}} (Firefox 52)</li> - <li>{{jsxref("AsyncFunction")}} (Firefox 52)</li> - <li>{{jsxref("Operators/await", "await 语句")}} (Firefox 52)</li> - </ul> - </li> - <li>{{jsxref("Trailing_commas", "函数参数列表的尾后逗号")}} (Firefox 52)</li> -</ul> - -<h2 id="实验性的新特性">实验性的新特性</h2> - -<p>以下特性已经实现,但可能仅在 Firefox Nightly 中可用、或者需要浏览器 flags 开启;且此提案的标准可能尚未正式进入 ECMAScript 规范,请小心使用。</p> - -<h3 id="ArrayBuffer_对象的新方法"><code>ArrayBuffer</code> 对象的新方法</h3> - -<ul> - <li>{{jsxref("ArrayBuffer.transfer()")}} (<a href="https://gist.github.com/lukewagner/2735af7eea411e18cf20">spec</a>)</li> -</ul> - -<h3 id="新的_TypedObject_对象">新的 TypedObject 对象</h3> - -<ul> - <li><a href="https://github.com/dslomov-chromium/typed-objects-es7">Typed Objects draft</a></li> -</ul> - -<h3 id="新的_Shared_Memory_对象">新的 Shared Memory 对象</h3> - -<ul> - <li>{{jsxref("SharedArrayBuffer")}}</li> - <li>{{jsxref("Atomics")}}</li> -</ul> - -<h2 id="相关链接">相关链接</h2> - -<ul> - <li><a href="http://www.ecmascript.org/">ECMAScript 官网</a></li> - <li><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1021376">Mozilla ES2016 tracking bug</a></li> - <li><a href="http://kangax.github.io/compat-table/es7/" title="http://kangax.github.io/es5-compat-table">ECMAScript 2015 support across browsers</a></li> -</ul> diff --git a/files/zh-cn/web/javascript/new_in_javascript/1.1/index.html b/files/zh-cn/web/javascript/new_in_javascript/1.1/index.html deleted file mode 100644 index 968f518145..0000000000 --- a/files/zh-cn/web/javascript/new_in_javascript/1.1/index.html +++ /dev/null @@ -1,71 +0,0 @@ ---- -title: JavaScript 1.1的新特性 -slug: Web/JavaScript/New_in_JavaScript/1.1 -translation_of: Archive/Web/JavaScript/New_in_JavaScript/1.1 ---- -<div>{{jsSidebar("New_in_JS")}}</div> - -<p>下面介绍的是JavaScript从Netscape Navigator 2.0到3.0的更新日志。旧的Netscape文档请参考<a href="https://web.archive.org/web/20060318153542/wp.netscape.com/eng/mozilla/3.0/handbook/javascript/index.html">"第1版之后新增的特性"</a>。Netscape Navigator 3.0在1996年8月19发布,是支持JavaScript的浏览器的第二个主要的版本。</p> - -<h2 id="JavaScript_版本">JavaScript 版本</h2> - -<p>Netscape Navigator 3.0 也引进了JavaScript语言的版本号。</p> - -<pre class="brush: html"><SCRIPT LANGUAGE="JavaScript"> <!-- JavaScript for Navigator 2.0. --> -<SCRIPT LANGUAGE="JavaScript1.1"> <!-- JavaScript for Navigator 3.0. --></pre> - -<h2 id="JavaScript_1.1_新特性">JavaScript 1.1 新特性</h2> - -<h3 id="新增的对象">新增的对象</h3> - -<ul> - <li>{{jsxref("Array")}}</li> - <li>{{jsxref("Boolean")}}</li> - <li>{{jsxref("Function")}}</li> - <li>{{jsxref("Number")}}</li> -</ul> - -<h3 id="新增的属性">新增的属性</h3> - -<ul> - <li>{{jsxref("Number.MAX_VALUE")}}</li> - <li>{{jsxref("Number.MIN_VALUE")}}</li> - <li>{{jsxref("NaN")}}</li> - <li>{{jsxref("Number.NEGATIVE_INFINITY")}}</li> - <li>{{jsxref("Number.POSITIVE_INFINITY")}}</li> -</ul> - -<h3 id="新增的方法">新增的方法</h3> - -<ul> - <li>{{jsxref("Array.prototype.join()")}}</li> - <li>{{jsxref("Array.prototype.reverse()")}}</li> - <li>{{jsxref("Array.prototype.sort()")}}</li> - <li>{{jsxref("Array.prototype.split()")}}</li> -</ul> - -<h3 id="新增的操作符">新增的操作符</h3> - -<ul> - <li><code><a href="/en-US/docs/Web/JavaScript/Reference/Operators/typeof">typeof</a></code></li> - <li><code><a href="/en-US/docs/Web/JavaScript/Reference/Operators/void">void</a></code></li> -</ul> - -<h3 id="其他新特性">其他新特性</h3> - -<ul> - <li><code><a href="/en-US/docs/Web/HTML/Element/noscript"><noscript></a></code></li> - <li><a href="/en-US/docs/Archive/Web/LiveConnect">LiveConnect</a>. Java and JavaScript之间的通信.</li> -</ul> - -<h2 id="JavaScript_1.1修改的功能">JavaScript 1.1修改的功能</h2> - -<ul> - <li>“对象删除”:你可通过以设置对象的引用为null来删除一个对象。</li> - <li>增加了对象的构造函数和原型属性</li> - <li><code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval">eval()</a></code> 现在是每一个对象的方法(之前是一个内置函数),它能够在指定对象的上下文执行一个JavaScript代码的字符串。</li> - <li><code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random">Math.random()</a>现在能在所有平台上工作。</code></li> - <li><code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString">toString()</a>:新增了基数作为参数,用于指定表示数值时的进制。</code></li> - <li><code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/isNaN">isNaN()</a></code> <code>现在能在所有平台上工作。</code> (不再是只能在Unix下工作)</li> - <li><code>当<a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseFloat">parseFloat()</a></code> 和 <code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt">parseint()</a>指定的字符串(参数)的第一个字符无法转换为数字时,在所有平台都会返回NaN。(在这之前发布的版本里,在Solaris和Irix下它们会返回NaN,而在其他平台会返回0)</code></li> -</ul> diff --git a/files/zh-cn/web/javascript/new_in_javascript/1.2/index.html b/files/zh-cn/web/javascript/new_in_javascript/1.2/index.html deleted file mode 100644 index 17fde7ba38..0000000000 --- a/files/zh-cn/web/javascript/new_in_javascript/1.2/index.html +++ /dev/null @@ -1,89 +0,0 @@ ---- -title: JavaScript 1.2的新特性 -slug: Web/JavaScript/New_in_JavaScript/1.2 -translation_of: Archive/Web/JavaScript/New_in_JavaScript/1.2 ---- -<div>{{jsSidebar("New_in_JS")}}</div> - -<p>下面介绍的是JavaScript从Netscape Navigator 3.0到4.0的更新日志。旧的Netscape文档可以在<a href="https://web.archive.org/web/19971015223714/http://developer.netscape.com/library/documentation/communicator/jsguide/js1_2.htm">archive.org</a>上面找到。Netscape Navigator 4.0在1997年6月11日发布,它是是支持JavaScript的浏览器的第三个主要的版本。</p> - -<h2 id="JavaScript_版本">JavaScript 版本</h2> - -<p>Netscape Navigator 4.0将JavaScript语言的版本升到1.2。需要注意的是,Netscape Navigator 3.0以及更早的版本忽略了设置为"JavaScript 1.2"和更高的版本的脚本语言属性。</p> - -<pre class="brush: html"><SCRIPT LANGUAGE="JavaScript1.1"> <!-- JavaScript for Navigator 3.0. --> -<SCRIPT LANGUAGE="JavaScript1.2"> <!-- JavaScript for Navigator 4.0. --></pre> - -<h2 id="JavaScript_1.2新特性">JavaScript 1.2新特性</h2> - -<h3 id="新增的对象">新增的对象</h3> - -<ul> - <li>可以使用简明的字面记号来创建对象。(灵感来自Python 1.x的dictionary的简明语法)</li> - <li>数字也可以使用简明的字面记号来创建。(灵感来自Python 1.x的字list的简明语法)</li> - <li><a href="/en-US/docs/Web/JavaScript/Reference/Functions_and_function_scope/arguments">arguments</a></li> -</ul> - -<h3 id="新增的属性">新增的属性</h3> - -<ul> - <li>{{jsxref("Function.arity")}}</li> -</ul> - -<h3 id="新增的方法">新增的方法</h3> - -<ul> - <li>{{jsxref("Array.prototype.concat()")}}</li> - <li>{{jsxref("Array.prototype.slice()")}}</li> - <li>{{jsxref("String.prototype.charCodeAt()")}}</li> - <li>{{jsxref("String.prototype.concat()")}}</li> - <li>{{jsxref("String.fromCharCode()")}}</li> - <li>{{jsxref("String.prototype.match()")}}</li> - <li>{{jsxref("String.prototype.replace()")}}</li> - <li>{{jsxref("String.prototype.search()")}}</li> - <li>{{jsxref("String.prototype.slice()")}}</li> - <li>{{jsxref("String.prototype.substr()")}}</li> -</ul> - -<h3 id="新增的操作符">新增的操作符</h3> - -<ul> - <li><a href="/en-US/docs/Web/JavaScript/Reference/Operators/delete"><code>delete</code></a></li> - <li><a href="/en-US/docs/Web/JavaScript/Equality_comparisons_and_when_to_use_them">Equality operators</a> (<code>==</code> and <code>!=</code>)</li> -</ul> - -<h3 id="新增的语句">新增的语句</h3> - -<ul> - <li><a href="/en-US/docs/Web/JavaScript/Reference/Statements/label">Labeled</a> 语句</li> - <li><a href="/en-US/docs/Web/JavaScript/Reference/Statements/switch"><code>switch</code></a></li> - <li><a href="/en-US/docs/Web/JavaScript/Reference/Statements/do...while"><code>do...while</code></a></li> - <li><a href="/en-US/docs/Web/JavaScript/Reference/Statements/import"><code>import</code></a></li> - <li><a href="/en-US/docs/Web/JavaScript/Reference/Statements/export"><code>export</code></a></li> -</ul> - -<h3 id="其他新特性">其他新特性</h3> - -<ul> - <li><a href="/en-US/docs/Web/JavaScript/Guide/Regular_Expressions">Regular Expressions</a></li> - <li><a href="https://web.archive.org/web/19971015223714/http://developer.netscape.com/library/documentation/communicator/jsguide/js1_2.htm">Signed scripts</a></li> -</ul> - -<h2 id="JavaScript_1.2修改的功能">JavaScript 1.2修改的功能</h2> - -<ul> - <li>现在你可以在函数内部嵌套函数。</li> - <li>Number现在可以将指定的对象转换为数字。</li> - <li>如果x是一个不包含格式良好的数字字面的字符串,Number将会生成一个NaN而不是一个错误。</li> - <li>Stirng现在可以将指定的对象转换为字符串。</li> - <li>{{jsxref("Array.prototype.sort()")}} 现在能在所有平台上工作。它不会再将未定义的元素转换为null并且排序到数组最大的位置。</li> - <li>{{jsxref("String.prototype.split()")}} - <ul> - <li>它即可以带一个确定的字符串参数去分割目标字符串,也可以带一个正则表达式参数。</li> - <li>它可以带一个限制的数量,这样可以让最终的结果数组不再包含在这之后的空元素。</li> - </ul> - </li> - <li>{{jsxref("String.prototype.substring()")}}: 不再要求第二个索引值大于第一个。</li> - <li><code>toString()</code>: 现在可以把对象或者数组转换为文字。</li> - <li><a href="/en-US/docs/Web/JavaScript/Reference/Statements/break"><code>break</code></a> 和<a href="/en-US/docs/Web/JavaScript/Reference/Statements/continue"><code>continue</code></a> 语句现在可以在带标签的语句中使用。</li> -</ul> diff --git a/files/zh-cn/web/javascript/new_in_javascript/1.3/index.html b/files/zh-cn/web/javascript/new_in_javascript/1.3/index.html deleted file mode 100644 index 193d5156d8..0000000000 --- a/files/zh-cn/web/javascript/new_in_javascript/1.3/index.html +++ /dev/null @@ -1,138 +0,0 @@ ---- -title: JavaScript 1.3的新特性 -slug: Web/JavaScript/New_in_JavaScript/1.3 -translation_of: Archive/Web/JavaScript/New_in_JavaScript/1.3 ---- -<div>{{jsSidebar("New_in_JS")}}</div> - -<p>下面介绍的是JavaScript从Netscape Navigator 4.0到4.5的更新日志。旧的Netscape文档可以在<a href="https://web.archive.org/web/20000815081640/http://developer.netscape.com/docs/manuals/communicator/jsref/js13.html">archive.org</a>上面找到。Netscape Navigator 4.5是在1998年10月19日发布的。</p> - -<p>JavaScript 1.3 最显著的变化是通过消除JavaScript1.2和1997年6月发布的新ECMA标准的不一致性来遵守ECMA-262和Unicode。JavaScript 1.2附加的特性,在ECMA-262的规定外还保留在JavaScript语言(见下面的列表中的差异)。</p> - -<h2 id="JavaScript_版本">JavaScript 版本</h2> - -<p>Netscape Navigator 4.06 到 4.5 将JavaScript语言的版本升到1.3。需要注意的是,Netscape Navigator 4.0 到 4.05以及更早的版本忽略了设置为"JavaScript 1.3"和更高的版本的脚本语言属性。</p> - -<pre class="brush: html"><SCRIPT LANGUAGE="JavaScript1.2"> <!-- JavaScript for Navigator 4.0. --> -<SCRIPT LANGUAGE="JavaScript1.3"> <!-- JavaScript for Navigator 4.5. --></pre> - -<h2 id="JavaScript_1.3新特性">JavaScript 1.3新特性</h2> - -<h3 id="新增的全局变量">新增的全局变量</h3> - -<ul> - <li>{{jsxref("NaN")}}</li> - <li>{{jsxref("Infinity")}}</li> - <li>{{jsxref("undefined")}}</li> -</ul> - -<h3 id="新增的方法">新增的方法</h3> - -<ul> - <li><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/isFinite"><code>isFinite()</code></a></li> - <li>{{jsxref("Function.prototype.call()")}}</li> - <li>{{jsxref("Function.prototype.apply()")}}</li> - <li>{{jsxref("Date.UTC()")}}</li> - <li>{{jsxref("Date.prototype.getFullYear()")}}</li> - <li>{{jsxref("Date.prototype.setFullYear()")}}</li> - <li>{{jsxref("Date.prototype.getMilliseconds()")}}</li> - <li>{{jsxref("Date.prototype.setMilliseconds()")}}</li> - <li>{{jsxref("Date.prototype.getUTCFullYear()")}}</li> - <li>{{jsxref("Date.prototype.getUTCMonth()")}}</li> - <li>{{jsxref("Date.prototype.getUTCDate()")}}</li> - <li>{{jsxref("Date.prototype.getUTCHours()")}}</li> - <li>{{jsxref("Date.prototype.getUTCMinutes()")}}</li> - <li>{{jsxref("Date.prototype.getUTCSeconds()")}}</li> - <li>{{jsxref("Date.prototype.getUTCMilliseconds()")}}</li> - <li>{{jsxref("Date.prototype.toUTCString()")}}</li> - <li>{{jsxref("Date.prototype.setUTCFullYear()")}}</li> - <li>{{jsxref("Date.prototype.setUTCMonth()")}}</li> - <li>{{jsxref("Date.prototype.setUTCDate()")}}</li> - <li>{{jsxref("Date.prototype.setUTCHours()")}}</li> - <li>{{jsxref("Date.prototype.setUTCMinutes()")}}</li> - <li>{{jsxref("Date.prototype.setUTCSeconds()")}}</li> - <li>{{jsxref("Date.prototype.setUTCMilliseconds()")}}</li> -</ul> - -<h3 id="其他新特性">其他新特性</h3> - -<ul> - <li><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Using_the_Equality_Operators" title="JavaScript/Reference/Operators/Comparison_Operators#Using_the_Equality_Operators">严格的相等运算符</a></li> - <li>支持Unicode</li> - <li>介绍了一种JavaScript的控制台</li> -</ul> - -<h2 id="JavaScript_1.3_修改的功能">JavaScript 1.3 修改的功能</h2> - -<ul> - <li>修改 <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date" title="JavaScript/Reference/Global_Objects/Date"><code>Date</code></a> 使之符合 ECMA-262 - - <ul> - <li>新的构造函数: <code>Date(year, month, day, [,<em>hours</em> [<em>, minutes</em> [<em>, seconds</em> [<em>, milliseconds</em> ]]]])</code></li> - <li>附加的方法参数 - <ul> - <li><code>setMonth(month[, date])</code></li> - <li><code>setHours(hours[, min[, sec[, ms]]])</code></li> - <li><code>setMinutes(min[, sec[, ms]])</code></li> - <li><code>setSeconds(sec[, ms])</code></li> - </ul> - </li> - </ul> - </li> - <li>数组的长度(属性的长度)现在类型为32位 unsigned 整型。</li> - <li>{{jsxref("Array.prototype.push()")}}: 在JavaScript 1.2中, <code>push</code> 方法返回最后一个被添加到数组的元素。在JavaScript 1.3下, <code>push</code> 返回数组新的长度。</li> - <li>{{jsxref("Array.prototype.slice()")}}: 在JavaScript 1.2中, 如果只有一个元素被移除(<code>howMany 参数为1<font face="Open Sans, Arial, sans-serif">,</font>splice方法返回被移除的元素。而在JavaScript 1.3,splice方法通常返回一个包含被删除的元素的数组。如果只有一个元素被移除,则返回一个只包含一个元素的数组。</code></li> - <li>{{jsxref("String.prototype.replace()")}}的<a href="https://web.archive.org/web/20000815081640/http://developer.netscape.com/docs/manuals/communicator/jsref/js13.html#replace">变化</a>。</li> - <li>{{jsxref("Boolean")}} 对象的<a href="https://web.archive.org/web/20000815081640/http://developer.netscape.com/docs/manuals/communicator/jsref/js13.html#Boolean">变化</a>。</li> - <li><code>toString()的</code><a href="https://web.archive.org/web/20000815081640/http://developer.netscape.com/docs/manuals/communicator/jsref/js13.html#toString">变化</a>。</li> -</ul> - -<h2 id="非ECMA-262规范的JavaScript_1.3特性">非ECMA-262规范的JavaScript 1.3特性</h2> - -<p>下面是关于1998年6月的ECMA-262版本和JavaScript 1.3之间的比较。下面的特性不是当时的标准的一部分,但是在JavaScript 1.3里面实施了。</p> - -<h3 id="关键字和操作符">关键字和操作符</h3> - -<ul> - <li><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Using_the_Equality_Operators" title="JavaScript/Reference/Operators/Comparison_Operators#Using_the_Equality_Operators">严格的相等运算符</a></li> - <li>垂直制表符(\ v或\ u000B)转义序列。</li> -</ul> - -<h3 id="语句">语句</h3> - -<ul> - <li><a href="/en-US/docs/Web/JavaScript/Reference/Statements/label"><code>label</code></a></li> - <li><a href="/en-US/docs/Web/JavaScript/Reference/Statements/switch"><code>switch</code></a></li> - <li><a href="/en-US/docs/Web/JavaScript/Reference/Statements/do...while"><code>do...while</code></a></li> - <li><a href="/en-US/docs/Web/JavaScript/Reference/Statements/export"><code>export</code></a></li> - <li><a href="/en-US/docs/Web/JavaScript/Reference/Statements/import"><code>import</code></a></li> -</ul> - -<h3 id="内置对象">内置对象</h3> - -<ul> - <li>{{jsxref("RegExp")}}</li> -</ul> - -<h3 id="内置对象的方向">内置对象的方向</h3> - -<ul> - <li><code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toSource">toSource()</a></code></li> - <li>{{jsxref("Object.prototype.watch()")}}</li> - <li>{{jsxref("Object.prototype.unwatch()")}}</li> - <li>{{jsxref("Function.arity")}}</li> - <li>{{jsxref("Function.prototype.apply()")}}</li> - <li>{{jsxref("Function.prototype.call()")}}</li> - <li>{{jsxref("Array.prototype.concat()")}}</li> - <li>{{jsxref("Array.prototype.pop()")}}</li> - <li>{{jsxref("Array.prototype.push()")}}</li> - <li>{{jsxref("Array.prototype.shift()")}}</li> - <li>{{jsxref("Array.prototype.slice()")}}</li> - <li>{{jsxref("Array.prototype.splice()")}}</li> - <li>{{jsxref("String.prototype.concat()")}}</li> - <li>{{jsxref("String.prototype.concat()")}}</li> - <li>{{jsxref("String.prototype.match()")}}</li> - <li>{{jsxref("String.prototype.search()")}}</li> - <li>{{jsxref("String.prototype.slice()")}}</li> - <li>{{jsxref("String.prototype.substr()")}}</li> -</ul> diff --git a/files/zh-cn/web/javascript/new_in_javascript/1.4/index.html b/files/zh-cn/web/javascript/new_in_javascript/1.4/index.html deleted file mode 100644 index a76c4f5424..0000000000 --- a/files/zh-cn/web/javascript/new_in_javascript/1.4/index.html +++ /dev/null @@ -1,25 +0,0 @@ ---- -title: JavaScript 1.4的新特性 -slug: Web/JavaScript/New_in_JavaScript/1.4 -translation_of: Archive/Web/JavaScript/New_in_JavaScript/1.4 ---- -<div>{{jsSidebar("New_in_JS")}}</div> - -<p>下面是 JavaScript 1.4 的更新记录,它只可用于 1999 年发布的 Netscape 服务端 JavaScript。 旧的 Netscape 文档可在 <a href="https://web.archive.org/web/20040802225238/http://developer.netscape.com/docs/manuals/js/core/jsref/index.htm">archive.org</a> 找到。</p> - -<h2 id="JavaScript_1.4的新特性">JavaScript 1.4的新特性</h2> - -<ul> - <li>异常处理 (<a href="/en-US/docs/Web/JavaScript/Reference/Statements/throw"><code>throw</code></a> 和 <a href="/en-US/docs/Web/JavaScript/Reference/Statements/try...catch"><code>try...catch</code></a>)</li> - <li><code><a href="/en-US/docs/Web/JavaScript/Reference/Operators/in">in</a></code> 运算符</li> - <li><a href="/en-US/docs/Web/JavaScript/Reference/Operators/instanceof"><code>instanceof</code></a> 运算符</li> -</ul> - -<h2 id="JavaScript_1.4的功能改动">JavaScript 1.4的功能改动</h2> - -<ul> - <li><code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval" title="JavaScript/Reference/Global_Functions/Eval">eval()</a></code> 的改动 (不能被间接唤起,也不再是Object的一个方法)</li> - <li><code><a href="/en-US/docs/Web/JavaScript/Reference/Functions_and_function_scope/arguments" title="JavaScript/Reference/Functions/arguments">arguments</a></code> 不再是函数的属性</li> - <li>废除了 {{jsxref("Function.arity")}} 以支持 {{jsxref("Function.length")}}</li> - <li><a href="/en-US/docs/Archive/Web/LiveConnect">LiveConnect</a> 的改动</li> -</ul> diff --git a/files/zh-cn/web/javascript/new_in_javascript/1.5/index.html b/files/zh-cn/web/javascript/new_in_javascript/1.5/index.html deleted file mode 100644 index 0375ad3f7f..0000000000 --- a/files/zh-cn/web/javascript/new_in_javascript/1.5/index.html +++ /dev/null @@ -1,42 +0,0 @@ ---- -title: JavaScript 1.5 的新特性 -slug: Web/JavaScript/New_in_JavaScript/1.5 -tags: - - JavaScript - - 版本 -translation_of: Archive/Web/JavaScript/New_in_JavaScript/1.5 ---- -<div>{{jsSidebar("New_in_JS")}}</div> - -<p>以下为JavaScript 1.5 的更新日志。该版本包含在发行于2000年11月14日的Netscape Navigator 6.0中,也在后续的的Netscape Navigator版本和Firefox 1.0中使用。你可以拿JavaScript 1.5 和JScript version 5.5,Internet Explorer 5.5进行比较,后者发行于2000年7月。相应的ECMA 标准是 ECMA-262 Edition 3版 (自1999年12月)。</p> - -<h2 id="JavaScript_1.5_新特性" style="margin-bottom: 20px; line-height: 30px; font-size: 2.14285714285714rem;">JavaScript 1.5 新特性</h2> - -<ul> - <li>{{jsxref("Number.prototype.toExponential()")}}</li> - <li>{{jsxref("Number.prototype.toFixed()")}}</li> - <li>{{jsxref("Number.prototype.toPrecision()")}}</li> - <li><a href="https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Statements/const"><code>const</code></a></li> - <li><a href="https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Statements/try...catch"><code>try...catch</code></a> 语句中支持多个catch语句。</li> - <li>JavaScript 开发者可以为对象添加getter和setter。</li> -</ul> - -<h2 id="JavaScript_1.5_功能变化" style="margin-bottom: 20px; line-height: 30px; font-size: 2.14285714285714rem;">JavaScript 1.5 功能变化</h2> - -<ul> - <li>运行时错误现在作为异常报告。</li> - <li>正则表达式变化: - <ul> - <li>数量修饰符 — +, *, ? 和 {} — 现在可以跟在 ? 后强行使其变为非贪婪模式。</li> - <li>"非捕获括号 "(?:x) 可以用来代替“捕获括号” (x)。当使用非捕获括号的时候反向引用不可用。</li> - <li>支持正负向零宽断言。它们都会根据紧跟着字符串的内容进行断言。</li> - <li>添加m标记说明正则表达式可以匹配多行。</li> - </ul> - </li> - <li>函数可以在if语句中声明。</li> - <li> - <p>函数可以在表达式中声明。</p> - </li> -</ul> - -<p> </p> diff --git a/files/zh-cn/web/javascript/new_in_javascript/1.6/index.html b/files/zh-cn/web/javascript/new_in_javascript/1.6/index.html deleted file mode 100644 index 928fd75334..0000000000 --- a/files/zh-cn/web/javascript/new_in_javascript/1.6/index.html +++ /dev/null @@ -1,35 +0,0 @@ ---- -title: JavaScript 1.6 的新特性 -slug: Web/JavaScript/New_in_JavaScript/1.6 -tags: - - JavaScript - - 版本 -translation_of: Archive/Web/JavaScript/New_in_JavaScript/1.6 ---- -<div class="boxed translate-rendered"> -<div>{{jsSidebar("New_in_JS")}}</div> - -<p class="ordinary-output target-output"><span>以下是JavaScript 1.6的更新日志。JavaScript 1.6已经被包含在2005年11月发布的</span>Firefox 1.5 (Gecko 1.8)中。<span>JavaScript 1.6相对应的</span>ECMA标准是ECMA-262第3版和ECMAScript for XML (E4X),这让它拥有了一些额外的特性 。引入了一些新特性:E4X,<span style="line-height: inherit;">几个新的数组方法,还</span><span style="line-height: inherit;">有</span><span style="line-height: inherit;">数组</span>和<span style="line-height: inherit;">字符串</span><span style="line-height: inherit;">的通用接口(generics)</span>。</p> - -<h2 id="JavaScript_1.6新特性">JavaScript 1.6新特性</h2> - -<ul> - <li>使用<a href="https://developer.mozilla.org/zh-CN/docs/Web/JavaScript" title="JavaScript">JavaScript</a>创建和处理<a href="https://developer.mozilla.org/zh-CN/docs/Glossary/XML" title="XML">XML</a>内容的ECMAScript for XML (<a href="https://developer.mozilla.org/zh-CN/docs/Archive/Web/E4X" title="E4X">E4X</a>) 的支持文档已经添加。 更多详情:<a href="https://developer.mozilla.org/zh-CN/docs/Archive/Web/E4X/Processing_XML_with_E4X" title="E4X/Processing_XML_with_E4X">使用E4X处理XML</a>。</li> - <li><a href="https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf"><code>Array.prototype.indexOf()</code></a></li> - <li><a href="https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf"><code>Array.prototype.lastIndexOf()</code></a></li> - <li><a href="https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/every"><code>Array.prototype.every()</code></a></li> - <li><a href="https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/filter"><code>Array.prototype.filter()</code></a></li> - <li><a href="https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach"><code>Array.prototype.forEach()</code></a></li> - <li><a href="https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/map"><code>Array.prototype.map()</code></a></li> - <li><a href="https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/some"><code>Array.prototype.some()</code></a></li> - <li><a href="https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array#Array_generic_methods" title="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array#Array_generics">Array generics</a></li> - <li><a href="https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/String#String_generic_methods" title="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String#String_generics">String generics</a></li> - <li><a href="https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Statements/for_each...in"><code>for each...in</code></a></li> -</ul> - -<h2 id="JavaScript_1.6功能变化">JavaScript 1.6功能变化</h2> - -<ul> - <li>产生了一个<a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=292215">bug</a>,当形参或实参的数量已经固定了,若 <a href="https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Functions/arguments"><code>arguments[n]</code></a> 中的n大于这个数量,就不能被设置。</li> -</ul> -</div> diff --git a/files/zh-cn/web/javascript/new_in_javascript/1.7/index.html b/files/zh-cn/web/javascript/new_in_javascript/1.7/index.html deleted file mode 100644 index e268345ca5..0000000000 --- a/files/zh-cn/web/javascript/new_in_javascript/1.7/index.html +++ /dev/null @@ -1,40 +0,0 @@ ---- -title: JavaScript 1.7 的新特性 -slug: Web/JavaScript/New_in_JavaScript/1.7 -translation_of: Archive/Web/JavaScript/New_in_JavaScript/1.7 ---- -<div>{{jsSidebar("New_in_JS")}}</div> - -<div> </div> - -<div>以下是javaScript 1.7版本的更新日志,这个版本被包括在 <a href="/en-US/Firefox/Releases/2">Firefox 2</a> (2006年10月)。</div> - -<p> </p> - -<p>JavaScript 1.7是一个引出了一些新特性的语言更新,尤其是generator,iterator,数组推导式, <code>let</code> 表达式和解构赋值。</p> - -<h2 id="使用_JavaScript_1.7">使用 JavaScript 1.7</h2> - -<p>为了使用 JavaScript 1.7的一些新特性,你需要明确指出你希望使用 JavaScript 1.7。在HTML 或XUL code中,使用:</p> - -<pre class="brush: html"><code><script type="application/javascript;version=1.7"></script></code> -</pre> - -<p>当使用 <a href="/en-US/docs/Mozilla/Projects/SpiderMonkey/Introduction_to_the_JavaScript_shell" title="en-US/docs/Introduction_to_the_JavaScript_shell">JavaScript shell</a>的时候,你需要用 <code>-version 170</code> 开启命令行或者用<code>version()</code> 函数来设置你想使用的JavaScript版本。</p> - -<pre class="brush:js">version(170); -</pre> - -<p>你需要指定1.7版本来使用新的“yield”和“let”关键字,因为现存的代码可能用它们当变量或者函数名用。没有涉及到新关键词的特性(比如解构赋值和数组推导式)可以直接使用,而不需要指明JavaScript版本。</p> - -<h2 id="JavaScript_1.7的新特性">JavaScript 1.7的新特性</h2> - -<p>以下JavaScript 1.7的新特性目前还不是ECMA-262标准的一部分。在最近的Firefox版本中会根据ECMAScipt6中的描述来实现这些功能。具体内容见这些参考页面。</p> - -<ul> - <li><a href="/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators">Iterators and generators</a></li> - <li><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Array_comprehensions#Differences_to_the_older_JS1.7.2FJS1.8_comprehensions">Array comprehensions</a></li> - <li><a href="/en-US/docs/Web/JavaScript/Reference/Statements/let"><code>let</code> 声明</a>(Gecko 41中抛弃了 <code>let</code> 声明,见 {{bug(1023609)}})</li> - <li><a href="https://developer.mozilla.org/en-US/docs/const">const 声明</a></li> - <li><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment">解构赋值</a>(Gecko 40中不再支持JS1.7风格的for-in解构,见{{bug(1083498)}})</li> -</ul> diff --git a/files/zh-cn/web/javascript/new_in_javascript/1.8.1/index.html b/files/zh-cn/web/javascript/new_in_javascript/1.8.1/index.html deleted file mode 100644 index 9ca99c06af..0000000000 --- a/files/zh-cn/web/javascript/new_in_javascript/1.8.1/index.html +++ /dev/null @@ -1,29 +0,0 @@ ---- -title: JavaScript 1.8.1 的新特性 -slug: Web/JavaScript/New_in_JavaScript/1.8.1 -tags: - - Firefox 3.5 -translation_of: Archive/Web/JavaScript/New_in_JavaScript/1.8.1 ---- -<div>{{jsSidebar("New_in_JS")}}</div> - -<p>下面是JavaScript 1.8.1 的更新内容. 该版本已包含在 <a href="/en-US/Firefox/Releases/3.5">Firefox 3.5</a> 中.</p> - -<p>JavaScript 1.8.1 是在语义上有适度更新的版本; 其主要更新是添加能够提升性能的<a href="/zh-CN/docs/SpiderMonkey/Internals/Tracing_JIT" title="SpiderMonkey/Internals/Tracing JIT">Tracemonkey即时编译器</a>。</p> - -<h2 id="JavaScript_1.8.1_新特性">JavaScript 1.8.1 新特性</h2> - -<ul> - <li><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getPrototypeOf"><code>Object.getPrototypeOf()</code></a></li> - <li><a href="/en-US/docs/Web/JavaScript/Guide/Using_native_JSON">原生支持 JSON</a></li> - <li><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim"><code>String.prototype.trim()</code></a></li> - <li><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/TrimLeft"><code>String.prototype.trimLeft()</code></a></li> - <li><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/TrimRight"><code>String.prototype.trimRight()</code></a></li> - <li><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith"><code>String.prototype.startsWith()</code></a></li> -</ul> - -<h2 id="JavaScript_1.8.1_功能更新">JavaScript 1.8.1 功能更新</h2> - -<ul> - <li>对象和数组初始化器中的属性隐式设置不再在 JavaScript 中执行 setter。 这使得设置属性值的行为更具可预测性。</li> -</ul> diff --git a/files/zh-cn/web/javascript/new_in_javascript/1.8.5/index.html b/files/zh-cn/web/javascript/new_in_javascript/1.8.5/index.html deleted file mode 100644 index a61a892e70..0000000000 --- a/files/zh-cn/web/javascript/new_in_javascript/1.8.5/index.html +++ /dev/null @@ -1,122 +0,0 @@ ---- -title: JavaScript 1.8.5 的新特性 -slug: Web/JavaScript/New_in_JavaScript/1.8.5 -translation_of: Archive/Web/JavaScript/New_in_JavaScript/1.8.5 ---- -<div>{{jsSidebar("New_in_JS")}}</div> - -<p>下面的内容是JavaScript 1.8.5的更新记录. 该版本已包含在<a href="/en-US/Firefox/Releases/4">Firefox 4</a>中.</p> - -<h2 id="JavaScript_1.8.5的新特性">JavaScript 1.8.5的新特性</h2> - -<h3 id="新函数">新函数</h3> - -<table class="standard-table"> - <thead> - <tr> - <th scope="col">Function</th> - <th scope="col">Description</th> - </tr> - </thead> - <tbody> - <tr> - <td><code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create" title="JavaScript/Reference/Global Objects/Object/Create">Object.create()</a></code></td> - <td>使用指定的原型对象和属性. {{bug("492840")}}</td> - </tr> - <tr> - <td><code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty" title="JavaScript/Reference/Global Objects/Object/DefineProperty">Object.defineProperty()</a></code></td> - <td><span style="background-color: rgba(212, 221, 228, 0.14902);">为对象添加给定的描述信息的</span>属性名.</td> - </tr> - <tr> - <td><code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperties" title="JavaScript/Reference/Global Objects/Object/DefineProperties">Object.defineProperties()</a></code></td> - <td><span style="background-color: rgba(212, 221, 228, 0.14902);">为对象添加多个给定的描述信息的</span><span style="background-color: rgba(212, 221, 228, 0.14902);">属性名</span>.</td> - </tr> - <tr> - <td><code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor" title="JavaScript/Reference/Global Objects/Object/GetOwnPropertyDescriptor">Object.getOwnPropertyDescriptor()</a></code></td> - <td>返回对象的指定属性名的描述信息. {{bug("505587")}}</td> - </tr> - <tr> - <td><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys" title="JavaScript/Reference/Global Objects/Object/keys"><code>Object.keys()</code></a></td> - <td>返回由对象的所有可枚举属性组成的数组. {{bug("307791")}}</td> - </tr> - <tr> - <td><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames" title="JavaScript/Reference/Global Objects/Object/getOwnPropertyNames"><code>Object.getOwnPropertyNames()</code></a></td> - <td><span style="background-color: rgba(212, 221, 228, 0.14902);">返回由对象的所有可枚举和不可枚举属性组成的数组</span>. {{bug("518663")}}</td> - </tr> - <tr> - <td><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/preventExtensions" title="JavaScript/Reference/Global Objects/Object/preventExtensions"><code>Object.preventExtensions()</code></a></td> - <td>防止对象进行任意的扩展. {{bug("492849")}}</td> - </tr> - <tr> - <td><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isExtensible" title="JavaScript/Reference/Global Objects/Object/isExtensible"><code>Object.isExtensible()</code></a></td> - <td>判断对象是否可以扩展. {{bug("492849")}}</td> - </tr> - <tr> - <td><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/seal" title="JavaScript/Reference/Global Objects/Object/seal"><code>Object.seal()</code></a></td> - <td>防止其他代码删除对象的属性. {{bug("492845")}}</td> - </tr> - <tr> - <td><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isSealed" title="JavaScript/Reference/Global Objects/Object/isSealed"><code>Object.isSealed()</code></a></td> - <td>判断对象是否是密封<span style="background-color: rgba(212, 221, 228, 0.14902);">(即禁止删除属性)</span>的. {{bug("492845")}}</td> - </tr> - <tr> - <td><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze" title="JavaScript/Reference/Global Objects/Object/freezed"><code>Object.freeze()</code></a></td> - <td>冻结一个对象: 其他代码不能删除或修改任何属性. {{bug("492844")}}</td> - </tr> - <tr> - <td><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isFrozen" title="JavaScript/Reference/Global Objects/Object/isFrozen"><code>Object.isFrozen()</code></a></td> - <td>判断对象是否是冻结的. {{bug("492844")}}</td> - </tr> - <tr> - <td><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray" title="JavaScript/Reference/Global Objects/Array/isArray"><code>Array.isArray()</code></a></td> - <td>判断变量是否是数组. {{bug("510537")}}</td> - </tr> - <tr> - <td><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toJSON" title="JavaScript/Reference/Global Objects/Date/toJSON"><code>Date.prototype.toJSON()</code></a></td> - <td>返回一个Date对象用JSON格式化的字符串.</td> - </tr> - <tr> - <td><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind" title="JavaScript/Reference/Global_Objects/Function/bind"><code>Function.prototype.bind()</code></a></td> - <td><span style="background-color: rgba(212, 221, 228, 0.14902);">创建一个新函数,当这个函数被调用时,函数会使用提供的上下文环境(给定的字符序列) {{bug("429507")}}</span></td> - </tr> - </tbody> -</table> - -<h3 id="ECMAScript5新特性">ECMAScript5新特性</h3> - -<ul> - <li><code><a href="/en-US/docs/Web/JavaScript/Reference/Operators/get" title="JavaScript/Reference/Operators/Special Operators/get Operator">get</a></code> 和 <code><a href="/en-US/docs/Web/JavaScript/Reference/Operators/set" title="JavaScript/Reference/Operators/Special Operators/set Operator">set</a></code> 操作现在允许标识为数值或字符串. {{bug("520696")}}</li> - <li><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply" title="JavaScript/Reference/Global Objects/Function/apply"><code>Function.apply()</code></a> 能接受任意的类数组的对象作为参数列表,而不是只支持真正数组.</li> - <li><a href="/en-US/docs/Web/JavaScript/Reference/Functions_and_function_scope/Strict_mode" title="JavaScript/Strict mode">支持严格 模式</a></li> - <li><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString" title="JavaScript/Reference/Global Objects/Array/toString"><code>Array.toString()</code></a> 现在允许在非数组上使用,如果允许则会返回调用其 <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join" title="JavaScript/Reference/Global Objects/Array/join"><code>join()</code></a> 方法,否则调用 <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString" title="JavaScript/Reference/Global Objects/Object/toString"><code>toString()</code></a> 方法.</li> -</ul> - -<h3 id="其他标准化的工作">其他标准化的工作</h3> - -<p>删除一些定义getters和setters的非标准化语法; ECMAScript 5 定义的语法没有变化. 这些语法很难懂且很少被使用; 如果这个影响到你, 详细内容请看 <a class="external" href="http://whereswalden.com/2010/04/16/more-spidermonkey-changes-ancient-esoteric-very-rarely-used-syntax-for-creating-getters-and-setters-is-being-removed/" title="http://whereswalden.com/2010/04/16/more-spidermonkey-changes-ancient-esoteric-very-rarely-used-syntax-for-creating-getters-and-setters-is-being-removed/">这篇博客</a>.</p> - -<h3 id="新对象">新对象</h3> - -<table class="standard-table"> - <thead> - <tr> - <th scope="col">Object</th> - <th scope="col">Description</th> - </tr> - </thead> - <tbody> - <tr> - <td><code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy" title="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Proxy">Proxy</a></code></td> - <td>提供创建对象和函数的代理,以在Javascript中支持元编程.</td> - </tr> - </tbody> -</table> - -<h2 id="JavaScript_1.8.5中功能变化">JavaScript 1.8.5中功能变化</h2> - -<ul> - <li>ISO 8601 在Date中支持<code>: </code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date" title="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date">Date</a> 对象的 <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse" title="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/parse">parse()</a> 方法现在支持简单的ISO 8601 格式化时间字符串.</li> - <li>全局对象变为只读: 按照ECMAScript 5 标准,<a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN" title="JavaScript/Reference/Global Objects/NaN"><code>NaN</code></a>, <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Infinity" title="JavaScript/Reference/Global Objects/Infinity"><code>Infinity</code></a>, 和 <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined" title="JavaScript/Reference/Global Objects/undefined"><code>undefined</code></a> 全局对象变为只读.</li> - <li><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/Parent" title="JavaScript/Reference/Global Objects/Object/Parent"><code>obj.__parent__</code></a> and <code>obj.__count__</code> 过时. 部分原因如下:: <a class="external" href="http://whereswalden.com/2010/05/07/spidermonkey-change-du-jour-the-special-__parent__-property-has-been-removed/" title="http://whereswalden.com/2010/05/07/spidermonkey-change-du-jour-the-special-__parent__-property-has-been-removed/">SpiderMonkey change du jour: the special __parent__ property has been removed</a> {{bug("551529")}} & {{bug("552560")}}.</li> - <li><code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse" title="Using native JSON">JSON.parse()</a>不再支持逗号结尾</code>.</li> -</ul> diff --git a/files/zh-cn/web/javascript/new_in_javascript/1.8/index.html b/files/zh-cn/web/javascript/new_in_javascript/1.8/index.html deleted file mode 100644 index d69d021c25..0000000000 --- a/files/zh-cn/web/javascript/new_in_javascript/1.8/index.html +++ /dev/null @@ -1,39 +0,0 @@ ---- -title: New in JavaScript 1.8 -slug: Web/JavaScript/New_in_JavaScript/1.8 -tags: - - JavaScript - - 版本 -translation_of: Archive/Web/JavaScript/New_in_JavaScript/1.8 ---- -<div>{{jsSidebar("New_in_JS")}}</div> - -<p>以下为JavaScript 1.8的更新日志。JavaScript 1.8 是 Gecko 1.9(已合并在 <a href="/cn/Firefox_3" title="cn/Firefox_3">Firefox 3</a> 中)的一部分。参见 {{ Bug("380236") }} 以跟踪 JavaScript 1.8。</p> - -<h3 id=".E4.BD.BF.E7.94.A8_JavaScript_1.8" name=".E4.BD.BF.E7.94.A8_JavaScript_1.8">使用 JavaScript 1.8</h3> - -<p>为了可以在 HTML 中使用 JavaScript 1.8 的新特性,需要这样写:</p> - -<pre class="eval"> <script type="application/javascript;version=1.8"> ... 你的代码 ... </script> -</pre> - -<p>另一种方法(不推荐)是使用旧式的 <script> 属性 language,把它定义为 "JavaScript1.8"。</p> - -<p>在使用 <a href="https://developer.mozilla.org/zh-CN/docs/Mozilla/Projects/SpiderMonkey/Introduction_to_the_JavaScript_shell" title="Cn/Introduction_to_the_JavaScript_shell">JavaScript shell</a> 、JavaScript XPCOM 组件,或者 XUL <code><script></code> 元素的时候,将自动启用最新的JS版本(Mozilla 1.9中的 JS1.8)({{ Bug("381031") }}, {{ Bug("385159") }})。</p> - -<p>如果需要使用新的关键字 "yield" 和 "let",你需要指定是1.7版本或者更高的版本,因为现有的代码可能会把这两个关键字用作变量名或者函数名。如果要使用的新特性没有引入任何新的关键字(例如生成器表达式),就可以不指定 JavaScript 的版本。</p> - -<h2 id="JavaScript_1.8新特性">JavaScript 1.8新特性</h2> - -<ul> - <li>{{jsxref("Operators/Expression_Closures", "Expression Closures", "", 1)}}.</li> - <li><a href="/zh-CN/docs/Web/JavaScript/Guide/Iterators_and_Generators">生成器表达式</a>。生成器表达式可以让你方便地创建生成器(在JavaScript1.7中引入)。通常你需要创建一个内含yield的自定义函数来得到一个生成器,而生成器表达式可以让你使用类似数组的语法来达到同样的目的。</li> - <li><a href="https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce"><code>Array.prototype.reduce()</code></a></li> - <li><a href="https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/ReduceRight"><code>Array.prototype.reduceRight()</code></a></li> -</ul> - -<h2 id="JavaScript_1.8功能更新">JavaScript 1.8功能更新</h2> - -<h3 id="对for..in解构的修改"><code>对for..in解构的修改</code></h3> - -<p>JavaScript1.8中的一个修改是对JavaScript1.7中引入的数组键值结构相关的bug修复。之前可以用<code>for ( var [key, value] in array )的方式来解构一个数组的键值。但是,这也让对数组的数组的键值解构变得不可能(比如一个迭代器返回一个当前键值对的数组)。现在这个问题可以用for ( var [key, value] in Iterator(array))来解决</code>({{ Bug("366941") }})。</p> diff --git a/files/zh-cn/web/javascript/new_in_javascript/ecmascript_5_support_in_mozilla/index.html b/files/zh-cn/web/javascript/new_in_javascript/ecmascript_5_support_in_mozilla/index.html deleted file mode 100644 index 2dc69205cb..0000000000 --- a/files/zh-cn/web/javascript/new_in_javascript/ecmascript_5_support_in_mozilla/index.html +++ /dev/null @@ -1,41 +0,0 @@ ---- -title: ECMAScript 5 support in Mozilla -slug: Web/JavaScript/New_in_JavaScript/ECMAScript_5_support_in_Mozilla -translation_of: Archive/Web/JavaScript/New_in_JavaScript/ECMAScript_5_support_in_Mozilla ---- -<div>{{jsSidebar("New_in_JS")}}</div> - -<p>ECMAScript 5.1, an older version of the standard upon which JavaScript is based, was approved in June 2011.</p> - -<p>The JavaScript runtime used in the latest versions of Mozilla projects including both Firefox and Thunderbird has full support for ECMAScript 5.1 features. This article covers the features supported by different versions of Mozilla's JavaScript runtime.</p> - -<h2 id="Supported_features">Supported features</h2> - -<h3 id="Added_in_JavaScript_1.8.5_(Gecko_2_Firefox_4_and_later)">Added in JavaScript 1.8.5 (Gecko 2, Firefox 4 and later)</h3> - -<p>Firefox 4 has full ECMAScript 5 support including the <code>Object.*</code> methods and strict mode. See <a href="/en-US/docs/Web/JavaScript/New_in_JavaScript/1.8.5" title="en/JavaScript/New_in_JavaScript/1.8.5">New in JavaScript 1.8.5</a>.</p> - -<h3 id="Added_in_JavaScript_1.8.1_(Gecko_1.9.1_Firefox_3.5)">Added in JavaScript 1.8.1 (Gecko 1.9.1, Firefox 3.5)</h3> - -<ul> - <li><a class="internal" href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON" title="En/Using native JSON">Native JSON</a> support</li> - <li><a class="internal" href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getPrototypeOf" title="En/Core JavaScript 1.5 Reference/Global Objects/Object/GetPrototypeOf"><code>Object.getPrototypeOf()</code></a> method.</li> - <li><a class="internal" href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim" title="En/Core JavaScript 1.5 Reference/Global Objects/String/Trim"><code>String.trim()</code></a> method, which trims whitespace from both ends of the string.</li> - <li>Gecko 1.9.1.4 updated the implementation of <a href="/en-US/docs/Web/JavaScript/Guide/Using_native_JSON#Converting_objects_into_JSON" title="En/Using native JSON#Converting objects into JSON"><code>JSON.stringify()</code></a> to be compliant with ECMAScript 5.</li> -</ul> - -<p>Improvements laid out by ECMAScript 5 have been made in the parsing algorithm that prevents evaluating XHTML as JavaScript code in certain circumstances.</p> - -<h3 id="Added_in_JavaScript_1.6_(Gecko_1.8_Firefox_1.5)">Added in JavaScript 1.6 (Gecko 1.8, Firefox 1.5)</h3> - -<p>New <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array"><code>Array</code></a> methods offering several improved methods for manipulating arrays -- have been part of JavaScript since<a href="/en-US/docs/Web/JavaScript/New_in_JavaScript/1.6"> JavaScript 1.6</a>. Now they've been standardized as part of ECMAScript 5.</p> - -<h2 id="See_also">See also</h2> - -<ul> - <li><a class="external" href="http://www.ecmascript.org/" title="http://www.ecmascript.org/">ECMAScript web site</a></li> - <li><a class="external" href="http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf" title="http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf">ECMAScript 5.1 specification</a></li> - <li>John Resig's post on <a class="external" href="http://ejohn.org/blog/objectgetprototypeof/" title="http://ejohn.org/blog/objectgetprototypeof/">Object.getPrototypeOf</a></li> - <li>Michael J. Ryan's implementation of <a class="external" href="http://frugalcoder.us/post/2010/01/07/EcmaScript-5s-Date-Extensions.aspx" title="http://frugalcoder.us/post/2010/01/07/EcmaScript-5s-Date-Extensions.aspx">ECMAScript5 Dates in JavaScript</a></li> - <li><a href="http://kangax.github.io/es5-compat-table/" title="http://kangax.github.io/es5-compat-table/">ECMAScript 5 support across browsers</a></li> -</ul> diff --git a/files/zh-cn/web/javascript/new_in_javascript/ecmascript_6_support_in_mozilla/index.html b/files/zh-cn/web/javascript/new_in_javascript/ecmascript_6_support_in_mozilla/index.html deleted file mode 100644 index 25210c32b2..0000000000 --- a/files/zh-cn/web/javascript/new_in_javascript/ecmascript_6_support_in_mozilla/index.html +++ /dev/null @@ -1,282 +0,0 @@ ---- -title: Mozilla 对 ECMAScript 6 的支持 -slug: Web/JavaScript/New_in_JavaScript/ECMAScript_6_support_in_Mozilla -tags: - - ECMAScript2015 - - ECMAScript6 - - Firefox - - JavaScript -translation_of: Archive/Web/JavaScript/New_in_JavaScript/ECMAScript_2015_support_in_Mozilla ---- -<div class="boxed translate-rendered"> -<div>{{jsSidebar("New_in_JS")}}</div> - -<p>ECMAScript 2015 (6th Edition)是目前 <span>ECMAScript 语言规范的标准</span>。通常被称为"ES2015",在<a href="https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey">SpiderMonkey </a>中它规定了 JavaScript 的实现标准,SpiderMonkey 是一个 JavaScript 引擎,被广泛用于火狐浏览器等谋智的众多产品中。</p> - -<p>"ES.next" 的第一份工作草案 (基于 <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/New_in_JavaScript/ECMAScript_5_support_in_Mozilla">ECMAScript 5.1</a>) 发布于 2011 年 7 月 12 日,代号为 "ES.next" 或 "Harmony"。2014 年 8 月,ECMAScript 2015 草案规范停止增加新的功能,开始进入稳定期与 bug 修复阶段。最终,ECMA-262 Edition 6 于 2015 年 6 月 17 日由 ECMA 联合大会 (ECMA General Assembly) 作为标准正式发布。它同时也是国际工业标准 ISO/IEC 16262:2016。</p> - -<p>你可以通过<a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm"> ecma-international.org</a> 免费下载规范的 <a href="http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf">PDF</a> 和 <a href="http://www.ecma-international.org/ecma-262/6.0/index.html">HTML </a>版本。</p> - -<p><a href="https://mail.mozilla.org/listinfo/es-discuss">es-discuss</a> 是 ECMAScript 规范的讨论与反馈渠道。</p> - -<h2 id="Firefox_已经支持的特性">Firefox 已经支持的特性</h2> - -<p>这里列出的功能已经在 Firefox 中支持;每个特性后面标注了具体实现的浏览器版本。</p> - -<h2 id="标准库">标准库</h2> - -<h3 id="Array_对象的补充"><code>Array</code> 对象的补充</h3> - -<ul> - <li>{{jsxref("Array")}} iteration with <code>for...of</code> (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/13">Firefox 13</a>)</li> - <li>{{jsxref("Array.from()")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/32">Firefox 32</a>)</li> - <li>{{jsxref("Array.of()")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/25">Firefox 25</a>)</li> - <li>{{jsxref("Array.prototype.fill()")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/31">Firefox 31</a>)</li> - <li>{{jsxref("Array.prototype.find()")}}, {{jsxref("Array.prototype.findIndex()")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/25">Firefox 25</a>)</li> - <li>{{jsxref("Array.prototype.entries()")}},<br> - {{jsxref("Array.prototype.keys()")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/28">Firefox 28</a>)</li> - <li>{{jsxref("Array.prototype.copyWithin()")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/32">Firefox 32</a>)</li> - <li>{{jsxref("Array.@@species", "get Array[@@species]")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/48">Firefox 48</a>)</li> -</ul> - -<h3 id="新的_Map_和_Set,以及_WeakMap_和_WeakSet_对象">新的 <code>Map 和 Set,以及 WeakMap</code> <code>和 WeakSet</code> <code>对象</code></h3> - -<ul> - <li>{{jsxref("Map")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/13">Firefox 13</a>) - - <ul> - <li>{{jsxref("Map")}} iteration with <code>for...of</code> (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/17">Firefox 17</a>)</li> - <li>{{jsxref("Map.prototype.forEach()")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/25">Firefox 25</a>)</li> - <li>{{jsxref("Map.prototype.entries()")}},<br> - {{jsxref("Map.prototype.keys()")}},<br> - {{jsxref("Map.prototype.values()")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/20">Firefox 20</a>)</li> - <li>Constructor argument: <code>new {{jsxref("Map")}}(null)</code> (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/37">Firefox 37</a>)</li> - <li>Monkey-patched <code>set()</code> in Constructor (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/37">Firefox 37</a>)</li> - <li>{{jsxref("Map.@@species", "get Map[@@species]")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/41">Firefox 41</a>)</li> - </ul> - </li> - <li>{{jsxref("Set")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/13">Firefox 13</a>) - <ul> - <li>{{jsxref("Set")}} iteration with <code>for...of</code> (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/17">Firefox 17</a>)</li> - <li>{{jsxref("Set.prototype.forEach()")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/25">Firefox 25</a>)</li> - <li>{{jsxref("Set.prototype.entries()")}},<br> - {{jsxref("Set.prototype.keys()")}},<br> - {{jsxref("Set.prototype.values()")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/24">Firefox 24</a>)</li> - <li>Constructor argument: <code>new {{jsxref("Set")}}(null)</code> (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/37">Firefox 37</a>)</li> - <li>Monkey-patched <code>add()</code> in Constructor (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/37">Firefox 37</a>)</li> - <li>{{jsxref("Set.@@species", "get Set[@@species]")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/41">Firefox 41</a>)</li> - </ul> - </li> - <li>{{jsxref("WeakMap")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/6">Firefox 6</a>) - <ul> - <li>{{jsxref("WeakMap.clear()")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/20">Firefox 20</a>)</li> - <li>optional iterable argument in {{jsxref("WeakMap")}} constructor (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/36">Firefox 36</a>)</li> - <li>Constructor argument: <code>new {{jsxref("WeakMap")}}(null)</code> (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/37">Firefox 37</a>)</li> - <li>Monkey-patched <code>set()</code> in Constructor (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/37">Firefox 37</a>)</li> - </ul> - </li> - <li>{{jsxref("WeakSet")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/34">Firefox 34</a>) - <ul> - <li>Constructor argument: <code>new {{jsxref("WeakSet")}}(null)</code> (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/37">Firefox 37</a>)</li> - <li>Monkey-patched <code>add()</code> in Constructor (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/37">Firefox 37</a>)</li> - </ul> - </li> -</ul> - -<h3 id="新的_Math_方法"><code>新的 Math 方法</code></h3> - -<ul> - <li>{{jsxref("Math.imul()")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/20">Firefox 20</a>)</li> - <li>{{jsxref("Math.clz32()")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/31">Firefox 31</a>)</li> - <li>{{jsxref("Math.fround()")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/26">Firefox 26</a>)</li> - <li>{{jsxref("Math.log10()")}}, {{jsxref("Math.log2()")}}, {{jsxref("Math.log1p()")}}, {{jsxref("Math.expm1()")}}, {{jsxref("Math.cosh()")}}, {{jsxref("Math.sinh()")}}, {{jsxref("Math.tanh()")}}, {{jsxref("Math.acosh()")}}, {{jsxref("Math.asinh()")}}, {{jsxref("Math.atanh()")}}, {{jsxref("Math.hypot()")}}, {{jsxref("Math.trunc()")}}, {{jsxref("Math.sign()")}}, {{jsxref("Math.cbrt()")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/25">Firefox 25</a>)</li> -</ul> - -<h3 id="Number_对象的补充"><code>Number</code> 对象的补充</h3> - -<ul> - <li>{{jsxref("Number.isNaN()")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/16">Firefox 16</a>)</li> - <li>{{jsxref("Number.isFinite()")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/16">Firefox 16</a>)</li> - <li>{{jsxref("Number.isInteger()")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/16">Firefox 16</a>)</li> - <li>{{jsxref("Number.parseInt()")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/25">Firefox 25</a>)</li> - <li>{{jsxref("Number.parseFloat()")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/25">Firefox 25</a>)</li> - <li>{{jsxref("Number.EPSILON")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/25">Firefox 25</a>)</li> - <li>{{jsxref("Number.MAX_SAFE_INTEGER")}}, {{jsxref("Number.MIN_SAFE_INTEGER")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/31">Firefox 31</a>)</li> - <li>{{jsxref("Number.isSafeInteger()")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/32">Firefox 32</a>)</li> -</ul> - -<h3 id="Object_对象的补充"><code>Object</code> 对象的补充</h3> - -<ul> - <li>{{jsxref("Object.prototype.__proto__")}} 已经被标准化</li> - <li>{{jsxref("Object.is()")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/22">Firefox 22</a>)</li> - <li>{{jsxref("Object.setPrototypeOf()")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/31">Firefox 31</a>)</li> - <li>{{jsxref("Object.assign()")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/34">Firefox 34</a>)</li> - <li>{{jsxref("Object.getOwnPropertySymbols()")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/33">Firefox 33</a>)</li> -</ul> - -<h3 id="Date_对象的补充"><code>Date</code> 对象的补充</h3> - -<ul> - <li>{{jsxref("Date.prototype")}} is an ordinary object (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/41">Firefox 41</a>)</li> - <li>generic {{jsxref("Date.prototype.toString")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/41">Firefox 41</a>)</li> - <li>{{jsxref("Date.prototype.@@toPrimitive", "Date.prototype[@@toPrimitive]")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/44">Firefox 44</a>)</li> -</ul> - -<h3 id="新的_Promise_对象">新的 <code>Promise 对象</code></h3> - -<ul> - <li>{{jsxref("Promise")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/24">Firefox 24</a>, 在 <a href="https://developer.mozilla.org/en-US/Firefox/Releases/29">Firefox 29</a> 中默认启用)</li> -</ul> - -<h3 id="新的_Reflect_对象">新的 <code>Reflect 对象</code></h3> - -<ul> - <li>{{jsxref("Reflect")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/42">Firefox 42</a>)</li> -</ul> - -<h3 id="RegExp_对象的补充"><code>RegExp</code> 对象的补充</h3> - -<ul> - <li>{{jsxref("RegExp")}} sticky (y) flag (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/38">Firefox 38</a>)</li> - <li>{{jsxref("RegExp")}} unicode (u) flag (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/46">Firefox 46</a>)</li> - <li>generic {{jsxref("RegExp.prototype.toString")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/39">Firefox 39</a>)</li> - <li>{{jsxref("RegExp.prototype.@@match()", "RegExp.prototype[@@match]()")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/49">Firefox 49</a>)</li> - <li>{{jsxref("RegExp.prototype.@@replace()", "RegExp.prototype[@@replace]()")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/49">Firefox 49</a>)</li> - <li>{{jsxref("RegExp.prototype.@@search()", "RegExp.prototype[@@search]()")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/49">Firefox 49</a>)</li> - <li>{{jsxref("RegExp.prototype.@@split()", "RegExp.prototype[@@split]()")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/49">Firefox 49</a>)</li> - <li>{{jsxref("RegExp.@@species", "get RegExp[@@species]")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/49">Firefox 49</a>)</li> -</ul> - -<h3 id="String_对象的补充"><code>String</code> 对象的补充</h3> - -<ul> - <li>{{jsxref("String.fromCodePoint()")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/29">Firefox 29</a>)</li> - <li>{{jsxref("String.prototype.codePointAt()")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/29">Firefox 29</a>)</li> - <li>{{jsxref("String.prototype.startsWith()")}}, {{jsxref("String.prototype.endsWith()")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/17">Firefox 17</a>)</li> - <li>{{jsxref("String.prototype.includes()")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/40">Firefox 40</a>) (formerly <code>String.prototype.contains()</code> (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/17">Firefox 17</a>))</li> - <li>{{jsxref("String.prototype.repeat()")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/24">Firefox 24</a>)</li> - <li>{{jsxref("String.prototype.normalize()")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/31">Firefox 31</a>)</li> - <li>{{jsxref("String.raw()")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/34">Firefox 34</a>)</li> - <li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#Unicode_code_point_escapes">\u{XXXXXX}</a> Unicode code point escapes (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/40">Firefox 40</a>)</li> -</ul> - -<h3 id="新的_Symbol_对象">新的 <code>Symbol 对象</code></h3> - -<ul> - <li>{{jsxref("Symbol")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/36">Firefox 36</a>)</li> - <li>{{jsxref("Symbol.iterator")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/36">Firefox 36</a>)</li> - <li>{{jsxref("Symbol.for()")}} - global Symbol registry (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/36">Firefox 36</a>)</li> - <li>{{jsxref("Symbol.match")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/40">Firefox 40</a>)</li> - <li>{{jsxref("Symbol.species")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/41">Firefox 41</a>)</li> - <li>{{jsxref("Symbol.toPrimitive")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/44">Firefox 44</a>)</li> - <li>{{jsxref("Symbol.prototype.@@toPrimitive", "Symbol.prototype[@@toPrimitive]")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/44">Firefox 44</a>)</li> - <li>{{jsxref("Symbol.replace")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/49">Firefox 49</a>)</li> - <li>{{jsxref("Symbol.search")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/49">Firefox 49</a>)</li> - <li>{{jsxref("Symbol.split")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/49">Firefox 49</a>)</li> - <li>{{jsxref("Symbol.hasInstance")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/50">Firefox 50</a>)</li> -</ul> - -<h3 id="Typed_Arrays">Typed Arrays</h3> - -<p>Typed arrays 已经合并到 ECMAScript 2015 中,不再具有<a href="https://www.khronos.org/registry/typedarray/specs/latest/">自己单独的规范</a>。</p> - -<ul> - <li>{{jsxref("ArrayBuffer")}}</li> - <li>{{jsxref("ArrayBuffer.@@species", "get ArrayBuffer[@@species]")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/48">Firefox 48</a>)</li> - <li>{{jsxref("DataView")}}</li> - <li>{{jsxref("Int8Array")}}</li> - <li>{{jsxref("Uint8Array")}}</li> - <li>{{jsxref("Uint8ClampedArray")}}</li> - <li>{{jsxref("Int16Array")}}</li> - <li>{{jsxref("Uint16Array")}}</li> - <li>{{jsxref("Int32Array")}}</li> - <li>{{jsxref("Uint32Array")}}</li> - <li>{{jsxref("Float32Array")}}</li> - <li>{{jsxref("Float64Array")}}</li> - <li>{{jsxref("TypedArray.@@species", "get %TypedArray%[@@species]")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/48">Firefox 48</a>)</li> -</ul> - -<h3 id="表达式和操作符">表达式和操作符</h3> - -<ul> - <li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/new.target">new.target</a> (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/41">Firefox 41</a>)</li> -</ul> - -<ul> - <li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator">Spread operator for arrays</a> (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/16">Firefox 16</a>) - - <ul> - <li>use <code>Symbol.iterator</code> property (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/36">Firefox 36</a>)</li> - </ul> - </li> - <li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator">Spread operator for function calls</a> (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/27">Firefox 27</a>) - <ul> - <li>use <code>Symbol.iterator</code> property (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/36">Firefox 36</a>)</li> - </ul> - </li> -</ul> - -<h3 id="语句">语句</h3> - -<ul> - <li>{{jsxref("Statements/for...of", "for...of")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/13">Firefox 13</a>) - - <ul> - <li>works in terms of <code>.iterator()</code> and <code>.next()</code> (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/17">Firefox 17</a>)</li> - <li>use <code>"@@iterator"</code> property (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/27">Firefox 27</a>)</li> - <li>use <code>Symbol.iterator</code> property (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/36">Firefox 36</a>)</li> - </ul> - </li> -</ul> - -<h3 id="函数">函数</h3> - -<ul> - <li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions_and_function_scope/rest_parameters">Rest parameters</a> (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/15">Firefox 15</a>)</li> - <li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/default_parameters">Default parameters</a> (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/15">Firefox 15</a>) - <ul> - <li>Parameters without defaults after default parameters (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/26">Firefox 26</a>)</li> - <li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters#Destructured_parameter_with_default_value_assignment" title="Default function parameters allow formal parameters to be initialized with default values if no value or undefined is passed.">Destructured parameters with default value assignment</a> (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/41">Firefox 41</a>)</li> - </ul> - </li> - <li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/arrow_functions">Arrow functions</a> (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/22">Firefox 22</a>)</li> - <li>{{jsxref("Statements/function*", "Generator function")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/26">Firefox 26</a>) - <ul> - <li>{{jsxref("Operators/yield", "yield")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/26">Firefox 26</a>)</li> - <li>{{jsxref("Operators/yield*", "yield*")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/27">Firefox 27</a>)</li> - </ul> - </li> - <li>{{jsxref("Functions/arguments/@@iterator", "arguments[@@iterator]")}} (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/46">Firefox 46</a>)</li> -</ul> - -<h3 id="其他特性">其他特性</h3> - -<ul> - <li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#Numeric_literals">Binary and octal numeric literals</a> (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/25">Firefox 25</a>)</li> - <li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/template_strings">Template strings</a> (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/34">Firefox 34</a>)</li> - <li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer#Property_definitions">Object initializer: shorthand property names</a> (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/33">Firefox 33</a>)</li> - <li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer#Computed_property_names">Object initializer: computed property names</a> (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/34">Firefox 34</a>)</li> - <li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer#Method_definitions">Object initializer: shorthand method names</a> (<a href="https://developer.mozilla.org/en-US/Firefox/Releases/34">Firefox 34</a>)</li> -</ul> - -<h2 id="和_ES2015_规范不兼容的特性">和 ES2015 规范不兼容的特性</h2> - -<p>Firefox (部分)实现了以下特性,但是与规范不兼容。原因有如下几个:Firefox 是依据 ES 6 规范的早期草案来实现,或者 Firefox 是作为实验性特性来实现,而当时与之类似的特性还没有被添加到 ES2015 规范中。</p> - -<ul> - <li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators">Legacy iterators and generators</a> (<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/New_in_JavaScript/1.7">JS 1.7</a>, <a href="https://developer.mozilla.org/en-US/Firefox/Releases/2">Firefox 2</a>)</li> - <li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment">Destructuring assignment</a> (<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/New_in_JavaScript/1.7">JS 1.7</a>, <a href="https://developer.mozilla.org/en-US/Firefox/Releases/2">Firefox 2</a>) (ES2015 compliance {{bug("1055984")}})</li> - <li>{{jsxref("Statements/const", "const")}} (<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/New_in_JavaScript/1.5">JS 1.5</a>, Firefox 1.0) (ES2015 compliance {{bug("950547")}} implemented in Firefox 51)</li> - <li>{{jsxref("Statements/let", "let")}} (<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/New_in_JavaScript/1.7">JS 1.7</a>, <a href="https://developer.mozilla.org/en-US/Firefox/Releases/2">Firefox 2</a>) (ES2015 compliance {{bug("950547")}} implemented in Firefox 51)</li> -</ul> - -<h2 id="相关链接">相关链接</h2> - -<ul> - <li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/New_in_JavaScript/ECMAScript_7_support_in_Mozilla">Mozilla 支持的 ECMAScript 2016 特性</a></li> - <li><a href="http://wiki.ecmascript.org/doku.php?id=harmony:specification_drafts">ECMAScript 2015 规范草案</a></li> - <li><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=694100">Mozilla ES2015 tracking bug</a></li> - <li><a href="https://kangax.github.io/compat-table/es6/" title="https://kangax.github.io/compat-table/es6/">ECMAScript 2015 的浏览器支持情况</a></li> -</ul> -</div> diff --git a/files/zh-cn/web/javascript/new_in_javascript/index.html b/files/zh-cn/web/javascript/new_in_javascript/index.html deleted file mode 100644 index 95eee26559..0000000000 --- a/files/zh-cn/web/javascript/new_in_javascript/index.html +++ /dev/null @@ -1,99 +0,0 @@ ---- -title: JavaScript更新 -slug: Web/JavaScript/New_in_JavaScript -tags: - - ECMAScript - - ECMAScript 2017 - - JavaScript - - 版本 -translation_of: Archive/Web/JavaScript/New_in_JavaScript ---- -<div>{{jsSidebar("New_in_JS")}}</div> - -<div> </div> - -<p class="summary">本章包含有关JavaScript版本历史记录的信息,以及基于<strong>Mozilla/SpiderMonkey-</strong>的JavaScript应用程序的实现状态,例如Firefox。</p> - -<h2 id="ECMAScript版本">ECMAScript版本</h2> - -<dl> - <dt><a href="/en-US/docs/Web/JavaScript/Language_Resources">语言资源</a></dt> - <dd>在这里学习更多的JavaScript的标准ECMAScript。</dd> - <dt><a href="/zh-CN/docs/JavaScript/ECMAScript_5_support_in_Mozilla">ECMAScript 5的支持情况</a></dt> - <dd>Mozilla 的引擎和产品 对于标准ECMA-262 Edition 5.1的支持情况。</dd> - <dt><a href="/zh-CN/docs/Web/JavaScript/New_in_JavaScript/ECMAScript_6_support_in_Mozilla">ECMAScript 2015的支持情况</a></dt> - <dd>Mozilla 的引擎和产品对于标准ECMA-262 Edition 6的支持情况。</dd> - <dt><a href="/zh-CN/docs/Web/JavaScript/New_in_JavaScript/ECMAScript_7_support_in_Mozilla">ECMAScript 2016的支持情况</a></dt> - <dd>Mozilla 的引擎和产品对于即将到来的ECMA-262 Edition 7的支持情况.</dd> -</dl> - -<h2 id="JavaScript发布说明">JavaScript发布说明</h2> - -<dl> - <dt><a href="/zh-CN/docs/Web/JavaScript/New_in_JavaScript/Firefox_JavaScript_changelog">Firefox中的JavaScript更新日志</a></dt> - <dd>Firefox 5以及以后版本的JavaScript日志更新情况。</dd> - <dt>Chrome中的JavaScript更新日志</dt> - <dd>Chrome中的JavaScript日志更新情况。</dd> -</dl> - -<h2 id="JavaScript版本">JavaScript版本</h2> - -<p><strong>弃用项</strong> ({{deprecated_inline()}})。这里面是一些已经确定的弃用的api以及一下Mozilla组织专用的API <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=867609">正在被慢慢的弃用</a>不建议使用。Firefox 4 所用的javascirpt引擎是 ECMAScript(1.8.5). 就像现在我们提到的新的引擎 ECMA-262 里面的标准都在 ECMAScript 2015 里面的实现了API。</p> - -<p>JavaScript于1996年3月在Netscape Navigator 2.0和Internet Explorer 2.0中发布为1.0版。</p> - -<dl> - <dt><a href="/zh-CN/docs/Web/JavaScript/New_in_JavaScript/1.1">JavaScript 1.1</a></dt> - <dd>该版本在Netscape Navigator 3.0中使用。发布于1996年8月19日。</dd> - <dt><a href="/zh-CN/docs/Web/JavaScript/New_in_JavaScript/1.2">JavaScript 1.2</a></dt> - <dd>该版本在Netscape Navigator 4.0-4.05中使用。发布于1997年6月11日。</dd> - <dt><a href="/zh-CN/docs/Web/JavaScript/New_in_JavaScript/1.3">JavaScript 1.3</a></dt> - <dd>该版本在Netscape Navigator 4.06-4.7x中使用。发布于1998年10月19日。符合ECMA-262第1版和第2版的标准</dd> - <dt><a href="/zh-CN/docs/Web/JavaScript/New_in_JavaScript/1.4">JavaScript 1.4</a></dt> - <dd>版本在Netscape的服务器端发送的JavaScript。于1999年发行。</dd> - <dt><a href="/zh-CN/docs/Web/JavaScript/New_in_JavaScript/1.5">JavaScript 1.5</a></dt> - <dd>该版本在Netscape Navigator 6.0和Firefox 1.0中使用。发布于2000年11月14日。符合ECMA-262第3版的标准</dd> - <dt><a href="/zh-CN/docs/Web/JavaScript/New_in_JavaScript/1.6">JavaScript 1.6</a></dt> - <dd>该版本在 Firefox 1.5中使用。发布于2005年11月。加入了ECMAScript标准的XML(E4X),Array方法,String以及泛型</dd> - <dt><a href="/zh-CN/docs/Web/JavaScript/New_in_JavaScript/1.7">JavaScript 1.7</a></dt> - <dd>Version shipped in Firefox 2. Released in October 2006.<br> - Includes generators, iterators, array comprehensions, <code>let</code> expressions, and destructuring assignment.</dd> - <dt><a href="/zh-CN/docs/Web/JavaScript/New_in_JavaScript/1.8">JavaScript 1.8</a></dt> - <dd>Version shipped in Firefox 3. Released in June 2008.</dd> - <dd>包括表达式闭包,生成器表达式和<code>Array.reduce()</code></dd> - <dt><a href="/zh-CN/docs/Web/JavaScript/New_in_JavaScript/1.8.1">JavaScript 1.8.1</a></dt> - <dd>Version shipped in Firefox 3.5. Released on <span class="st">June 30, 2009.</span></dd> - <dd>包括TraceMonkey JIT并原生支持JSON。</dd> - <dt>JavaScript 1.8.2</dt> - <dd>Version shipped in Firefox 3.6. Released June 22, 2009.<br> - Includes only minor changes.</dd> - <dt><a href="/zh-CN/docs/Web/JavaScript/New_in_JavaScript/1.8.5">JavaScript 1.8.5</a></dt> - <dd>Version shipped in Firefox 4. Released July 27, 2010.包括符合ECMA-262 Edition 5的许多新功能。 这是最后一个JavaScript版本。</dd> - <dt>ES2015</dt> -</dl> - -<ul> - <li>6 th Edition / June 2015<span style="display: none;"> </span></li> - <li>https://www.ecma-international.org/publications/standards/Ecma-262.htm</li> - <li>https://www.ecma-international.org/ecma-262/6.0/index.html</li> -</ul> - -<p>ES2016</p> - -<ul> - <li>7 th Edition / June 2016</li> - <li>https://www.ecma-international.org/publications/standards/Ecma-262.htm</li> - <li>https://www.ecma-international.org/ecma-262/7.0/index.html</li> -</ul> - -<p>ES2017</p> - -<ul> - <li><a href="https://developer.mozilla.org/zh-CN/docs/tag/ECMAScript" rel="nofollow, noindex">ECMAScript</a> 2017</li> - <li>coming soon ...</li> - <li>https://www.youtube.com/watch?v=s-G_RZ4RJLU</li> -</ul> - -<p> </p> - -<h2 id="sect1"> </h2> diff --git a/files/zh-cn/web/javascript/reference/functions/arguments/caller/index.html b/files/zh-cn/web/javascript/reference/functions/arguments/caller/index.html deleted file mode 100644 index 13128ec962..0000000000 --- a/files/zh-cn/web/javascript/reference/functions/arguments/caller/index.html +++ /dev/null @@ -1,47 +0,0 @@ ---- -title: caller -slug: Web/JavaScript/Reference/Functions/arguments/caller -translation_of: Archive/Web/JavaScript/arguments.caller ---- -<p>{{jsSidebar("Functions")}}</p> - -<p><code><font face="Open Sans, Arial, sans-serif">废弃的 </font><strong>arguments.caller</strong></code> 属性原先用在函数执行的时候调用自身。本属性已被移除且不再有用。</p> - -<h2 id="描述">描述</h2> - -<p><code>arguments.caller 已经不可使用了,但是你还可以使用</code> {{jsxref("Function.caller")}}。</p> - -<pre>function whoCalled() { - if (whoCalled.caller == null) - console.log('I was called from the global scope.'); - else - console.log(whoCalled.caller + ' called me!'); -} -</pre> - -<h3 id="Examples" name="Examples">示例</h3> - -<p>下例演示了<code>arguments.caller</code>属性的作用.</p> - -<pre class="brush: js example-bad">function whoCalled() { - if (arguments.caller == null) - console.log('该函数在全局作用域内被调用.'); - else - console.log(arguments.caller + '调用了我!'); -}</pre> - -<h2 id="规范">规范</h2> - -<p>无相关标准。JavaScript 1.1 实现,{{bug(7224)}} 移除 caller,因为潜在的不安全性。</p> - -<h2 id="浏览器支持">浏览器支持</h2> - - - -<p>{{Compat("javascript.functions.arguments.caller")}}</p> - -<h2 id="相关链接">相关链接</h2> - -<ul> - <li>{{jsxref("Function")}}</li> -</ul> diff --git a/files/zh-cn/web/javascript/reference/global_objects/array/observe/index.html b/files/zh-cn/web/javascript/reference/global_objects/array/observe/index.html deleted file mode 100644 index 7c2dcc8474..0000000000 --- a/files/zh-cn/web/javascript/reference/global_objects/array/observe/index.html +++ /dev/null @@ -1,92 +0,0 @@ ---- -title: Array.observe() -slug: Web/JavaScript/Reference/Global_Objects/Array/observe -tags: - - JavaScript - - 实验性 - - 数组 - - 方法 - - 过时的 -translation_of: Archive/Web/JavaScript/Array.observe ---- -<div>{{JSRef}}{{obsolete_header}}</div> - -<p><strong>Array.observe()</strong> 方法用于异步监视数组发生的变化,类似于针对对象的 {{jsxref("Object.observe()")}} 。当数组的值发生变化时,它按发生顺序提供了一个变化流。与 <code>Object.observe()</code> 类似,它由如下可接受的变化类型列表<code>["add"、"update"、"delete"、"splice"]</code>触发。</p> - -<h2 id="语法">语法</h2> - -<pre class="syntaxbox"><code>Array.observe(<var>arr</var>, <var>callback</var>)</code></pre> - -<h3 id="参数">参数</h3> - -<dl> - <dt><code>arr</code></dt> - <dd>用于被监视的数组</dd> - <dt><code>callback</code></dt> - <dd>每当数组发生变化时,使用如下参数调用该函数: - <dl> - <dt><code>changes</code></dt> - <dd>用于表示变化的对象数组。每个变化对象的属性如下: - <ul> - <li><strong><code>name</code></strong>: 变化的属性名。</li> - <li><strong><code>object</code></strong>: 变化后的数组。</li> - <li><strong><code>type</code></strong>: 用于表示变化类型的字符串。<code>其取值为"add"、</code><code>"update"、</code><code>"delete"</code>或 <code>"splice"</code>之一。</li> - <li><strong><code>oldValue</code></strong>: 仅用于<code>"update"</code>和<code>"delete"类型。变化</code>之前的取值。</li> - <li><strong><code>index</code></strong>: <code>仅用于"splice"类型。</code>变化发生所在索引。</li> - <li><strong><code>removed</code></strong>: 仅用于<code>"splice"类型。</code>被删除元素组成的数组。</li> - <li><strong><code>addedCount</code></strong>: 仅用于<code>"splice"</code>类型。被添加的元素数量。</li> - </ul> - </dd> - </dl> - </dd> -</dl> - -<h2 id="描述">描述</h2> - -<p>每次 arr 发生任何变化时,回调函数将被调用,调用参数为所有变化按发生顺序组成的数组。</p> - -<div class="note"> -<p>通过Array方法如<a href="https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/pop"> Array.prototype.pop( )</a> 触发的变化将被报告成"<em>splice</em>"变化,长度不变但索引赋值发生变化的将被报告成"update"变化。</p> -</div> - -<h2 id="示例">示例</h2> - -<h3 id="Example_Logging_different_change_types">Example: Logging different change types</h3> - -<pre class="brush: js">var arr = ['a', 'b', 'c']; - -Array.observe(arr, function(changes) { - console.log(changes); -}); - -arr[1] = 'B'; -// [{type: 'update', object: <arr>, name: '1', oldValue: 'b'}] - -arr[3] = 'd'; -// [{type: 'splice', object: <arr>, index: 3, removed: [], addedCount: 1}] - -arr.splice(1, 2, 'beta', 'gamma', 'delta'); -// [{type: 'splice', object: <arr>, index: 1, removed: ['B', 'c'], addedCount: 3}] -</pre> - -<h2 id="Specifications" name="Specifications">标准规范</h2> - -<p><a href="https://github.com/arv/ecmascript-object-observe">Strawman proposal specification</a>.</p> - -<h2 id="Browser_compatibility" name="Browser_compatibility">浏览器支持</h2> - -<div> -<div> - - -<p>{{Compat("javascript.builtins.Array.observe")}}</p> -</div> -</div> - -<h2 id="See_also" name="See_also">相关内容</h2> - -<ul> - <li>{{jsxref("Array.unobserve()")}} {{experimental_inline}}</li> - <li>{{jsxref("Object.observe()")}} {{experimental_inline}}</li> - <li><a href="https://stackoverflow.com/q/29269057/778272">Under what condition would Array.observe's “add” event trigger?</a></li> -</ul> diff --git a/files/zh-cn/web/javascript/reference/global_objects/array/unobserve/index.html b/files/zh-cn/web/javascript/reference/global_objects/array/unobserve/index.html deleted file mode 100644 index 90678a1081..0000000000 --- a/files/zh-cn/web/javascript/reference/global_objects/array/unobserve/index.html +++ /dev/null @@ -1,86 +0,0 @@ ---- -title: Array.unobserve() -slug: Web/JavaScript/Reference/Global_Objects/Array/unobserve -translation_of: Archive/Web/JavaScript/Array.unobserve ---- -<div>{{JSRef}} {{non-standard_header}}</div> - -<p>Array<strong>.unobserve()方法用来移除</strong>{{jsxref("Array.observe()")}}设置的所有观察者。</p> - -<h2 id="语法">语法</h2> - -<pre class="syntaxbox"><code>Array.unobserve(<var>arr</var>, <var>callback</var>)</code></pre> - -<h3 id="参数">参数</h3> - -<dl> - <dt><code>arr</code></dt> - <dd>停止观察的数组。</dd> - <dt> </dt> - <dt><code>callback回调</code></dt> - <dd>需要停止的array <strong>arr</strong>每次改变都会调用的函数引用。</dd> -</dl> - -<h2 id="描述">描述</h2> - -<p><code>Array.unobserve()</code> 方法因为要移除观察者,所以应该在{{jsxref("Array.observe()")}}调用后调用。</p> - -<p>回调函数应该是一个函数的引用并且不能是匿名函数, 因为这个函数需要用来移除前面的观察者, 如果用匿名函数是没有用的,将不能移除任何观察者。</p> - -<h2 id="例子">例子</h2> - -<h3 id="停止观察一个数组">停止观察一个数组</h3> - -<pre class="brush: js">var arr = [1, 2, 3]; - -var observer = function(changes) { - console.log(changes); -} - -Array.observe(arr, observer); - -arr.push(4); -// [{type: "splice", object: <arr>, index: 3, removed:[], addedCount: 1}] - -Array.unobserve(arr, observer); - -arr.pop(); -// The callback wasn't called</pre> - -<h3 id="使用匿名函数">使用匿名函数</h3> - -<pre class="brush: js">var persons = ['Khalid', 'Ahmed', 'Mohammed']; - -Array.observe(persons, function (changes) { - console.log(changes); -}); - -persons.shift(); -// [{type: "splice", object: <arr>, index: 0, removed: [ "Khalid" ], addedCount: 0 }] - -Array.unobserve(persons, function (changes) { - console.log(changes); -}); - -persons.push('Abdullah'); -// [{type: "splice", object: <arr>, index: 2, removed: [], addedCount: 1 }] -// The callback will always be called -</pre> - -<h2 id="浏览器兼容性">浏览器兼容性</h2> - -<div> -<div> - - -<p>{{Compat("javascript.builtins.Array.unobserve")}}</p> -</div> -</div> - -<h2 id="相关内容">相关内容</h2> - -<ul> - <li>{{jsxref("Array.observe()")}} {{non-standard_inline}}</li> - <li>{{jsxref("Object.observe()")}} {{non-standard_inline}}</li> - <li>{{jsxref("Object.unobserve()")}} {{non-standard_inline}}</li> -</ul> diff --git a/files/zh-cn/web/javascript/reference/global_objects/arraybuffer/transfer/index.html b/files/zh-cn/web/javascript/reference/global_objects/arraybuffer/transfer/index.html deleted file mode 100644 index cf3185f637..0000000000 --- a/files/zh-cn/web/javascript/reference/global_objects/arraybuffer/transfer/index.html +++ /dev/null @@ -1,116 +0,0 @@ ---- -title: ArrayBuffer.transfer() -slug: Web/JavaScript/Reference/Global_Objects/ArrayBuffer/transfer -translation_of: Archive/Web/JavaScript/ArrayBuffer.transfer ---- -<div>{{JSRef}} {{SeeCompatTable}}</div> - -<p> 静态<code><strong>ArrayBuf</strong></code><strong>fer.transfer()</strong> 方法返回一个新的ArrayBuffer, 其内容取自oldBuffer的数据,并且根据 newByteLength 的大小来对数据进行截取或者以0扩展。 如果 newByteLength 未定义,则使用 oldBuffer 的byteLength。这个操作使得 oldBuffer 处于被移除的状态。</p> - -<h2 id="语法">语法</h2> - -<pre class="syntaxbox">ArrayBuffer.transfer(oldBuffer [, newByteLength]);</pre> - -<h3 id="参数">参数</h3> - -<dl> - <dt><code>oldBuffer</code></dt> - <dd> 要转移的{{jsxref("ArrayBuffer")}}对象。</dd> - <dt>newByteLength</dt> - <dd>新 <code>ArrayBuffer</code> 对象的字节长度。</dd> -</dl> - -<h3 id="返回值">返回值</h3> - -<p>一个新的ArrayBuffer对象。</p> - -<h2 id="描述">描述</h2> - -<p><code>ArrayBuffer.transfer()</code>方法允许你增长和移除 <code>ArrayBuffer</code> 对象。不需复制就能增长一个ArrayBuffer的功能,对于大的缓冲区来说,有速度优势 (类似realloc) 。当释放底层内存时,移除ArrayBuffer的功能给开发者提供了显式控制。这避免了必须丢弃所有引用和等待垃圾回收。</p> - -<h2 id="示例">示例</h2> - -<pre class="brush: js">var buf1 = new ArrayBuffer(40); -new Int32Array(buf1)[0] = 42; - -var buf2 = ArrayBuffer.transfer(buf1, 80); -buf1.byteLength; // 0 but if you use the polyfill then the value is still 40 -buf2.byteLength; // 80 -new Int32Array(buf2)[0]; // 42 - -var buf3 = ArrayBuffer.transfer(buf2, 0); -buf2.byteLength; // 0 but if you use the polyfill then the value is still 80 -buf3.byteLength; // 0 -</pre> - -<h2 id="Polyfill">Polyfill</h2> - -<p>You can partially work around this by inserting the following code at the beginning of your scripts, allowing use of much of the functionality of transfer<font face="Consolas, Liberation Mono, Courier, monospace">()</font> in implementations that do not natively support it. This is not the exact equivalent of this API, but this function transfers data from one ArrayBuffer to another ArrayBuffer.</p> - -<pre>if(!ArrayBuffer.transfer) { - ArrayBuffer.transfer = function (source, length) { - source = Object(source); - var dest = new ArrayBuffer(length); - if(!(source instanceof ArrayBuffer) || !(dest instanceof ArrayBuffer)) { - throw new TypeError("Source and destination must be ArrayBuffer instances"); - } - if(dest.byteLength >= source.byteLength) { - var nextOffset = 0; - var leftBytes = source.byteLength; - var wordSizes = [8, 4, 2, 1]; - wordSizes.forEach(function (_wordSize_) { - if (leftBytes >= _wordSize_) { - var done = transferWith(_wordSize_, source, dest, nextOffset, leftBytes); - nextOffset = done.nextOffset; - leftBytes = done.leftBytes; - } - }); - } - return dest; - function transferWith(wordSize, source, dest, nextOffset, leftBytes) { - var ViewClass = Uint8Array; - switch (wordSize) { - case 8: - ViewClass = Float64Array; - break; - case 4: - ViewClass = Float32Array; - break; - case 2: - ViewClass = Uint16Array; - break; - case 1: - ViewClass = Uint8Array; - break; - default: - ViewClass = Uint8Array; - break; - } - var view_source = new ViewClass(source, nextOffset, Math.trunc(leftBytes / wordSize)); - var view_dest = new ViewClass(dest, nextOffset, Math.trunc(leftBytes / wordSize)); - for(var i=0; i<view_dest.length; i++) { - view_dest[i] = view_source[i]; - } - return { - nextOffset : view_source.byteOffset + view_source.byteLength, - leftBytes : source.byteLength - (view_source.byteOffset + view_source.byteLength) - } - } - }; -}</pre> - -<h2 id="规范">规范</h2> - -<p>Not part of any current specification draft document, but <a href="https://esdiscuss.org/topic/sept-23-2014-meeting-notes">has been</a> <a href="https://gist.github.com/lukewagner/2735af7eea411e18cf20">proposed</a> for a future ECMA-262 edition.</p> - -<h2 id="浏览器兼容性">浏览器兼容性</h2> - - - -<p>{{Compat("javascript.builtins.ArrayBuffer.transfer")}}</p> - -<h2 id="相关链接">相关链接</h2> - -<ul> - <li><a href="/en-US/docs/Web/JavaScript/Typed_arrays" title="en/JavaScript typed arrays">JavaScript typed arrays</a></li> -</ul> diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/tolocaleformat/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/tolocaleformat/index.html deleted file mode 100644 index 40c72fc476..0000000000 --- a/files/zh-cn/web/javascript/reference/global_objects/date/tolocaleformat/index.html +++ /dev/null @@ -1,73 +0,0 @@ ---- -title: Date.prototype.toLocaleFormat() -slug: Web/JavaScript/Reference/Global_Objects/Date/toLocaleFormat -tags: - - Date - - 非标准 -translation_of: Archive/Web/JavaScript/Date.toLocaleFormat ---- -<div>{{JSRef}} {{non-standard_header}}</div> - -<p>非标准方法 <strong><code>toLocaleFormat()</code></strong> 按特定的格式将一个日期转换成一个字符串。 {{jsxref("Global_Objects/DateTimeFormat", "Intl.DateTimeFormat")}} 是符合标准的格式化日期的替代方法。另见更新的(newer)版本的 {{jsxref("Date.prototype.toLocaleDateString()")}}方法.</p> - -<h2 id="语法">语法</h2> - -<pre class="syntaxbox"><code><var>dateObj</var>.toLocaleFormat(<var>formatString</var>)</code></pre> - -<h3 id="参数">参数</h3> - -<dl> - <dt><code>formatString</code></dt> - <dd>与C语言中的 <a class="external" href="http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html"><code>strftime()</code></a> 方法的参数形式要求相同的格式字符串。</dd> -</dl> - -<h2 id="描述">描述</h2> - -<p><code>toLocaleFormat()</code> 方法通过格式化生成的日期或时间提供了更好的软件层面的控制(provides greater software control over the formatting of the generated date and/or time)。用操作系统的地点来月份和星期几的名称本地化。然而,However, ordering of the day and month and other localization tasks are not handled automatically since you have control over the order in which they occur. You should take care that the format string is localized properly according to the user's system settings. Be aware that the locale used is not necessarily the same as the locale of the browser.</p> - -<p>Extension and XULRunner developers should know that just loading the format string from a <code>.dtd</code> or <code>.properties</code> file using a <code>chrome://<em>somedomain</em>/locale/<em>somefile.ext</em></code> URI should be <strong>avoided</strong>, as the <code>.dtd</code>/<code>.properties</code> file and the <code>toLocaleFormat()</code> method does not not necessarily use the same locale, which could result in odd looking or even ambiguous or unreadable dates.</p> - -<p>Also note that the behavior of the used locale depends on the platform, and the user might customize the locale used, so using the system locale the choose the format string might in some cases not even be adequate. You might consider using some of the more general <code>toLocale*</code> methods of the {{jsxref("Global_Objects/Date", "Date")}} object or doing your own custom localization of the date to be displayed using some of the <code>get*</code> methods of the {{jsxref("Global_Objects/Date", "Date")}} object instead of using this method.</p> - -<h2 id="示例">示例</h2> - -<h3 id="Using_toLocaleFormat()">Using <code>toLocaleFormat()</code></h3> - -<pre class="brush: js">var today = new Date(); -var date = today.toLocaleFormat('%A, %B %e, %Y'); // Bad example -</pre> - -<p>In this example, <code>toLocaleFormat()</code> returns a string such as "Wednesday, October 3, 2007". Note that the format string in this example is not properly localized, which will result in the problems described above.</p> - -<h2 id="腻子(Polyfill)">腻子(Polyfill)</h2> - -<p>When using the <a href="https://github.com/abritinthebay/datejs/wiki/Format-Specifiers">DateJS</a> library you can polyfill {{jsxref("Date.prototype.toLocaleDateString()")}} like this:</p> - -<pre class="brush: js">if (!Date.prototype.toLocaleFormat) { - (function() { - Date.prototype.toLocaleFormat = function(formatString) { - return this.format(formatString); - }; - }()); -}</pre> - -<h2 id="标准">标准</h2> - -<p>不属于任何标准。在JavaScript 1.6中被实现。</p> - -<h2 id="兼容性">兼容性</h2> - -<div> -<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p> - -<p>{{Compat("javascript.builtins.Date.toLocaleFormat")}}</p> -</div> - -<h2 id="另见">另见</h2> - -<ul> - <li>{{jsxref("Global_Objects/DateTimeFormat", "Intl.DateTimeFormat")}}</li> - <li>{{jsxref("Date.prototype.toLocaleString()")}}</li> - <li>{{jsxref("Date.prototype.toLocaleDateString()")}}</li> - <li>{{jsxref("Date.prototype.toLocaleTimeString()")}}</li> -</ul> diff --git a/files/zh-cn/web/javascript/reference/global_objects/function/arity/index.html b/files/zh-cn/web/javascript/reference/global_objects/function/arity/index.html deleted file mode 100644 index d8e8668ca2..0000000000 --- a/files/zh-cn/web/javascript/reference/global_objects/function/arity/index.html +++ /dev/null @@ -1,16 +0,0 @@ ---- -title: Function.arity -slug: Web/JavaScript/Reference/Global_Objects/Function/arity -translation_of: Archive/Web/JavaScript/Function.arity ---- -<div> -<div>{{JSRef("Global_Objects", "Function")}} {{obsolete_header}}</div> -</div> - -<h2 id="Summary" name="Summary">概述</h2> - -<p>返回一个函数的形参数量.</p> - -<h2 id="Description" name="Description">描述</h2> - -<p class="note"><code>arity</code>是一个古老的已经没有浏览器支持的属性,你应该使用<code><a href="/zh-CN/docs/JavaScript/Reference/Global_Objects/Function/length" title="JavaScript/Reference/Global_Objects/Function/length">Function.prototype.length</a></code>属性来代替.</p> diff --git a/files/zh-cn/web/javascript/reference/global_objects/function/isgenerator/index.html b/files/zh-cn/web/javascript/reference/global_objects/function/isgenerator/index.html deleted file mode 100644 index f377f0a210..0000000000 --- a/files/zh-cn/web/javascript/reference/global_objects/function/isgenerator/index.html +++ /dev/null @@ -1,40 +0,0 @@ ---- -title: Function.prototype.isGenerator() -slug: Web/JavaScript/Reference/Global_Objects/Function/isGenerator -translation_of: Archive/Web/JavaScript/Function.isGenerator ---- -<div>{{JSRef("Global_Objects", "Function")}} {{non-standard_header}}</div> - -<h2 id="概述">概述</h2> - -<p>判断一个函数是否是一个<a href="/zh-cn/JavaScript/Guide/Iterators_and_Generators#Generators.3a_a_better_way_to_build_Iterators" title="zh-cn/Core JavaScript 1.5 Guide/Iterators and Generators#Generators.3a a better way to build Iterators">生成器</a>.</p> - -<h2 id="语法">语法</h2> - -<pre class="syntaxbox"><code><var>fun</var>.isGenerator()</code></pre> - -<h2 id="描述">描述</h2> - -<p>该方法用来判断一个函数是否是一个<a href="/zh-cn/JavaScript/Guide/Iterators_and_Generators#Generators.3a_a_better_way_to_build_Iterators" title="zh-cn/Core JavaScript 1.5 Guide/Iterators and Generators#Generators.3a a better way to build Iterators">生成器</a>.</p> - -<h2 id="例子">例子</h2> - -<pre class="brush: js">function f() {} -function* g() { - yield 42; -} -console.log("f.isGenerator() = " + f.isGenerator()); -console.log("g.isGenerator() = " + g.isGenerator()); -</pre> - -<p>上面代码的输出结果为</p> - -<pre>f.isGenerator() = false -g.isGenerator() = true -</pre> - -<h2 id="相关链接">相关链接</h2> - -<ul> - <li><a href="/zh-cn/JavaScript/Guide/Iterators_and_Generators" title="zh-cn/Core JavaScript 1.5 Guide/Iterators and Generators">迭代器和生成器</a></li> -</ul> diff --git a/files/zh-cn/web/javascript/reference/global_objects/iterator/index.html b/files/zh-cn/web/javascript/reference/global_objects/iterator/index.html deleted file mode 100644 index 775c8d60d6..0000000000 --- a/files/zh-cn/web/javascript/reference/global_objects/iterator/index.html +++ /dev/null @@ -1,188 +0,0 @@ ---- -title: Iterator -slug: Web/JavaScript/Reference/Global_Objects/Iterator -tags: - - Deprecated -translation_of: Archive/Web/Iterator ---- -<div>{{jsSidebar("Objects")}}</div> - -<div class="warning"><strong>非标准。</strong> <code><strong>Iterator</strong></code> 函数是一个 SpiderMonkey 专有特性,并且会在某一时刻被删除。为将来使用的话,请考虑使用 {{jsxref("Statements/for...of", "for...of")}} 循环和 <a href="/zh-CN/docs/Web/JavaScript/Guide/The_Iterator_protocol">迭代协议</a>。</div> - -<p><code><strong>Iterator</strong></code> 函数返回一个对象,它实现了遗留的迭代协议,并且迭代了一个对象的可枚举属性。</p> - -<h2 id="语法">语法</h2> - -<pre class="syntaxbox">Iterator(<var>object</var>, [keyOnly])</pre> - -<h3 id="参数">参数</h3> - -<dl> - <dt><code>object</code></dt> - <dd>要迭代属性的对象。</dd> - <dt><code>keyOnly</code></dt> - <dd> 如果<code>keyOnly</code>是真值,<code>Iterator.prototype.next</code> <code>只返回property_name</code> 。</dd> -</dl> - -<h2 id="描述">描述</h2> - -<p><code>返回迭代了object的Iterator</code> 实例。如果<code>keyOnly</code>为假值,则<code>Iterator</code> 实例返回每次迭代而生成的 <code>[property_name, property_value]</code> 数组,否则,如果<code>keyOnly</code>是真值,则它返回每次迭代的 <code>property_name</code>。如果<code>object</code> 是 <code>Iterator</code> 实例或 {{jsxref("Generator")}} 实例 ,则它返回 <code>object</code> 自身。</p> - -<h2 id="属性">属性</h2> - -<dl> - <dt><code><strong>Iterator.prototype[@@iterator]</strong></code></dt> - <dd>返回一个函数,它返回符合{{jsxref("Iteration_protocols", "迭代协议", "", 1)}}的迭代对象。</dd> -</dl> - -<h2 id="方法">方法</h2> - -<dl> - <dt><code><strong>Iterator.prototype.next</strong></code></dt> - <dd>返回<code>[property_name, property_value]</code> 格式或<code>property_name</code> 的下一项。 如果没有更多项,抛出 <code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/StopIteration">StopIteration</a></code> 。</dd> -</dl> - -<h2 id="示例">示例</h2> - -<h3 id="迭代一个对象的属性">迭代一个对象的属性</h3> - -<pre class="brush: js">var a = { - x: 10, - y: 20, -}; -var iter = Iterator(a); -console.log(iter.next()); // ["x", 10] -console.log(iter.next()); // ["y", 20] -console.log(iter.next()); // throws StopIteration -</pre> - -<h3 id="使用遗留的解构for-in迭代对象的属性">使用遗留的<code>解构for-in迭代对象的属性</code></h3> - -<pre class="brush: js">var a = { - x: 10, - y: 20, -}; - -for (var [name, value] in Iterator(a)) { - console.log(name, value); // x 10 - // y 20 -} -</pre> - -<h3 id="使用for-of迭代">使用<code>for-of迭代</code></h3> - -<pre class="brush: js">var a = { - x: 10, - y: 20, -}; - -for (var [name, value] of Iterator(a)) { // @@iterator is used - console.log(name, value); // x 10 - // y 20 -} -</pre> - -<h3 id="迭代属性名">迭代属性名</h3> - -<pre class="brush: js">var a = { - x: 10, - y: 20, -}; - -for (var name in Iterator(a, true)) { - console.log(name); // x - // y -} -</pre> - -<h3 id="传入_Generator_实例">传入 Generator 实例</h3> - -<pre class="brush: js">function* f() { - yield 'a'; - yield 'b'; -} -var g = f(); - -console.log(g == Iterator(g)); // true - -for (var v in Iterator(g)) { - console.log(v); // a - // b -} -</pre> - -<h3 id="传入_Iterator_实例">传入 Iterator 实例</h3> - -<pre class="brush: js">var a = { - x: 10, - y: 20, -}; - -var i = Iterator(a); - -console.log(i == Iterator(i)); // true -</pre> - -<h2 id="规范">规范</h2> - -<p>非标准。不是目前任何标准文档的一部分。</p> - -<h2 id="浏览器兼容性">浏览器兼容性</h2> - -<p>{{CompatibilityTable}}</p> - -<div id="compat-desktop"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatNo}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - </tr> - </tbody> -</table> -</div> - -<div id="compat-mobile"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - </tr> - </tbody> -</table> -</div> - -<h2 id="相关链接">相关链接</h2> - -<ul> - <li><a href="/zh-CN/docs/JavaScript/Guide/Iterators_and_Generators" title="/en-US/docs/JavaScript/Guide/Iterators_and_Generators">Iterators and Generators</a></li> - <li><code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/StopIteration">StopIteration</a></code><br> - </li> -</ul> diff --git a/files/zh-cn/web/javascript/reference/global_objects/number/tointeger/index.html b/files/zh-cn/web/javascript/reference/global_objects/number/tointeger/index.html deleted file mode 100644 index 24abe2125e..0000000000 --- a/files/zh-cn/web/javascript/reference/global_objects/number/tointeger/index.html +++ /dev/null @@ -1,97 +0,0 @@ ---- -title: Number.toInteger() -slug: Web/JavaScript/Reference/Global_Objects/Number/toInteger -translation_of: Archive/Web/JavaScript/Number.toInteger ---- -<div>{{JSRef("Global_Objects", "Number")}} {{obsolete_header("33")}} {{non-standard_header}}</div> - -<h2 id="Summary" name="Summary">概览</h2> - -<p><strong><code>Number.toInteger()</code></strong> 用来将参数转换成整数,但该方法的实现已被移除.</p> - -<p>如果参数是 {{jsxref("Global_Objects/NaN", "NaN")}}, {{jsxref("Global_Objects/null", "null")}} 或 {{jsxref("Global_Objects/undefined", "undefined")}}, 会返回0 . 如果参数值是true返回1,false的话返回<span style="line-height: 19.0909080505371px;">0</span>.</p> - -<h2 id="Syntax" name="Syntax">语法</h2> - -<pre class="syntaxbox"><code>Number.toInteger(<var>number</var>)</code></pre> - -<h3 id="Parameters" name="Parameters">参数</h3> - -<dl> - <dt><code>number</code></dt> - <dd>将被转换成整数的参数.</dd> -</dl> - -<h2 id="Examples" name="Examples">示例</h2> - -<h3 id="Example:_Using_toInteger" name="Example:_Using_toInteger">例子: 使用 <code>toInteger()方法</code></h3> - -<pre class="brush: js">Number.toInteger(0.1); // 0 -Number.toInteger(1); // 1 -Number.toInteger(Math.PI); // 3 -Number.toInteger(null); // 0 -</pre> - -<h2 id="Specifications" name="Specifications">Specifications</h2> - -<ul> - <li><code>Number.toInteger()</code> 是<span style="line-height: 19.0909080505371px;">ECMAScript 6 起草的一部分</span>, 但在2013-8-23的Draft Rev 17 中被移除 .</li> -</ul> - -<h2 id="Browser_compatibility" name="Browser_compatibility">浏览器兼容性</h2> - -<div>{{CompatibilityTable}}</div> - -<div id="compat-desktop"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatNo}}</td> - <td>Firefox 16 to 32</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - </tr> - </tbody> -</table> -</div> - -<div id="compat-mobile"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>Firefox 16 to 32</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - </tr> - </tbody> -</table> -</div> - -<h2 id="See_also" name="See_also">See also</h2> - -<ul> - <li>归属于 {{jsxref("Global_Objects/Number", "Number")}} 对象.</li> -</ul> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/count/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/count/index.html deleted file mode 100644 index c7dfb12f2b..0000000000 --- a/files/zh-cn/web/javascript/reference/global_objects/object/count/index.html +++ /dev/null @@ -1,88 +0,0 @@ ---- -title: Object.prototype.__count__ -slug: Web/JavaScript/Reference/Global_Objects/Object/count -tags: - - JavaScript - - Object - - Obsolete - - Property - - Prototype -translation_of: Archive/Web/JavaScript/Object.count ---- -<div>{{JSRef}} {{obsolete_header("2")}}</div> - -<p> <strong><code>__count__</code></strong> 属性曾经用来存放对象的可枚举的属性的个数,但是已经被废除。</p> - -<h2 id="语法">语法</h2> - -<pre class="syntaxbox"><code><var>obj</var>.__count__</code></pre> - -<h2 id="示例">示例</h2> - -<pre class="brush: js">{ 1: 1 }.__count__ // 1 -[].__count__ // 0 -[1].__count__ // 1 -[1, /* hole */, 2, 3].__count__ // 3 -</pre> - -<h2 id="详细说明">详细说明</h2> - -<p>无需详细说明</p> - -<h2 id="浏览器兼容性">浏览器兼容性</h2> - -<div>{{CompatibilityTable}}</div> - -<div id="compat-desktop"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - </tr> - </tbody> -</table> -</div> - -<div id="compat-mobile"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - </tr> - </tbody> -</table> -</div> - -<h2 id="更多请参看">更多请参看</h2> - -<ul> - <li><a class="external" href="http://whereswalden.com/2010/04/06/more-changes-coming-to-spidermonkey-the-magical-__count__-property-of-objects-is-being-removed/">[Blog post] More changes coming to SpiderMonkey: the magical __count__ property is being removed</a></li> -</ul> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/eval/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/eval/index.html deleted file mode 100644 index e823c314a8..0000000000 --- a/files/zh-cn/web/javascript/reference/global_objects/object/eval/index.html +++ /dev/null @@ -1,85 +0,0 @@ ---- -title: Object.prototype.eval() -slug: Web/JavaScript/Reference/Global_Objects/Object/eval -translation_of: Archive/Web/JavaScript/Object.eval ---- -<div>{{JSRef}} {{obsolete_header}}</div> - -<p><code><strong>Object.eval()</strong></code> 方法用于在对象的上下文中对 JavaScript 代码字符串求值,但该方法已被移除。</p> - -<h2 id="语法">语法</h2> - -<pre class="syntaxbox"><code><var>obj</var>.eval(<var>string</var>)</code></pre> - -<h3 id="参数">参数</h3> - -<dl> - <dt><code>string</code></dt> - <dd>包含任意 JavaScript 表达式、语句或一组语句的字符串。表达式中可包含已有对象的变量与属性。</dd> -</dl> - -<h2 id="描述">描述</h2> - -<p><code>eval</code> 方法已从对象方法中移除。可使用全局 {{jsxref("Global_Objects/eval", "eval()")}} 函数替代该方法。</p> - -<h2 id="规范">规范</h2> - -<p>暂无规范</p> - -<h2 id="浏览器兼容性">浏览器兼容性</h2> - -<div>{{CompatibilityTable}}</div> - -<div id="compat-desktop"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - </tr> - </tbody> -</table> -</div> - -<div id="compat-mobile"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - </tr> - </tbody> -</table> -</div> - -<h2 id="相关链接">相关链接</h2> - -<ul> - <li>{{jsxref("Global_Objects/eval", "eval()")}}</li> -</ul> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/getnotifier/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/getnotifier/index.html deleted file mode 100644 index fac0573de3..0000000000 --- a/files/zh-cn/web/javascript/reference/global_objects/object/getnotifier/index.html +++ /dev/null @@ -1,93 +0,0 @@ ---- -title: Object.getNotifier() -slug: Web/JavaScript/Reference/Global_Objects/Object/getNotifier -translation_of: Archive/Web/JavaScript/Object.getNotifier ---- -<div>{{JSRef}} {{obsolete_header}}</div> - -<p><strong><code>Object.getNotifer()</code></strong> 方法用于创建可人工触发 change 事件的对象,但该方法在浏览器中已被废弃。</p> - -<h2 id="语法">语法</h2> - -<pre class="syntaxbox">Object.getNotifier(<em>obj</em>)</pre> - -<h3 id="参数">参数</h3> - -<dl> - <dt><code>obj</code></dt> - <dd>获取通知的对象。</dd> -</dl> - -<h3 id="返回值">返回值</h3> - -<p>与传入对象相关联的通知对象。</p> - -<h2 id="描述">描述</h2> - -<p><code><font face="Open Sans, Arial, sans-serif">通知对象可触发 </font>Object.observe() 所观察到的人工变动。</code></p> - -<h2 id="规范">规范</h2> - -<p><a href="https://github.com/arv/ecmascript-object-observe">Strawman proposal specification.</a></p> - -<h2 id="浏览器兼容性">浏览器兼容性</h2> - -<div>{{CompatibilityTable}}</div> - -<div id="compat-desktop"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatChrome("36")}} [1]</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatOpera("23")}}</td> - <td>{{CompatNo}}</td> - </tr> - </tbody> -</table> -</div> - -<div id="compat-mobile"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatNo}}</td> - <td>{{CompatChrome("36")}} [1]</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatOpera("23")}}</td> - <td>{{CompatNo}}</td> - </tr> - </tbody> -</table> -</div> - -<p>[1] Deprecated in Chrome 49.</p> - -<h2 id="相关链接">相关链接</h2> - -<ul> - <li>{{jsxref("Object.observe()")}} {{obsolete_inline}}</li> - <li>{{jsxref("Object.unobserve()")}} {{obsolete_inline}}</li> - <li>{{jsxref("Array.observe()")}} {{obsolete_inline}}</li> -</ul> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/nosuchmethod/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/nosuchmethod/index.html deleted file mode 100644 index 7b54198c19..0000000000 --- a/files/zh-cn/web/javascript/reference/global_objects/object/nosuchmethod/index.html +++ /dev/null @@ -1,208 +0,0 @@ ---- -title: Object.prototype.__noSuchMethod__ -slug: Web/JavaScript/Reference/Global_Objects/Object/noSuchMethod -translation_of: Archive/Web/JavaScript/Object.noSuchMethod ---- -<div>{{JSRef}} {{obsolete_header}}</div> - -<p><strong><code>__noSuchMethod__</code></strong> 属性曾经是指当调用某个对象里不存在的方法时即将被执行的函数,但是现在这个函数已经不可用。</p> - -<p><code><font face="Open Sans, Arial, sans-serif">在</font><strong>__noSuchMethod__</strong></code> 属性被移除之后,ECMAScript 2015 (ES6) 规范转而采用 {{jsxref("Proxy")}} 对象, 可以实现下面的效果(以及更多)。</p> - -<h2 id="语法">语法</h2> - -<pre class="syntaxbox"><code><var>obj</var>.__noSuchMethod__ = <var>fun</var></code></pre> - -<h3 id="参数">参数</h3> - -<dl> - <dt><code>fun</code></dt> - <dd>函数形式如下:</dd> - <dd> - <pre class="brush: js"><code>function (<var>id</var>, <var>args</var>) { . . . }</code></pre> - - <dl> - <dt><code>id</code></dt> - <dd>调用的不存在的方法名</dd> - <dt><code>args</code></dt> - <dd>传递给该方法的参数数组</dd> - </dl> - </dd> -</dl> - -<h2 id="描述">描述</h2> - -<p>默认情况喜爱,试图调用对象上不存在的方法其结果是在{{jsxref("TypeError")}}上抛出异常,这种行为可以在</p> - -<p>By default, an attempt to call a method that doesn't exist on an object results in a {{jsxref("TypeError")}} being thrown. This behavior can be circumvented by defining a function at that object's <code>__noSuchMethod__</code> member. The function takes two arguments, the first is the name of the method attempted and the second is an array of the arguments that were passed in the method call. The second argument is an actual array (that is, it inherits through the {{jsxref("Array.prototype")}} chain) and not the array-like <a href="/en-US/docs/Web/JavaScript/Reference/Functions_and_function_scope/arguments" title="JavaScript/Reference/Functions/arguments">arguments object</a>.</p> - -<p>If this method cannot be called, either as if <code>undefined</code> by default, if deleted, or if manually set to a non-function, the JavaScript engine will revert to throwing <code>TypeError</code>s.</p> - -<h2 id="Examples">Examples</h2> - -<h3 id="Simple_test_of___noSuchMethod__">Simple test of <code>__noSuchMethod__</code></h3> - -<pre class="brush: js">var o = { - __noSuchMethod__: function(id, args) { - console.log(id, '(' + args.join(', ') + ')'); - } -}; - -o.foo(1, 2, 3); -o.bar(4, 5); -o.baz(); - -// Output -// foo (1, 2, 3) -// bar (4, 5) -// baz () -</pre> - -<h3 id="Using___noSuchMethod___to_simulate_multiple_inheritance">Using <code>__noSuchMethod__</code> to simulate multiple inheritance</h3> - -<p>An example of code that implements a primitive form of multiple inheritance is shown below.</p> - -<pre class="brush: js">// Doesn't work with multiple inheritance objects as parents -function noMethod(name, args) { - var parents = this.__parents_; - - // Go through all parents - for (var i = 0; i < parents.length; i++) { - // If we find a function on the parent, we call it - if (typeof parents[i][name] == "function") { - return parents[i][name].apply(this, args); - } - } - - // If we get here, the method hasn't been found - throw new TypeError; -} - -// Used to add a parent for multiple inheritance -function addParent(obj, parent) { - // If the object isn't initialized, initialize it - if (!obj.__parents_) { - obj.__parents_ = []; - obj.__noSuchMethod__ = noMethod; - } - - // Add the parent - obj.__parents_.push(parent); -} -</pre> - -<p>An example of using this idea is shown below.</p> - -<pre class="brush: js">// Example base class 1 -function NamedThing(name){ - this.name=name; -} - -NamedThing.prototype = { - getName: function() { return this.name; }, - setName: function(newName) { this.name = newName; } -} - -// Example base class 2 -function AgedThing(age) { - this.age = age; -} - -AgedThing.prototype = { - getAge: function() { return this.age; }, - setAge: function(age) { this.age = age; } -} - -// Child class. inherits from NamedThing and AgedThing -// as well as defining address -function Person(name, age, address){ - addParent(this, NamedThing.prototype); - NamedThing.call(this, name); - addParent(this, AgedThing.prototype); - AgedThing.call(this, age); - this.address = address; -} - -Person.prototype = { - getAddr: function() { return this.address; }, - setAddr: function(addr) { this.address = addr; } -} - -var bob = new Person("bob", 25, "New York"); - -console.log("getAge is " + (("getAge" in bob) ? "in" : "not in") + " bob"); -// getAge is not in bob - -console.log("bob's age is: " + bob.getAge()); -// bob's age is: 25 - -console.log("getName is " + (("getName" in bob) ? "in" : "not in") + " bob"); -// getName is not in bob - -console.log("bob's name is: " + bob.getName()); -// bob's name is: bob - -console.log("getAddr is " + (("getAddr" in bob) ? "in" : "not in") + " bob"); -// getAddr is in bob - -console.log("bob's address is: " + bob.getAddr()); -// bob's address is: New York -</pre> - -<h2 id="Specifications">Specifications</h2> - -<p>Not part of any specifications. This feature has been removed, see {{bug(683218)}}.</p> - -<h2 id="Browser_compatibility">Browser compatibility</h2> - -<div>{{CompatibilityTable}}</div> - -<div id="compat-desktop"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}} [1]</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - </tr> - </tbody> -</table> -</div> - -<div id="compat-mobile"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}} [1]</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - </tr> - </tbody> -</table> -</div> - -<p>[1] This feature was implemented until version 43.</p> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/observe/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/observe/index.html deleted file mode 100644 index e37cc6ab6f..0000000000 --- a/files/zh-cn/web/javascript/reference/global_objects/object/observe/index.html +++ /dev/null @@ -1,160 +0,0 @@ ---- -title: Object.observe() -slug: Web/JavaScript/Reference/Global_Objects/Object/observe -tags: - - ECMAScript7 - - Experimental - - JavaScript - - Method - - Object - - observe -translation_of: Archive/Web/JavaScript/Object.observe ---- -<div>{{JSRef}} {{obsolete_header}}</div> - -<h2 id="概述">概述</h2> - -<p><strong><code>Object.observe()</code></strong> 方法用于异步地监视一个对象的修改。当对象属性被修改时,方法的回调函数会提供一个有序的修改流。然而,这个接口已经被废弃并从各浏览器中移除。你可以使用更通用的 {{jsxref("Proxy")}} 对象替代。</p> - -<h2 id="语法">语法</h2> - -<pre class="syntaxbox"><code>Object.observe(<var>obj</var>, <var>callback</var></code>[, <var>acceptList</var>])</pre> - -<h3 id="参数">参数</h3> - -<dl> - <dt><code>obj</code></dt> - <dd>被监控的对象.</dd> - <dt><code>callback</code></dt> - <dd>当对象被修改时触发的回调函数,其参数为: - <dl> - <dt><code>changes</code></dt> - <dd>一个数组,其中包含的每一个对象代表一个修改行为。每个修改行为的对象包含: - <ul> - <li><strong><code>name</code></strong>: 被修改的属性名称<span style="font-family: consolas,monaco,andale mono,monospace;">。</span></li> - <li><strong><code>object</code></strong>: 修改后该对象的值<span style="font-family: consolas,monaco,andale mono,monospace;">。</span></li> - <li><strong><code>type</code></strong>: 表示对该对象做了何种类型的修改,可能的值为<code>"add"</code>, <code>"update"</code>, or <code>"delete"</code><span style="font-family: consolas,monaco,andale mono,monospace;">。</span></li> - <li><strong><code>oldValue</code></strong>: 对象修改前的值。该值只在<code>"update"<font face="Open Sans, sans-serif">与</font></code><code>"delete"有效。</code></li> - <li> </li> - </ul> - </dd> - <dt><font face="Consolas">acceptList</font></dt> - <dd>在给定对象上给定回调中要监视的变化类型列表。如果省略, <code><font face="Courier New">["add", "update", "delete", "reconfigure", "setPrototype", "preventExtensions"]</font></code> 将会被使用。</dd> - </dl> - </dd> -</dl> - -<h2 id="描述">描述</h2> - -<p><code style="font-style: normal;">callback</code> 函数会在<code>对象被改变时被调用,其参数为一个包含所有修改信息的有序的数组对象。</code></p> - -<h2 id="例子">例子</h2> - -<h3 id="例子_打印出三种不同操作类型的日志">例子: 打印出三种不同操作类型的日志</h3> - -<pre class="brush: js">var obj = { - foo: 0, - bar: 1 -}; - -Object.observe(obj, function(changes) { - console.log(changes); -}); - -obj.baz = 2; -// [{name: 'baz', object: <obj>, type: 'add'}] - -obj.foo = 'hello'; -// [{name: 'foo', object: <obj>, type: 'update', oldValue: 0}] - -delete obj.baz; -// [{name: 'baz', object: <obj>, type: 'delete', oldValue: 2}] -</pre> - -<h3 id="例子_数据绑定">例子: 数据绑定</h3> - -<pre class="brush: js">// 一个数据模型 -var user = { - id: 0, - name: 'Brendan Eich', - title: 'Mr.' -}; - -// 创建用户的greeting -function updateGreeting() { - user.greeting = 'Hello, ' + user.title + ' ' + user.name + '!'; -} -updateGreeting(); - -Object.observe(user, function(changes) { - changes.forEach(function(change) { - // 当name或title属性改变时, 更新greeting - if (change.name === 'name' || change.name === 'title') { - updateGreeting(); - } - }); -}); -</pre> - -<h2 id="Specifications" name="Specifications">规范</h2> - -<p><a href="https://github.com/arv/ecmascript-object-observe">Strawman proposal for ECMAScript 7</a>.</p> - -<h2 id="Browser_compatibility" name="Browser_compatibility">浏览器兼容性</h2> - -<div>{{CompatibilityTable}}</div> - -<div id="compat-desktop"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatChrome("36")}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatOpera("23")}}</td> - <td>{{CompatNo}}</td> - </tr> - </tbody> -</table> -</div> - -<div id="compat-mobile"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatNo}}</td> - <td>{{CompatChrome("36")}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatOpera("23")}}</td> - <td>{{CompatNo}}</td> - </tr> - </tbody> -</table> -</div> - -<h2 id="See_also" name="See_also">相关链接</h2> - -<ul> - <li>{{jsxref("Object.unobserve()")}} {{experimental_inline}}</li> - <li>{{jsxref("Array.observe()")}} {{experimental_inline}}</li> -</ul> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/parent/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/parent/index.html deleted file mode 100644 index 8597b6c4a3..0000000000 --- a/files/zh-cn/web/javascript/reference/global_objects/object/parent/index.html +++ /dev/null @@ -1,43 +0,0 @@ ---- -title: Object.prototype.__parent__ -slug: Web/JavaScript/Reference/Global_Objects/Object/Parent -tags: - - JavaScript - - 原型 - - 对象 - - 属性 - - 已废弃 - - 非标准 -translation_of: Archive/Web/JavaScript/Object.parent ---- -<div>{{JSRef}}{{Non-standard_Header}}{{Obsolete_Header("gecko2")}}</div> - -<p>The <strong><code>__parent__</code></strong> property used to point to an object's context, but it has been removed.</p> - -<p>指向一个对象的上下文.</p> - -<h2 id="语法">语法</h2> - -<pre class="syntaxbox"><var>obj</var>.__parent__</pre> - -<h2 id="描述">描述</h2> - -<p>对于最顶层对象来说,这个属性的值就是全局对象 window。</p> - -<h2 id="规范">规范</h2> - -<p>不属于任何规范。</p> - -<h2 id="浏览器兼容性">浏览器兼容性</h2> - - - -<p>{{Compat("javascript.builtins.Object.parent")}}</p> - -<h2 id="参见">参见</h2> - -<ul> - <li><a class="external" href="http://whereswalden.com/2010/05/07/spidermonkey-change-du-jour-the-special-__parent__-property-has-been-removed/">SpiderMonkey change du jour: the special __parent__ property has been removed</a></li> - <li><a href="/zh-CN/docs/Components.utils.getGlobalForObject">Components.utils.getGlobalForObject</a></li> - <li><a href="/en-US/docs/JavaScript/Reference/Global_Objects/Object/Proto">__proto__</a></li> -</ul> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/unobserve/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/unobserve/index.html deleted file mode 100644 index bcae6ae8e7..0000000000 --- a/files/zh-cn/web/javascript/reference/global_objects/object/unobserve/index.html +++ /dev/null @@ -1,133 +0,0 @@ ---- -title: Object.unobserve() -slug: Web/JavaScript/Reference/Global_Objects/Object/unobserve -translation_of: Archive/Web/JavaScript/Object.unobserve ---- -<div>{{JSRef}} {{non-standard_header}}</div> - -<p><strong>Object.unobserve()</strong> 是用来移除通过 {{jsxref("Object.observe()")}}设置的观察者的方法。</p> - -<h2 id="语法">语法</h2> - -<pre class="syntaxbox"><code>Object.unobserve(<var>obj</var>, <var>callback</var>)</code></pre> - -<h3 id="参数">参数</h3> - -<dl> - <dt><code>obj</code></dt> - <dd>需要停止观察的对象。</dd> - <dt><code>callback</code></dt> - <dd>通过 observer 给 <strong>obj </strong>对象设置的回调函数.</dd> -</dl> - -<h2 id="描述">描述</h2> - -<p><code>Object.unobserve()</code> 用来在 {{jsxref("Object.observe()")}} 被调用以后,从对象上移除一个观察者。</p> - -<p>这个回调函数必须是一个函数的引用,而不能是一个匿名函数。因为这个引用将被用来移除之前设置的观察者方法。 给 <strong>Object.unobserve() </strong>传入匿名函数作为回调是不起作用的, 它不能移除任何观察者方法。</p> - -<h2 id="例子">例子</h2> - -<h3 id="观察一个对象">观察一个对象</h3> - -<pre class="brush: js">var obj = { - foo: 0, - bar: 1 -}; - -var observer = function(changes) { - console.log(changes); -} - -Object.observe(obj, observer); - -obj.newProperty = 2; -// [{name: 'newProperty', object: <obj>, type: 'add'}] - -Object.unobserve(obj, observer); - -obj.foo = 1; -// 回调函数不会被调用</pre> - -<h3 id="使用匿名函数">使用匿名函数</h3> - -<pre class="brush: js">var person = { - name : 'Ahmed', - age : 25 -}; - -Object.observe(person, function (changes) { - console.log(changes); -}); - -person.age = 40; -// [{name: 'age', object: <obj>, oldValue: 25, type: 'update'}] - -Object.unobserve(person, function (changes) { - console.log(changes); -}); - -person.age = 63; -// [{name: 'age', object: <obj>, oldValue: 40, type: 'update'}] -// 回调函数将会被调用 -</pre> - -<h2 id="浏览器兼容性">浏览器兼容性</h2> - -<div>{{CompatibilityTable}}</div> - -<div id="compat-desktop"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatChrome("36")}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatOpera("23")}}</td> - <td>{{CompatNo}}</td> - </tr> - </tbody> -</table> -</div> - -<div id="compat-mobile"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatNo}}</td> - <td>{{CompatChrome("36")}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatOpera("23")}}</td> - <td>{{CompatNo}}</td> - </tr> - </tbody> -</table> -</div> - -<h2 id="相关链接">相关链接</h2> - -<ul> - <li>{{jsxref("Object.observe()")}} {{non-standard_inline}}</li> - <li>{{jsxref("Array.observe()")}} {{non-standard_inline}}</li> - <li>{{jsxref("Array.unobserve()")}} {{non-standard_inline}}</li> -</ul> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/unwatch/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/unwatch/index.html deleted file mode 100644 index 986154992d..0000000000 --- a/files/zh-cn/web/javascript/reference/global_objects/object/unwatch/index.html +++ /dev/null @@ -1,105 +0,0 @@ ---- -title: Object.prototype.unwatch() -slug: Web/JavaScript/Reference/Global_Objects/Object/unwatch -translation_of: Archive/Web/JavaScript/Object.unwatch ---- -<div>{{JSRef}}</div> - -<div class="warning"> -<p><strong>警告 :</strong> 请尽量避免使用 unwatch() 和 {{jsxref("Object.prototype.watch", "watch()")}} . 这两个方法仅在 Gecko 中实现 , 并且他们过去主要作调试用. 另外, 使用 watchpoints 对性能有一系列的副面影响 ,特别是当使用全局对象,如 <code>window</code>. 你应该使用 <a href="/en-US/docs/Web/JavaScript/Guide/Working_with_Objects#Defining_getters_and_setters">setters and getters</a> 或 proxies 来替代. 查阅 {{anch("Browser compatibility")}} 以获取更多信息.</p> -</div> - -<p><code><strong>unwatch()</strong></code> 删除一个 {{jsxref("Object.prototype.watch", "watch()")}} 设置的 watchpoint.</p> - -<h2 id="语法">语法</h2> - -<pre class="syntaxbox"><code><var>obj</var>.unwatch(<var>prop</var>)</code></pre> - -<h3 id="参数">参数</h3> - -<dl> - <dt><code>prop</code></dt> - <dd>想要停止监视的对象的属性名</dd> -</dl> - -<h2 id="描述">描述</h2> - -<p>JavaScript调试器具有类似的功能,以及其他调试选项。有关调试器的信息 <a href="/en-US/docs/Venkman">Venkman</a>.</p> - -<p>默认地, 这个方法 被每一个 {{jsxref("Object")}} 的子类继承 </p> - -<div class="note"> -<p><strong>Note:</strong> The reason for <code>unwatch()</code> to take the property name <em>prop</em> as its only parameter is due to the "single handler allowing" behavior of the {{jsxref("Object.watch", "watch()")}} method.</p> -</div> - -<h2 id="例子">例子</h2> - -<p>See {{jsxref("Object.watch", "watch()")}}.</p> - -<h2 id="说明">说明</h2> - -<p>Not part of any specifications. Implemented in JavaScript 1.2.</p> - -<h2 id="浏览器兼容性">浏览器兼容性</h2> - -<div>{{CompatibilityTable}}</div> - -<div id="compat-desktop"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatNo}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - </tr> - </tbody> -</table> -</div> - -<div id="compat-mobile"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - </tr> - </tbody> -</table> -</div> - -<h2 id="Compatibility_notes">Compatibility notes</h2> - -<ul> - <li>从 Firefox 23 ({{bug(903332)}}) 开始, 在 {{domxref("Document")}} 对象上调用 <code>unwatch()</code> 抛出 {{jsxref("TypeError")}} . This regression has been fixed with Firefox 27.</li> -</ul> - -<h2 id="相关链接">相关链接</h2> - -<ul> - <li>{{jsxref("Object.watch()")}}</li> -</ul> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/watch/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/watch/index.html deleted file mode 100644 index 540967eee3..0000000000 --- a/files/zh-cn/web/javascript/reference/global_objects/object/watch/index.html +++ /dev/null @@ -1,201 +0,0 @@ ---- -title: Object.prototype.watch() -slug: Web/JavaScript/Reference/Global_Objects/Object/watch -tags: - - Debugging - - Deprecated - - JavaScript - - Method - - Object - - Obsolete - - Prototype -translation_of: Archive/Web/JavaScript/Object.watch ---- -<p>{{JSRef}}</p> - -<div class="warning"> -<p><strong>警告:</strong> 通常来讲,你应该尽量避免使用 <code>watch()</code>和 {{jsxref("Object.prototype.unwatch", "unwatch()")}} 这两个方法。因为只有 Gecko 实现了这两个方法,并且它们主要是为了在调试方便。另外,使用 watchpoint 对性能有严重的负面影响,在全局对象(如 window)上使用时尤其如此。你可以使用 <a href="/zh-cn/JavaScript/Guide/Working_with_Objects#Defining_getters_and_setters" title="https://developer.mozilla.org/zh-cn/Core_JavaScript_1.5_Guide/Working_with_Objects#Defining_getters_and_setters">setters and getters</a> 或者 proxy 代替。参见 {{ anch("Compatibility") }} 了解详情。</p> -</div> - -<p><code><strong>watch() </strong></code>方法会监视属性是否被赋值并在赋值时运行相关函数。</p> - -<h2 id="Summary" name="Summary">语法</h2> - -<pre class="syntaxbox"><em>obj</em>.watch(<em>prop</em>, <em>handler</em>)</pre> - -<h3 id="Parameters" name="Parameters">参数</h3> - -<dl> - <dt><code>prop</code></dt> - <dd>想要监视值是否发生变化的指定对象的某个属性的属性名称</dd> -</dl> - -<dl> - <dt><code>handler</code></dt> - <dd>当指定的属性发生变化时执行的回调函数</dd> -</dl> - -<h3 id="返回值">返回值</h3> - -<p>{{jsxref("undefined")}}.</p> - -<h2 id="Description" name="Description">描述</h2> - -<p>监视对指定对象的名为 <code>prop</code> 属性的赋值操作,只要 <code>prop</code> 属性被赋值,便调用 <code>handler(prop, oldval, newval)</code> 回调函数,并将函数返回值保存到该属性。 通过返回修改的新值(或者返回旧值),一个监视点可以过滤(或使之为 null )赋值。</p> - -<p>如果你删除某个设置监视点的属性,该监视点并不会消失。如果你之后重新创建这个属性,监视点仍然有效。</p> - -<p>要移除某个监视点,使用 <code><a href="/zh-cn/JavaScript/Reference/Global_Objects/Object/unwatch" title="zh-cn/JavaScript/Reference/Global_Objects/Object/unwatch">unwatch()</a></code> 方法。默认所有 <code>Object</code> 的后代都将继承 <code>watch</code> 方法。</p> - -<p>JavaScript 调试器有与之相似的机制以及其它调试选项。需要更多有关调试器的信息,请查阅 <a href="/zh-cn/Venkman" title="zh-cn/Venkman">Venkman</a>。</p> - -<p>对于 Firefox,<code>handler</code> 只会被脚本内的赋值操作激活,并不包括本地代码。举个例子,如果用户点击一个指向当前文档内的某个锚点, <code>window.watch('location', myHandler)</code> 不会回调 <code>myHandler</code> ,但 <code>window.location += '#myAnchor'</code> 将触发回调 <code>myHandler</code>。</p> - -<div class="note"><strong>注意:</strong> 对一个对象的指定属性调用 <code>watch()</code> 将覆盖先前关联的 handler。</div> - -<h2 id="Examples" name="Examples">例子</h2> - -<h3 id="Example_Using_watch_and_unwatch" name="Example:_Using_watch_and_unwatch">使用 <code>watch</code> 和 <code>unwatch</code></h3> - -<pre class="brush: js">var o = {p:1}; -o.watch("p", - function (id, oldval, newval) { - console.log("o." + id + "由" + oldval + " 变为 " + newval); - return newval; - }); - -o.p = 2; -o.p = 3; -delete o.p; -o.p = 4; - -o.unwatch('p'); -o.p = 5; -</pre> - -<p>上面的代码显示结果如下:</p> - -<pre class="eval">o.p 由 1 变为 2 -o.p 由 2 变为 3 -o.p 由 undefined 变为 4 -</pre> - -<h3 id="Example_Using_watch_to_validate_an_object.27s_properties" name="Example:_Using_watch_to_validate_an_object.27s_properties">使用 <code>watch</code> 来验证一个对象的属性</h3> - -<p>你可以使用 <code>watch</code> 来检测一个对象的属性赋值是否是合法的.下例演示了如何确保每个人始终具有一个合法的名字和0 到 200之间的年龄.</p> - -<pre class="brush: js">Person = function(name,age) { - this.watch("age", Person.prototype._isValidAssignment); - this.watch("name", Person.prototype._isValidAssignment); - this.name = name; - this.age = age; -} - -Person.prototype.toString = function() { - return this.name + ", " + this.age; -}; - -Person.prototype._isValidAssignment = function(id, oldval, newval) { - if (id === "name" && (!newval || newval.length > 30)) { - throw new RangeError("不合法的名字 " + this); - } - if (id === "age" && (newval < 0 || newval > 200)) { - throw new RangeError("不合法的年龄 " + this); - } - return newval; -} - -will = new Person("Will", 29); -print(will); // Will, 29 - -try { - will.name = ""; -} catch (e) { - //print(e); - console.log(e); -} - -try { - will.age = -4; -} catch (e) { - console.log(e); -} -</pre> - -<p>上面的代码显示结果如下:</p> - -<pre class="eval">Will, 29 -RangeError: 不合法的名字 Will, 29 -RangeError: 不合法的年龄 Will, 29 -</pre> - -<h2 id="Specifications">Specifications</h2> - -<p>不是任何规范的一部分。从 JavaScript 1.2 开始实现。</p> - -<h2 id="Browser_compatibility">Browser compatibility</h2> - -<div>{{CompatibilityTable}}</div> - -<div id="compat-desktop"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatNo}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - </tr> - </tbody> -</table> -</div> - -<div id="compat-mobile"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - </tr> - </tbody> -</table> -</div> - -<h2 id="兼容性提示">兼容性提示</h2> - -<ul> - <li>此 <a href="https://gist.github.com/384583">Polyfill</a> 为所有 ES5 兼容浏览器提供 <code>watch</code> 支持。</li> - <li>使用 {{jsxref("Proxy")}} 允许你更加深度地调整属性服务机制</li> - <li>从 Firefox 23 开始,在 {{domxref("Document")}} 对象上调用 <code>watch()</code> 将抛出 {{jsxref("TypeError")}} 错误。这个回归问题已经在 Firefox 27 修复。</li> -</ul> - -<h2 id="See_Also" name="See_Also">相关链接</h2> - -<ul> - <li>{{jsxref("Object.unwatch()")}}</li> - <li>{{jsxref("Object.observe()")}} {{obsolete_inline}}</li> -</ul> diff --git a/files/zh-cn/web/javascript/reference/global_objects/parallelarray/index.html b/files/zh-cn/web/javascript/reference/global_objects/parallelarray/index.html deleted file mode 100644 index 739d25c173..0000000000 --- a/files/zh-cn/web/javascript/reference/global_objects/parallelarray/index.html +++ /dev/null @@ -1,53 +0,0 @@ ---- -title: ParallelArray -slug: Web/JavaScript/Reference/Global_Objects/ParallelArray -tags: - - JavaScript - - ParallelArray - - 过时 -translation_of: Archive/Web/ParallelArray ---- -<p>The goal of <strong><code>ParallelArray</code></strong> was to enable data-parallelism in web applications. The higher-order functions available on <code>ParallelArray</code> attempted to execute in parallel, though they may fall back to sequential execution if necessary. To ensure that your code executes in parallel, it is suggested that the functions should be limited to the <a href="http://smallcultfollowing.com/babysteps/blog/2013/04/30/parallelizable-javascript-subset/">parallelizable subset of JS that Firefox supports</a>.</p> - -<h2 id="语法">语法</h2> - -<pre class="syntaxbox">new ParallelArray() -new ParallelArray([element0, element1, ...]) -new ParallelArray(arrayLength, elementalFunction)</pre> - -<h2 id="ParallelArray_instances"><code>ParallelArray</code> instances</h2> - -<h3 id="属性">属性</h3> - -<dl> - <dt>length</dt> - <dd>Reflects the number of elements in the <code>ParallelArray</code>.</dd> -</dl> - -<h3 id="方法">方法</h3> - -<dl> - <dt>map</dt> - <dt>reduce</dt> - <dt>scan</dt> - <dt>scatter</dt> - <dt>filter</dt> - <dt>flatten</dt> - <dt>partition</dt> - <dt>get</dt> -</dl> - -<h2 id="示例">示例</h2> - -<h3 id="Using_map_in_parallel">Using <code>map</code> in parallel</h3> - -<pre class="brush: js">var p = new ParallelArray([0, 1, 2, 3, 4]); -var m = p.map(function (v) { - return v + 1; -});</pre> - -<h2 id="参见">参见</h2> - -<ul> - <li><a href="http://wiki.ecmascript.org/doku.php?id=strawman:data_parallelism">Ecmascript ParallelArray strawman</a></li> -</ul> diff --git a/files/zh-cn/web/javascript/reference/global_objects/string/quote/index.html b/files/zh-cn/web/javascript/reference/global_objects/string/quote/index.html deleted file mode 100644 index 3d8d197f46..0000000000 --- a/files/zh-cn/web/javascript/reference/global_objects/string/quote/index.html +++ /dev/null @@ -1,116 +0,0 @@ ---- -title: String.prototype.quote() -slug: Web/JavaScript/Reference/Global_Objects/String/quote -tags: - - JavaScript - - Method - - Non-standard - - Obsolete - - Prototype - - String -translation_of: Archive/Web/JavaScript/String.quote ---- -<div>{{obsolete_header("37")}}</div> - -<div>{{JSRef("Global_Objects", "String")}}{{Non-standard_header}}</div> - -<h2 id="Summary" name="Summary">概述</h2> - -<p>将字符串中包含的特殊字符进行转义(反斜杠),然后在字符串两边各加上一个双引号(<code>"</code>)并返回,并不修改原字符串.</p> - -<h2 id="Syntax" name="Syntax">语法</h2> - -<pre class="syntaxbox"><code><em>str</em>.quote()</code></pre> - -<h2 id="Examples" name="Examples">示例</h2> - -<table class="fullwidth-table"> - <thead> - <tr> - <th class="header" scope="col"><code>str</code></th> - <th class="header" scope="col"><code>str.quote()</code></th> - <th class="header" scope="col"><code><a href="/zh-CN/docs/JavaScript/Reference/Global_Objects/eval" title="JavaScript/Reference/Global_Objects/eval">eval</a>(str.quote())</code></th> - </tr> - </thead> - <tbody> - <tr> - <td><code>Hello world!</code></td> - <td><code>"Hello world!"</code></td> - <td><code>Hello world!</code></td> - </tr> - <tr> - <td><code>Hello<br> - world!</code></td> - <td><code>"Hello\n\tworld!"</code></td> - <td><code>Hello<br> - world!</code></td> - </tr> - <tr> - <td><code>" \ — '</code></td> - <td><code>"\" \\ \u2014 '"</code></td> - <td><code>" \ — '</code></td> - </tr> - </tbody> -</table> - -<h2 id="Specifications" name="Specifications">规范</h2> - -<p>不在任何规范中。实现于 JavaScript 1.3.</p> - -<h2 id="浏览器兼容性">浏览器兼容性</h2> - -<div>{{CompatibilityTable}}</div> - -<div id="compat-desktop"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - </tr> - </tbody> -</table> -</div> - -<div id="compat-mobile"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - </tr> - </tbody> -</table> -</div> - -<h2 id="See_also" name="See_also">相关链接</h2> - -<ul> - <li><code><a href="/zh-CN/docs/JavaScript/Reference/Global_Objects/JSON/stringify" title="JavaScript/Reference/Global_Objects/JSON/stringify">JSON.stringify</a></code></li> -</ul> diff --git a/files/zh-cn/web/javascript/reference/operators/array_comprehensions/index.html b/files/zh-cn/web/javascript/reference/operators/array_comprehensions/index.html deleted file mode 100644 index 8bdfa28db2..0000000000 --- a/files/zh-cn/web/javascript/reference/operators/array_comprehensions/index.html +++ /dev/null @@ -1,157 +0,0 @@ ---- -title: 数组推导式 -slug: Web/JavaScript/Reference/Operators/Array_comprehensions -tags: - - JavaScript - - Non-standard - - 参考 - - 运算符 -translation_of: Archive/Web/JavaScript/Array_comprehensions ---- -<div class="warning"> -<p><strong>非标准。不要使用!</strong><br> - 数组推导是非标准的。以后应该用 {{jsxref("Array.prototype.map")}},{{jsxref("Array.prototype.filter")}},{{jsxref("Functions/Arrow_functions", "箭头函数", "", 1)}}和{{jsxref("Operators/Spread_operator", "展开语法", "", 1)}}.。</p> -</div> - -<p>{{jsSidebar("Operators")}} </p> - -<p><strong>数组推导式</strong>是一种 JavaScript 表达式语法,使用它,你可以在一个原有数组的基础上快速的构造出一个新的数组。但是它已经从标准和火狐中移除。不要用它!</p> - -<h2 id="语法">语法</h2> - -<pre class="syntaxbox">[for (x of iterable) x] -[for (x of iterable) if (condition) x] -[for (x of iterable) for (y of iterable) x + y] -</pre> - -<h2 id="描述">描述</h2> - -<p>在数组推导式内部,可以使用下面两种子语句:</p> - -<ul> - <li><a href="/zh-CN/docs/Web/JavaScript/Reference/Statements/for...of">for...of</a></li> - <li><a href="/zh-CN/docs/Web/JavaScript/Reference/Statements/if...else">if</a></li> -</ul> - -<p>每个 <code>for-of</code> 语句都放在与其配对的 <code>if</code> 语句(可以有多个,也可以完全省略)的左边,每个数组推导式中可以包含多组这样的配对,但最终选取的表达式值只能有一个,且这个值(也可以是个数组推导式,也就是说可以嵌套)只能放在推导式的最右边,紧靠着右中括号。</p> - -<h2 id="示例">示例</h2> - -<h3 id="基本的数组推导式写法">基本的数组推导式写法</h3> - -<pre class="brush:js">[for (i of [ 1, 2, 3 ]) i*i ]; -// [ 1, 4, 9 ] - -var abc = [ "A", "B", "C" ]; -[for (letters of abc) letters.toLowerCase()]; -// [ "a", "b", "c" ]</pre> - -<h3 id="带有_if_语句的数组推导式">带有 if 语句的数组推导式</h3> - -<pre class="brush: js">var years = [ 1954, 1974, 1990, 2006, 2010, 2014 ]; - -[for (year of years) if (year > 2000) year]; -// [ 2006, 2010, 2014 ] - -[for (year of years) if (year > 2000) if(year < 2010) year]; -// [ 2006], 和下面的写法等效: - -[for (year of years) if (year > 2000 && year < 2010) year]; -// [ 2006] -</pre> - -<h3 id="用数组推导式比用数组的_map、filter_方法更简洁">用数组推导式比用数组的 <code>map</code>、<code>filter</code> 方法更简洁</h3> - -<p>对比数组的 {{jsxref("Array.map", "map")}} 和 {{jsxref("Array.filter", "filter")}} 方法:</p> - -<pre class="brush: js">var numbers = [ 1, 2, 3 ]; - -numbers.map(function (i) { return i * i }); -[for (i of numbers) i*i ]; -// 返回值都是 [ 1, 4, 9 ] - -numbers.filter(function (i) { return i < 3 }); -[for (i of numbers) if (i < 3) i]; -// 返回值都是 [ 1, 2 ] -</pre> - -<h3 id="带有两个数组的数组推导式">带有两个数组的数组推导式</h3> - -<p>用两个 <code>for-of</code> 语句迭代两个不同的数组:</p> - -<pre class="brush: js">var numbers = [ 1, 2, 3 ]; -var letters = [ "a", "b", "c" ]; - -var cross = [for (i of numbers) for (j of letters) i+j]; -// [ "1a", "1b", "1c", "2a", "2b", "2c", "3a", "3b", "3c" ] - -var grid = [for (i of numbers) [for (j of letters) i+j]]; -// [ -// ["1a", "1b", "1c"], -// ["2a", "2b", "2c"], -// ["3a", "3b", "3c"] -// ] - -[for (i of numbers) if (i > 1) for (j of letters) if(j > "a") i+j] -// ["2b", "2c", "3b", "3c"],和下面的写法<strong>等效</strong>: - -[for (i of numbers) for (j of letters) if (i > 1) if(j > "a") i+j] -// ["2b", "2c", "3b", "3c"] - -[for (i of numbers) if (i > 1) [for (j of letters) if(j > "a") i+j]] -// [["2b", "2c"], ["3b", "3c"]],和下面的写法<strong>不等效</strong>: - -[for (i of numbers) [for (j of letters) if (i > 1) if(j > "a") i+j]] -// [[], ["2b", "2c"], ["3b", "3c"]] -</pre> - -<h2 id="规范">规范</h2> - -<p>最初起草在ECMAScript 6草案中,但在第27版(2014年8月)中被移除。 请参阅ES 6的旧修订版的规范语义。</p> - -<h2 id="浏览器兼容性">浏览器兼容性</h2> - -<div class="hidden"><span style='background-color: transparent; color: #333333; display: inline !important; float: none; font-family: "Open Sans",arial,x-locale-body,sans-serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal;'>本页的浏览器兼容性表都是基于结构化数据,如果你想更新数据.可以查看</span> <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> <span style='background-color: transparent; color: #333333; display: inline !important; float: none; font-family: "Open Sans",arial,x-locale-body,sans-serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal;'>并且请给我们发送合并请求</span>.</div> - -<p>{{Compat("javascript.operators.array_comprehensions")}}</p> - -<h2 id="同旧版的JS1.7JS1.8数组推导的不同之处">同旧版的JS1.7/JS1.8数组推导的不同之处</h2> - -<p> </p> - -<div class="warning">JS1.7/JS1.8数组推导 在Gecko的46版本中已经被移除了 ({{bug(1220564)}}).</div> - -<p><strong>旧版数组推导语法 (请不要再使用了!):</strong></p> - -<pre class="brush: js example-bad">[X for (Y in Z)] -[X for each (Y in Z)] -[X for (Y of Z)] -</pre> - -<p>不同点:</p> - -<ul> - <li>ESNext数组推导为每个"for"创建了一个作用域而取代了整个作用域. - <ul> - <li>Old: <code>[()=>x for (x of [0, 1, 2])][1]() // 2</code></li> - <li>New: <code>[for (x of [0, 1, 2]) ()=>x][1]() // 1, each iteration creates a fresh binding for x. </code></li> - </ul> - </li> - <li>ESNext 同"for"进行赋值而取代了旧的赋值表达式. - <ul> - <li>Old: <code>[i * 2 for (i of numbers)]</code></li> - <li>New: <code>[for (i of numbers) i * 2]</code></li> - </ul> - </li> - <li>ESNext数组推导可由多个if和for组成</li> - <li>ESNext数组推导只和<code>{{jsxref("Statements/for...of", "for...of")}}</code>迭代才有效,而不会同 <code>{{jsxref("Statements/for...in", "for...in")}}</code> 迭代.</li> -</ul> - -<p>点击查看 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1220564#c42">Bug 1220564, comment 42</a> 并提出建设性建议.</p> - -<h2 id="See_also" name="See_also">相关链接</h2> - -<ul> - <li><a href="/zh-CN/docs/Web/JavaScript/Reference/Statements/for...of"><code>for...of</code></a></li> - <li>{{jsxref("Operators/Generator_comprehensions", "生成器推导式", "" ,1)}}</li> -</ul> diff --git a/files/zh-cn/web/javascript/reference/operators/expression_closures/index.html b/files/zh-cn/web/javascript/reference/operators/expression_closures/index.html deleted file mode 100644 index e5dee577bc..0000000000 --- a/files/zh-cn/web/javascript/reference/operators/expression_closures/index.html +++ /dev/null @@ -1,76 +0,0 @@ ---- -title: Expression closures -slug: Web/JavaScript/Reference/Operators/Expression_closures -tags: - - Functions - - JavaScript - - Reference -translation_of: Archive/Web/JavaScript/Expression_closures ---- -<div class="warning"><strong>非标准,不要使用!</strong><br> -闭包表达式语法是废弃的 SpiderMonkey 的特性,并且<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1083458">将被移除</a>。为了长远使用,考虑使用<a href="/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions">箭头函数</a>。</div> - -<div>{{jsSidebar("Operators")}}</div> - -<p>表达式闭包是定义简单函数的一种便捷方式。</p> - -<h2 id="语法">语法</h2> - -<pre class="syntaxbox">function [<em>name</em>]([<em>param1</em>[, <em>param2[</em>, ..., <em>paramN</em>]]]) - <em>expression</em> -</pre> - -<h3 id="参数">参数</h3> - -<dl> - <dt><code>name</code></dt> - <dd>函数名。函数名可以省略不写,称为匿名函数。函数名仅在函数体有效。</dd> - <dt><code>paramN</code></dt> - <dd>形参名。一个函数最多可以有255个参数。</dd> - <dt><code>expression</code></dt> - <dd>构成函数体的表达式。</dd> -</dl> - -<h2 id="描述">描述</h2> - -<p>这一附加特性只是编写简单函数的快捷方式,让语言更类似通常的 <a class="external" href="http://en.wikipedia.org/wiki/Lambda_calculus#Lambda_calculus_and_programming_languages">Lambda 标记</a>。</p> - -<p>JavaScript 1.7 及之前版本:</p> - -<pre class="brush: js">function(x) { return x * x; }</pre> - -<p>JavaScript 1.8:</p> - -<pre class="brush: js">function(x) x * x</pre> - -<p>该语法支持省略花括号和'return'语句。使用这种编码的目的只是为了在句法上使得代码更加简化,但除此之外没有其他好处。</p> - -<h2 id="示例">示例</h2> - -<p>一种绑定事件监听器的便捷方式:</p> - -<pre class="brush: js"> document.addEventListener("click", function() false, true); -</pre> - -<p>在 JavaScript 1.6 中的一些数组函数中使用该标记:</p> - -<pre class="brush: js">elems.some(function(elem) elem.type == "text"); -</pre> - -<h2 id="浏览器兼容">浏览器兼容</h2> - -<div class="hidden">The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</div> - -<p>{{Compat("javascript.operators.expression_closures")}}</p> - -<h2 id="相关链接">相关链接</h2> - -<ul> - <li>{{jsxref("Functions_and_function_scope", "Functions and function scope")}}</li> - <li>{{jsxref("Function")}}</li> - <li>{{jsxref("Statements/function", "function statement")}}</li> - <li>{{jsxref("Operators/function", "function expression")}}</li> - <li>{{jsxref("Statements/function*", "function* statement")}}</li> - <li>{{jsxref("Operators/function*", "function* expression")}}</li> - <li>{{jsxref("GeneratorFunction")}}</li> -</ul> diff --git a/files/zh-cn/web/javascript/reference/operators/generator_comprehensions/index.html b/files/zh-cn/web/javascript/reference/operators/generator_comprehensions/index.html deleted file mode 100644 index 1442d50019..0000000000 --- a/files/zh-cn/web/javascript/reference/operators/generator_comprehensions/index.html +++ /dev/null @@ -1,193 +0,0 @@ ---- -title: Generator推导式 -slug: Web/JavaScript/Reference/Operators/Generator_comprehensions -translation_of: Archive/Web/JavaScript/Generator_comprehensions ---- -<div class="warning"><strong>非标准的。不要使用!</strong><br> -generator推导式是非标准的,而且它不太可能会被添加到ECMAScript。考虑到将来,请使用 {{jsxref("Statements/function*", "generator", "", 1)}}。 -<p> </p> -</div> - -<p>{{jsSidebar("Operators")}}</p> - -<p>生成器推导语法是一种JavaScript表达式,它允许您基于现有的可迭代对象快速组合新的生成器函数。</p> - -<p>许多编程语言中都存在推导。</p> - -<p>看下面,原来Generator推导式语法在SpiderMonkey的不同之处,它是基于对ECMAScript4的提议。</p> - -<h2 id="语法">语法</h2> - -<pre class="syntaxbox">(for (x of iterable) x) -(for (x of iterable) if (condition) x) -(for (x of iterable) for (y of iterable) x + y) -</pre> - -<h2 id="描述">描述</h2> - -<p>在Generator推导式中,这两种构成方式都是允许的:</p> - -<ul> - <li>{{jsxref("Statements/for...of", "for...of")}} </li> - <li>{{jsxref("Statements/if...else", "if")}}</li> -</ul> - -<p>for-of迭代器是构成的第一个部分。当由多重部分构成时,后面for-of和if构成方式都是被允许的。</p> - -<h2 id="示例">示例</h2> - -<h3 id="单个构成部分的_generator推导式:">单个构成部分的 generator推导式:</h3> - -<pre class="brush:js">(for (i of [ 1, 2, 3 ]) i*i ); -// generator function which yields 1, 4, and 9 - -[...(for (i of [ 1, 2, 3 ]) i*i )]; -// [1, 4, 9] - -var abc = [ "A", "B", "C" ]; -(for (letters of abc) letters.toLowerCase()); -// generator function which yields "a", "b", and "c" - -</pre> - -<h3 id="有if伴随的多重构成的gennerator推导式:">有if伴随的多重构成的gennerator推导式:</h3> - -<pre class="brush: js">var years = [ 1954, 1974, 1990, 2006, 2010, 2014 ]; - -(for (year of years) if (year > 2000) year); -// generator function which yields 2006, 2010, and 2014 - -(for (year of years) if (year > 2000) if(year < 2010) year); -// generator function which yields 2006, the same as below: - -(for (year of years) if (year > 2000 && year < 2010) year); -// generator function which yields 2006 -</pre> - -<h3 id="Generator推导式与Generator函数对比">Generator推导式与Generator函数对比</h3> - -<p>用一种简单的方式来理解generator推导式的语法并与generator函数来做个比较。</p> - -<p>Example 1: 仅是 generator.</p> - -<pre class="brush: js">var numbers = [ 1, 2, 3 ]; - -// Generator 函数 -(function*() { - for (let i of numbers) { - yield i * i; - } -})() - -// Generator 推导式 -(for (i of numbers) i*i ); - -// 结果: 两者都得到 yields [ 1, 4, 9 ] -</pre> - -<p>Example 2: 在 generator 中用if.</p> - -<pre class="brush: js">var numbers = [ 1, 2, 3 ]; - -// Generator 函数 -(function*() { - for (let i of numbers) { - if (i < 3) { - yield i * 1; - } - } -})() - -// Generator 推导式 -(for (i of numbers) if (i < 3) i); - -// 结果: 两者都得到 yields [ 1, 2 ]</pre> - -<h2 id="规范">规范</h2> - -<p>Generator推导式是最初在ECMAScript 2015中进行拟稿,但是在14年8月27号修订中被移除了。 请参阅较旧版本的ES2015规范语义.</p> - -<h2 id="浏览器兼容性">浏览器兼容性</h2> - -<p>{{CompatibilityTable}}</p> - -<div id="compat-desktop"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatNo}}</td> - <td>{{ CompatGeckoDesktop("30") }}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - </tr> - </tbody> -</table> -</div> - -<div id="compat-mobile"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{ CompatGeckoMobile("30") }}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatNo}}</td> - </tr> - </tbody> -</table> -</div> - -<h3 id="SpiderMonkey的具体实现笔记">SpiderMonkey的具体实现笔记</h3> - -<ul> - <li>{{jsxref("Statements/let", "let")}} 作为标识符,因为let当前仅可用于JS版本1.7和XUL脚本标记.</li> - <li>目前还不支持解构 ({{bug(980828)}}).</li> -</ul> - -<h3 id="与旧的JS1.7_JS1.8理解的区别">与旧的JS1.7 / JS1.8理解的区别</h3> - -<ul> - <li>ES2016 的解析为每个“for”节点创建一个范围,而不是作为一个整体的理解。 - <ul> - <li>Old: <code>[...(()=>x for (x of [0, 1, 2]))][1]() // 2</code></li> - <li>New: <code>[...(for (x of [0, 1, 2]) ()=>x)][1]() // 1, 每个迭代都会创建一个新的x的绑定事件。</code></li> - </ul> - </li> - <li> ES2016的解析以“for”而不是赋值表达式开头。 - <ul> - <li>Old: <code>(i * 2 for (i of numbers))</code></li> - <li>New: <code>(for (i of numbers) <code>i * 2</code>)</code></li> - </ul> - </li> - <li>ES2016 解析可以有多个if和for组件。</li> - <li>ES2016 解析仅这种方式工作<code>{{jsxref("Statements/for...of", "for...of")}}</code> 而不是<code>{{jsxref("Statements/for...in", "for...in")}}</code> 的方式迭代。</li> -</ul> - -<h2 id="相关链接">相关链接</h2> - -<ul> - <li>{{jsxref("Statements/for...of", "for...of")}}</li> - <li>{{jsxref("Operators/Array_comprehensions", "Array comprehensions")}}</li> -</ul> diff --git a/files/zh-cn/web/javascript/reference/statements/for_each...in/index.html b/files/zh-cn/web/javascript/reference/statements/for_each...in/index.html deleted file mode 100644 index 05c1043588..0000000000 --- a/files/zh-cn/web/javascript/reference/statements/for_each...in/index.html +++ /dev/null @@ -1,69 +0,0 @@ ---- -title: for each...in -slug: Web/JavaScript/Reference/Statements/for_each...in -translation_of: Archive/Web/JavaScript/for_each...in ---- -<div>{{jsSidebar("Statements")}}</div> - -<p>使用一个变量迭代一个对象的所有属性值,对于每一个属性值,有一个指定的语句块被执行。</p> - -<div class="noinclude"> -<div class="warning"> -<p>作为ECMA-357(<a href="/zh-CN/docs/E4X" title="/zh-CN/docs/E4X">E4X</a>)标准的一部分,for each...in语句已被废弃,E4X中的大部分特性已被删除,但考虑到向后兼容,for each...in只会被禁用而不会被删除,可以使用ES6中新的<a href="/zh-CN/docs/JavaScript/Reference/Statements/for...of" title="/zh-CN/docs/JavaScript/Reference/Statements/for...of">for...of</a>语句来代替。({{ bug("791343")}}.)</p> -</div> - -<div class="note"><code>for each...in</code> 是 <a class="external" href="http://www.ecma-international.org/publications/standards/Ecma-357.htm" title="http://www.ecma-international.org/publications/standards/Ecma-357.htm">ECMA-357 (E4X)</a> 标准的一部分,大部分非Mozilla浏览器都没有实现该标准,E4X并不是 ECMAScript 标准的一部分。</div> -</div> - -<h2 id="Syntax" name="Syntax">语法</h2> - -<pre class="syntaxbox"><code>for each (<em>variable</em> in <em>object</em>) { - <em>statement</em> -}</code></pre> - -<h2 id="Parameters" name="Parameters">参数</h2> - -<dl> - <dt><code>variable</code></dt> - <dd>用来遍历属性值的变量,前面的<code>var</code>关键字是可选的。该变量是函数的局部变量而不是语句块的局部变量。</dd> -</dl> - -<dl> - <dt><code>object</code></dt> - <dd>属性值会被遍历的对象。</dd> -</dl> - -<dl> - <dt><code>statement</code></dt> - <dd>遍历属性时执行的语句。如果想要执行多条语句,请用<a href="/zh-CN/docs/Web/JavaScript/Reference/Statements/block">块语句</a>(<code>{ ... }</code>) 将多条语句括住。</dd> -</dl> - -<h2 id="Description" name="Description">描述</h2> - -<p>一些对象的内置属性是无法被遍历到的,包括所有的内置方法,例如String对象的<code>indexOf</code>方法。不过,大部分的用户自定义属性都是可遍历的.</p> - -<h2 id="Examples" name="Examples">示例</h2> - -<h3 id="Example:_Using_for_each...in" name="Example:_Using_for_each...in">例子: 使用<code>for each...in</code></h3> - -<p><strong>警告:</strong>永远不要使用for each...in语句遍历数组,仅用来遍历常规对象。<a href="/zh-CN/docs/JavaScript/Reference/Statements/for...in#Description" title="JavaScript/Reference/Statements/for...in#Description">这里讲解了为什么这么说</a>。</p> - -<p>下面的代码片段演示如何遍历一个对象的属性值,并计算它们的和:</p> - -<pre class="brush:js">var sum = 0; -var obj = {prop1: 5, prop2: 13, prop3: 8}; - -for each (var item in obj) { - sum += item; -} - -print(sum); // 输出"26",也就是5+13+8的值</pre> - -<h2 id="See_also" name="See_also">参见</h2> - -<ul> - <li><a href="/zh-CN/docs/JavaScript/Reference/Statements/for...in" title="JavaScript/Reference/Statements/for...in">for...in</a> - 一个相似的语法,用来遍历对象的属性名称而非属性值.</li> - <li><a href="/zh-CN/docs/JavaScript/Reference/Statements/for...of" title="/zh-CN/docs/JavaScript/Reference/Statements/for...of">for...of</a> - 一个相似的语法,用来遍历可迭代对象,有时候效果等同于<code>for each</code>...<code>in</code>语句.</li> - <li><a href="/zh-CN/docs/JavaScript/Reference/Statements/for" title="JavaScript/Reference/Statements/for">for</a></li> - <li><a href="/zh-CN/docs/JavaScript/Guide/Predefined_Core_Objects#Array_Object">数组推导式</a> (该语句中可以使用for...in<code>,</code><code>for each</code>...<code>in,</code><code>for</code>...<code>of多种语法</code>)</li> -</ul> diff --git a/files/zh-cn/web/rdf/index.html b/files/zh-cn/web/rdf/index.html deleted file mode 100644 index df76c59ae3..0000000000 --- a/files/zh-cn/web/rdf/index.html +++ /dev/null @@ -1,82 +0,0 @@ ---- -title: RDF -slug: Web/RDF -tags: - - RDF -translation_of: Archive/Web/RDF ---- -<p> </p> -<div> - <p><b>资源说明框架(RDF)</b> 是一个元数据模型规范,常用来实现XML应用。该规范由万维网联盟(W3C).</p> - <p>RDF元数据模型想把外观中的资源建立声明,该声明是一个主题-断言-对象的表达,在RDF术语中被称为triple。这个主题是一个被描述的资源。描述的是该资源的特征或外观,并常表现为这个主题和对象之间的一个关系。而这个对象是某个关系对象或是某个特征的值。 {{ Ref("one") }}</p> -</div> -<table class="topicpage-table"> - <tbody> - <tr> - <td> - <h4 id=".E6.96.87.E6.A1.A3" name=".E6.96.87.E6.A1.A3"><a>文档</a></h4> - <dl> - <dt> - <a href="cn/XTech_2005_Presentations/Mozilla_RDF_%e5%bc%95%e6%93%8e%e6%8c%87%e5%af%bc">Mozilla RDF 引擎指导</a></dt> - <dd> - <small>This presentation shows new developments in the Mozilla RDF engine. These include plans to expose the RDF API to public web content, as well as performance and correctness improvements.</small></dd> - </dl> - <dl> - <dt> - <a class="external" href="http://www.xml.com/pub/a/2001/01/24/rdf.html">RDF是什么</a></dt> - <dd> - <small>Tim Bray's introduction to the Resource Description Framework, at <a class="external" href="http://www.xml.com">XML.com</a>.</small></dd> - </dl> - <dl> - <dt> - <a href="cn/RDF_%e9%97%ae%e9%a2%98%e9%9b%86">RDF 问题集</a></dt> - <dd> - <small>Frequently asked questions about the Resource Description Framework in Mozilla.</small></dd> - </dl> - <dl> - <dt> - <a href="cn/RDF_%e7%ae%80%e4%bb%8b">RDF 简介</a></dt> - <dd> - <small>A quick introduction to the Resource Description Framework.</small></dd> - </dl> - <dl> - <dt> - <a href="cn/RDF_%e6%95%b0%e6%8d%ae%e6%ba%90_How-To">RDF 数据源 How-To</a></dt> - <dd> - <small>A cookbook-style document describing how to create a native, client-side datasource that works with Mozilla's RDF implementation.</small></dd> - </dl> - <dl> - <dt> - <a href="cn/%e6%94%b6%e9%9b%86_In-Memory_%e6%95%b0%e6%8d%ae%e6%ba%90">收集 In-Memory 数据源</a></dt> - <dd> - <small>Using the <a href="cn/XPCOM">XPCOM</a> aggregation with the in-memory datasource.</small></dd> - </dl> - <p><span class="alllinks"><a>View All...</a></span></p> - </td> - <td> - <h4 id=".E7.A4.BE.E5.8C.BA" name=".E7.A4.BE.E5.8C.BA">社区</h4> - <ul> - <li>到 Mozilla 论坛...</li> - </ul> - <p>{{ DiscussionList("dev-tech-rdf", "mozilla.dev.tech.rdf") }}</p> - <ul> - <li><a class="external" href="http://www.ilrt.bris.ac.uk/discovery/rdf-dev/">RDF-Dev mailing list</a></li> - </ul> - <h4 id=".E5.B7.A5.E5.85.B7" name=".E5.B7.A5.E5.85.B7">工具</h4> - <ul> - <li><a class="external" href="http://planetrdf.com/guide/#sec-tools">RDF Editors and Tools</a></li> - <li><a class="external" href="http://www.w3.org/RDF/Validator/">RDF Validator</a></li> - </ul> - <h4 id=".E7.9B.B8.E5.85.B3.E4.B8.BB.E9.A2.98" name=".E7.9B.B8.E5.85.B3.E4.B8.BB.E9.A2.98">相关主题</h4> - <dl> - <dd> - <a href="cn/XML">XML</a></dd> - </dl> - </td> - </tr> - </tbody> -</table> -<p><span class="comment">Categories</span></p> -<p><span class="comment">Interwiki Language Links</span></p> -<p> </p> -<p>{{ languages( { "en": "en/RDF", "de": "de/RDF", "es": "es/RDF", "fr": "fr/RDF", "it": "it/RDF", "ja": "ja/RDF", "ko": "ko/RDF", "pl": "pl/RDF", "pt": "pt/RDF", "ru": "ru/RDF" } ) }}</p> diff --git a/files/zh-cn/web/security/information_security_basics/tcp_ip_安全/index.html b/files/zh-cn/web/security/information_security_basics/tcp_ip_安全/index.html deleted file mode 100644 index 5a8c1a68b0..0000000000 --- a/files/zh-cn/web/security/information_security_basics/tcp_ip_安全/index.html +++ /dev/null @@ -1,50 +0,0 @@ ---- -title: TCP/IP 安全 -slug: Web/Security/Information_Security_Basics/TCP_IP_安全 -translation_of: Archive/Security/TCP_IP ---- -<p>{{draft}}</p> - -<p>TCP/IP 在全世界被广泛应用于提供网络通信。 TCP/IP 通信由四个工作层组成。当用户想要通过网络传输数据时,数据就会从更高层通过中间层逐渐传递到最底层,每层都会添加对应的信息。在每一层, 逻辑单元通常由标头和有效载荷组成。有效载荷由上一层传递下来的信息组成,而头部包含特定于层的信息,例如地址。在应用程序层,有效负载是实际的应用程序数据。最底层通过物理网络发送累积数据;然后,数据通过层向上传递到目的地。基本上,由层生成的数据通过其下面的层封装在更大的容器中。从最高到最低的四个TCP / IP层如下所示。</p> - -<ul> - <li><strong>应用层</strong> 。 该层发送和接收特定应用程序的数据,例如域名系统(DNS),超文本传输协议(HTTP)和简单邮件传输协议(SMTP)。</li> - <li><strong>传输层。</strong> 该层提供面向连接或无连接的服务,用于在网络之间传输应用层服务。传输层可以任选地确保通信的可靠性。传输控制协议(TCP)和用户数据报协议(UDP)是常用的传输层协议。</li> - <li><strong>网络层。</strong> 该层通过网络根据特定路由发送数据包。 Internet协议(IP)是TCP / IP的基本网络层协议。网络层上的其他常用协议是因特网控制消息协议(ICMP)和因特网组管理协议(IGMP)。</li> - <li><strong>数据链路层。</strong> 该层处理物理网络组件上的通信。最着名的数据链路层协议是以太网。</li> -</ul> - -<p>存在用于TCP / IP模型的每一层的网络通信的安全控制。如前所述,数据从最高层传递到最低层,每层添加更多信息。因此,较高层的安全控制不能为较低层提供保护,因为较低层执行较高层不知道的功能。每层可用的安全控制包括:</p> - -<ul style="list-style-type: square;"> - <li><strong>应用层。</strong> 必须为每个应用程序建立单独的控制。例如,如果应用程序需要保护跨网络发送的敏感数据,则可能需要修改应用程序以提供此保护。虽然这为应用程序的安全性提供了非常高的控制和灵活性,但可能需要大量资源投入才能为每个应用程序正确添加和配置控件。设计一个密码健全的应用程序协议是非常困难的,正确实现它更具挑战性,因此创建新的应用程序层安全控制可能会产生漏洞。此外,某些应用程序,尤其是现成的软件,可能无法提供此类保护。虽然应用程序层控件可以保护应用程序数据,但它们无法保护TCP / IP信息(如IP地址),因为此信息存在于较低层。只要有可能,用于保护网络通信的应用层控制应该是基于标准的解决方案,这些解决方案已经使用了一段时间。一个例子是安全的多用途互联网邮件扩展(S / MIME),它通常用于加密电子邮件消息。</li> - <li><strong>传输层。</strong>此层的控件可用于保护两台主机之间的单个通信会话中的数据。由于IP信息是在网络层添加的,因此传输层控件无法保护它。传输层协议的最常见用途是保护HTTP流量;通常使用传输层安全性(TLS)协议。 (TLS是SSL版本3的基于标准的版本。有关TLS的更多信息,请参阅RFC 4346,TLS协议版本1.1,可从https://www.ietf.org/rfc/rfc4346.txt 获得。另一个很好的来源信息是NIST SP 800-52,传输层安全的选择和使用指南,可从https://csrc.nist.gov/publications/nistpubs/ )。TLS的使用通常要求每个应用程序支持TLS;但是,与通常涉及应用程序的广泛定制的应用程序层控件不同,传输层控件(如TLS)的干扰要小得多,因为它们不需要了解应用程序的功能或特性。尽管使用TLS可能需要修改某些应用程序,但TLS是经过充分测试的协议,其中有多个实现已添加到许多应用程序中,因此与在应用程序层添加保护相比,它是一种风险相对较低的选项。传统上,TLS已用于保护基于HTTP的通信,并可与SSL门户VPN一起使用。</li> - <li><strong>网络层。</strong>此层的控件可应用于所有应用程序;因此,它们不是特定于应用程序的。例如,可以在该层保护两个主机或网络之间的所有网络通信,而无需修改客户端或服务器上的任何应用程序。在某些环境中,网络层控制(如互联网协议安全性(IPsec))提供了比传输或应用程序层控制更好的解决方案,因为向单个应用程序添加控件存在困难。网络层控制还为网络管理员提供了一种强制执行某些安全策略的方法。网络层控制的另一个优点是,由于在该层添加了IP信息(例如,IP地址),所以控制可以保护分组内的数据和每个分组的IP信息。但是,与传输和应用程序层控制相比,网络层控制提供的保护特定应用程序的控制和灵活性较低SSL隧道VPN提供了保护TCP和UDP通信(包括客户端/服务器和其他网络流量)的能力,因此可用作网络层VPN。</li> - <li><strong>数据链路层。</strong> 数据链路层控制应用于特定物理链路上的所有通信,例如两个建筑物之间的专用电路或连接到Internet服务提供商(ISP)的拨号调制解调器连接。专用电路的数据链路层控制通常由称为数据链路加密器的专用硬件设备提供;用于其他类型连接的数据链路层控制,例如拨号调制解调器通信,通常通过软件提供。由于数据链路层位于网络层之下,因此该层的控制可以保护数据和IP信息。与其他层的控件相比,数据链路层控件相对简单,这使得它们更容易实现;此外,它们还支持IP以外的其他网络层协议。由于数据链路层控制特定于特定物理链路,因此它们无法保护与多个链路的连接,例如通过Internet建立VPN。基于互联网的连接通常由链接在一起的若干物理链路组成;保护与数据链路层控制的这种连接将需要为每个链路部署单独的控制,这是不可行的。数据链路层协议已经使用多年,主要是为不应信任的特定物理链路提供额外保护。</li> -</ul> - -<p>由于它们可以同时为许多应用程序提供保护而无需对其进行修改,因此经常使用网络层安全控制来保护通信,尤其是在诸如因特网的共享网络上。网络层安全控制提供单一解决方案,用于保护所有应用程序的数据,以及保护IP信息。然而,在许多情况下,另一层的控制比网络层控制更适合提供保护。例如,如果只有一个或两个应用程序需要保护,则网络层控制可能过多。 SSL等传输层协议最常用于为与各个基于HTTP的应用程序进行通信提供安全性,但它们也用于为其他类型的应用程序(如SMTP,存在点(POP),Internet)的通信会话提供保护。消息访问协议(IMAP)和文件传输协议(FTP)。由于所有主要的Web浏览器都包含对TLS的支持,因此希望使用受TLS保护的基于Web的应用程序的用户通常不需要安装任何客户端软件或重新配置其系统。传输层安全协议的较新应用程序保护HTTP和非HTTP应用程序通信,包括客户端/服务器应用程序和其他网络流量。每一层的控件都提供了其他层控件的优点和功能。</p> - -<p>SSL是最常用的传输层安全控制。根据SSL的实现和配置方式,它可以提供以下类型的保护的任意组合:</p> - -<ul style="list-style-type: square;"> - <li><strong>机密性。</strong> SSL可以确保未授权方无法读取数据。这是通过使用加密算法和秘密密钥加密数据来实现的 - 秘密密钥是仅为双方交换数据所知的值。数据只能由拥有密钥的人解密。</li> - <li><strong>完整性。</strong> SSL可以确定数据是否在传输过程中(有意或无意)更改。通过生成消息认证码(MAC)值可以确保数据的完整性,MAC值是数据的密钥加密校验和。如果更改数据并重新计算MAC,则旧MAC和新MAC将不同。</li> - <li><strong>对等实体认证。</strong> 每个SSL端点都可以确认其希望与之通信的另一个SSL端点的标识,从而确保从预期的主机发送网络流量和数据。 SSL身份验证通常是单向执行的,向客户端验证服务器,但可以相互执行。</li> - <li><strong>重发保护。 </strong>相同的数据不会多次传送,并且数据不会严重无序传送。</li> -</ul> - - - -<div class="originaldocinfo"> -<h3 id="Original_Document_Information" name="Original_Document_Information">Original Document Information</h3> - -<ul> - <li>Author(s): Sheila Frankel, Paul Hoffman, Angela Orebaugh, and Richard Park</li> - <li>Title: National Institute of Standards and Technology (NIST) Special Publication 800-113, Guide to SSL VPNs</li> - <li>Last Updated Date: July 2008</li> - <li>Copyright Information: This document is not subject to copyright.</li> -</ul> -</div> - -<p>{{QuickLinksWithSubpages("/en-US/docs/Web/Security")}}</p> diff --git a/files/zh-cn/web/security/information_security_basics/vulnerabilities/index.html b/files/zh-cn/web/security/information_security_basics/vulnerabilities/index.html deleted file mode 100644 index e060234976..0000000000 --- a/files/zh-cn/web/security/information_security_basics/vulnerabilities/index.html +++ /dev/null @@ -1,47 +0,0 @@ ---- -title: Vulnerabilities -slug: Web/Security/Information_Security_Basics/Vulnerabilities -translation_of: Archive/Security/Vulnerabilities ---- -<div class="summary"> -<p>本文讨论漏洞,解释它们是什么以及它们在所有系统中的存在方式。</p> -</div> - -<p>漏洞是系统中的一个弱点,可被利用来对机密性,完整性和可用性产生负面影响。 可以通过多种方式对漏洞进行分类。 本文使用三个高级漏洞类别:软件缺陷,安全配置问题和软件功能滥用。 这些类别如下所述。</p> - -<h2 id="漏洞级别">漏洞级别</h2> - -<p> </p> - -<p>软件缺陷是由软件设计或编码中的意外错误引起的。比如输入验证错误,假如用户提供的输入未正确评估恶意字符串和与已知攻击相关的过长值。另一个示例是竞争条件错误,允许攻击者使用提升的权限执行特定操作。</p> - -<p>安全配置设置是软件安全性的一个元素,可以通过软件本身进行更改。设置的示例是提供对控制列表的访问的操作系统,该控制列表设置用户对文件的特权,以及提供用于启用或禁用由应用程序存储的敏感数据的加密的设置的应用程序。安全配置问题漏洞涉及使用对软件安全性产生负面影响的安全配置设置。</p> - -<p>软件功能是由软件提供的功能功能。软件功能滥用漏洞是一种漏洞,其中该功能还提供了破坏系统安全性的途径。这些漏洞是由软件设计者做出的信任假设允许软件提供有益的功能,同时也引入某人违反信任假设以破坏安全性的可能性引起的。例如,电子邮件客户端软件可能包含在电子邮件消息中呈现HTML内容的功能。攻击者可以制作包含超链接的欺诈性电子邮件,这些超链接在以HTML格式呈现时对收件人来说是良性的,但实际上在收件人点击时会将收件人带到恶意网站。 HTML内容呈现功能设计中的一个信任假设是用户不会收到恶意超链接并点击它们。</p> - -<p>在软件设计或软件组件(例如,软件实现的协议)期间引入软件特征滥用漏洞。信任假设可能是明确的 - 例如,设计者意识到安全漏洞并确定单独的安全控制会对其进行补偿。但是,信任假设通常是隐含的,例如创建特征而不首先评估它将引入的风险。威胁也可能在软件的生命周期或软件中使用的协议中发生变化。例如,地址解析协议(ARP)信任ARP回复包含媒体访问控制(MAC)和Internet协议(IP)地址之间的正确映射。 ARP缓存使用该信息提供有用的服务 - 以便在本地网络内的设备之间发送数据。但是,攻击者可能会生成错误的ARP消息来中毒系统的ARP表,从而发起拒绝服务或中间人攻击。 ARP协议在25年前已经标准化,从那时起威胁发生了很大的变化,因此其设计中固有的信任假设今天不太可能合理。</p> - -<p>可能很难将软件功能滥用漏洞与其他两个类别区分开来。例如,软件设计过程中的缺陷可能导致软件缺陷和滥用漏洞。但是,软件缺陷纯粹是消极的 - 它们对安全性或功能没有任何积极的好处 - 而软件特性由于提供额外的功能而导致滥用漏洞。</p> - -<p>对于可以启用或禁用的功能的滥用漏洞,可能存在混淆 - 在某种程度上,配置与安全配置问题。关键的区别在于,对于滥用漏洞,配置设置启用或禁用整个功能,并不特别改变其安全性;对于安全配置问题漏洞,配置设置仅更改软件的安全性。例如,禁用电子邮件中所有HTML使用的设置会对安全性和功能产生重大影响,因此与此设置相关的漏洞将是滥用漏洞。禁用电子邮件客户端中使用反网络钓鱼功能的设置仅对安全性有重大影响,因此具有该设置的漏洞将被视为安全配置问题漏洞。</p> - -<p> </p> - -<h2 id="The_Presence_of_Vulnerabilities">The Presence of Vulnerabilities</h2> - -<p>No system is 100% secure: every system has vulnerabilities. At any given time, a system may not have any known software flaws, but security configuration issues and software feature misuse vulnerabilities are always present. Misuse vulnerabilities are inherent in software features because each feature must be based on trust assumptions—and those assumptions can be broken, albeit involving significant cost and effort in some cases. Security configuration issues are also unavoidable for two reasons. First, many configuration settings increase security at the expense of reducing functionality, so using the most secure settings could make the software useless or unusable. Second, many security settings have both positive and negative consequences for security. An example is the number of consecutive failed authentication attempts to permit before locking out a user account. Setting this to 1 would be the most secure setting against password guessing attacks, but it would also cause legitimate users to be locked out after mistyping a password once, and it would also permit attackers to perform denial-of-service attacks against users more easily by generating a single failed login attempt for each user account.</p> - -<p>Because of the number of vulnerabilities inherent in security configuration settings and software feature misuse possibilities, plus the number of software flaw vulnerabilities on a system at any given time, there may be dozens or hundreds of vulnerabilities on a single system. These vulnerabilities are likely to have a wide variety of characteristics. Some will be very easy to exploit, while others will only be exploitable under a combination of highly unlikely conditions. One vulnerability might provide root-level access to a system, while another vulnerability might only permit read access to an insignificant file. Ultimately, organizations need to know how difficult it is for someone to exploit each vulnerability and, if a vulnerability is exploited, what the possible impact would be.</p> - -<div class="originaldocinfo"> -<h3 id="Original_Document_Information" name="Original_Document_Information">Original Document Information</h3> - -<ul> - <li>Author(s): Elizabeth LeMay, Karen Scarfone, and Peter Mell</li> - <li>Title: National Institute of Standards and Technology (NIST) Interagency Report 7864, The Common Misuse Scoring System (CMSS): Metrics for Software Feature Misuse Vulnerabilities</li> - <li>Last Updated Date: July 2012</li> - <li>Copyright Information: This document is not subject to copyright.</li> -</ul> -</div> - -<p>{{QuickLinksWithSubpages("/en-US/docs/Web/Security")}}</p> diff --git a/files/zh-cn/web/security/information_security_basics/机密性、完整性和可用性/index.html b/files/zh-cn/web/security/information_security_basics/机密性、完整性和可用性/index.html deleted file mode 100644 index 2c415ae3ea..0000000000 --- a/files/zh-cn/web/security/information_security_basics/机密性、完整性和可用性/index.html +++ /dev/null @@ -1,35 +0,0 @@ ---- -title: 机密性、完整性和可用性 -slug: Web/Security/Information_Security_Basics/机密性、完整性和可用性 -translation_of: 'Archive/Security/Confidentiality,_Integrity,_and_Availability' ---- -<div class="summary" style="margin: 0px 0px 20px; padding: 20px; border: 0px; font-weight: 700; color: rgb(77, 78, 83); font-family: 'Open Sans', sans-serif; font-size: 14px; font-style: normal; font-variant: normal; letter-spacing: normal; line-height: 21px; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; background: rgb(244, 247, 248);"> -<p style="margin: 0px; padding: 0px; border: 0px;">这篇文章讨论Web安全的三个主要目标:机密性、完整性和可用性。</p> -</div> - -<p>传统的关于信息安全的模型定义了三个Web安全的目标:保持机密性、完整性和可用性。每一个目标都阐述了信息安全的不同方面。</p> - -<h2 id="机密性">机密性</h2> - -<p>机密性指信息指在未验证状态下信息不能被用户获取。也就是说,只有被验证过的用户才能获得敏感数据。联想下你的银行卡,你是授权可以访问的,但是,银行的雇员们也可以访问,其他人不行。机密性不高也就意味着原本不能访问这些信息的人却能够获取到这些信息,不管是有意为之还是由于突发事故。保密失败,也就是通常所说的泄密,通常是很难被根治的。一旦秘密被泄露了,就不能重新加密它。如果你的银行账号被贴到了一个公共的网站上,每一个人就都能知道你的银行账号,收入等,而且这些信息并不会从他们的心里,纸上,电脑或者其他地方清除。今天几乎凡是媒体上报道的安全事故,都涉及到重大的机密损失。</p> - -<p>总的来说,机密信息的泄露指的就是本不能访问它的人却获得了这些信息。</p> - -<h2 id="完整性">完整性</h2> - -<p>完整性表示,经过验证的用户访问数据时,数据没有发生过任何改动,是原生的数据。想象下你有一个网站,并在上面出售商品。这时一个黑客在浏览你的网站,并恶意的修改了你产品的价格,这样一来,他就能够以任意的价格购买任何东西。这就是一个保护完整性的反面案例。因为你的信息--这个场景下,就是商品的价格--被修改了,而且你没有授权这一次变更。另一个反面案例,当你在连接一个网站的时候,攻击者重定向了你的传输到另外一个网站。在这种情况下,你被指向的网站并不是真实可靠的。</p> - -<h2 id="可用性">可用性</h2> - -<p>可用性指被验证过的用户可以轻易获得信息。</p> - -<div class="originaldocinfo"> -<h3 id="Original_Document_Information" name="Original_Document_Information">初始文档信息</h3> - -<ul> - <li>?作者:Karen Scarfone, Wayne Jansen, and Miles Tracy</li> - <li>标题:NIST Special Publication 800-123,《常规服务器安全指南》</li> - <li>最后更新日期:2008年7月</li> - <li>版权信息: 本文档不受版权保护。</li> -</ul> -</div> diff --git a/files/zh-cn/web/security/site_identity_button/index.html b/files/zh-cn/web/security/site_identity_button/index.html deleted file mode 100644 index fff6661ffd..0000000000 --- a/files/zh-cn/web/security/site_identity_button/index.html +++ /dev/null @@ -1,27 +0,0 @@ ---- -title: Site Identity Button -slug: Web/Security/Site_Identity_Button -tags: - - 安全 - - 火狐 -translation_of: Mozilla/Firefox/Site_identity_button ---- -<p> <a href="https://support.mozilla.org/kb/how-do-i-tell-if-my-connection-is-secure">Site Identity Button</a> 是火狐的一个特性,用于向用户提示更多他们已经访问过的网站的信息。</p> - -<p>这个特性的使用取决于你网站的配置,按钮会显示许多不同的图标。</p> - -<p>如果站点身份按钮没有按照您的配置显示出来的话(如你想要看到一个绿色的锁却显示一个橙色的三角图标),你可以打开<a href="/en-US/docs/Tools/Web_Console">火狐开发者工具的控制台</a>,在控制台里能找到一些原因:</p> - -<ol> - <li>确定您的控制台在'security'目录下显示信息。</li> - <li>强制刷新有问题的站点</li> - <li>耐心等待可能会出现的一些安全信息</li> -</ol> - -<p>由于以下的原因之一,UI的安全等级将会降低:</p> - -<ul> - <li>mixed content - 页面是经过TLS传输,但是页面没有经过subresources加载;这种情况下,在控制台里会看到‘mixed content’的信息提示。</li> - <li>Use of a weak cipher - 当使用TLS时而强密码是不可用的,会显示一些关于弱密码的信息提示(如RC4)</li> - <li>Insecure renegotation - 老版本的TLS在设计上有一个缺陷;如果您的服务在使用低版本的TLS,UI的等级将会降低且控制台不会有任何信息提示。</li> -</ul> diff --git a/files/zh-cn/web/svg/faq/index.html b/files/zh-cn/web/svg/faq/index.html deleted file mode 100644 index 59ca239079..0000000000 --- a/files/zh-cn/web/svg/faq/index.html +++ /dev/null @@ -1,100 +0,0 @@ ---- -title: 与SVG、Mozilla有关的常见问题 -slug: Web/SVG/FAQ -tags: - - SVG - - SVG FAQ - - 需要更新 -translation_of: Archive/Mozilla/SVG_FAQ ---- -<div class="note"><strong>注意:</strong>这个页面可能有点过时了。</div> - -<h3 id="What_is_the_status_of_the_SVG_implementation.3F" name="What_is_the_status_of_the_SVG_implementation.3F">SVG的编译器正处于哪种状态?</h3> - -<p>我们目前维护了两个文档用来帮助回答这个问题:<a href="/en/SVG_in_Firefox" title="en/SVG_in_Firefox">status page for SVG in Firefox 1.5+</a> 和 <a href="/en/Mozilla_SVG_Status" title="en/Mozilla_SVG_Status">a status page for SVG in the development trunk</a>.</p> - -<h3 id="Why_does_Mozilla_show_source_code.2Fgibberish_instead_of_SVG.3F" name="Why_does_Mozilla_show_source_code.2Fgibberish_instead_of_SVG.3F">为什么Mozilla会显示源代码或乱码,而不是显示SVG图像?</h3> - -<p>这有两种可能的原因:SVG文件中有一个小错误,或者服务器配置不对。</p> - -<p>如果源码的顶部有灰色区域,灰色区域里有文字“This XML file does not appear to have any style information associated with it(该XML文件找不到任何与它关联的样式信息)”,则问题是与SVG关。作为一个合未能的根SVG文件中的<svg>标签,必须至少跟随两个“命名空间绑定”。</p> - -<pre><svg xmlns="http://www.w3.org/2000/svg" -xmlns:xlink="http://www.w3.org/1999/xlink"> -</pre> - -<p>实际上第二个绑定并非总是必要的,但是除非你了解命名空间,我们<strong>强烈</strong>建议你包含它。欲了解更多信息,请看这个<a href="http://jwatt.org/svg/authoring/#server-configuration">链接</a>。</p> - -<p>If source code is displayed without a gray area at the top, or if you just see gibberish, then the problem is server misconfiguration. When servers send user agents an SVG file they must tell the user agent that the file has the MIME type "image/svg+xml", and if the SVG file is stored gzipped they must tell the browser that too. Mozilla is strict about this, and no, it's not a bug. Failing to respect the MIME types servers send is incorrect and has been a source of security holes in other browsers. Mozilla will not be changing this behaviour. For more information on server configuration for SVG see <a class="external" href="http://jwatt.org/svg/authoring/#server-configuration">this link</a>.</p> - -<h3 id="Why_does_Mozilla_show_an_.22XML_Parsing_Error.22_message_instead_of_SVG.3F" name="Why_does_Mozilla_show_an_.22XML_Parsing_Error.22_message_instead_of_SVG.3F">为什么Mozilla显示一个“XML解析错误”消息,而不是显示SVG?</h3> - -<p>This is an XML debugging message to help XML authors correct errors in their XML documents. Mozilla will show this message when there's an XML well formedness error in the file it tried to load. (It doesn't mean there's an error in Mozilla.) There are many different XML errors, but the most common one in SVG files is "XML Parsing Error: prefix not bound to a namespace". This is (almost certainly) because the 'xmlns:xlink' attribute has been used in the file without including the following two namespace bindings on the root <code><svg></code> tag.</p> - -<pre class="code"><svg xmlns="http://www.w3.org/2000/svg" -xmlns:xlink="http://www.w3.org/1999/xlink"> -</pre> - -<p>确保你的所有的SVG文件都绑定了它。欲了解更多信息请阅读这个<a href="http://jwatt.org/svg/authoring/#namespace-binding">链接</a>。</p> - -<h3 id="Why_am_I_asked_to_choose_a_program_to_open_SVG_files.3F" name="Why_am_I_asked_to_choose_a_program_to_open_SVG_files.3F">为什么我们被要求选择一个程序以打开SVG文件?</h3> - -<p>When you try to load SVG files from some websites you may get a dialogue asking you "What should Firefox do with this file?". This is either because your browser doesn't support SVG (you must have Mozilla Firefox 1.5 or newer), or because the webpage/server isn't correctly telling Mozilla that the file contains SVG. For example, webpages that embed SVG using the <code><object></code> or <code><embed></code> tags must have a 'type' attribute assigned with the correct SVG MIME type of "image/svg+xml". If the MIME type specified is wrong (for example image/svg-xml) Mozilla won't recognise it. If that isn't the problem, then it may be that the server hosting the website is misconfigured. For information on configuring servers for SVG see <a class="external" href="http://jwatt.org/svg/authoring/#server-configuration">this link</a>.</p> - -<h3 id="Why_am_I_asked_to_install_a_plug-in_to_view_SVG_files.3F" name="Why_am_I_asked_to_install_a_plug-in_to_view_SVG_files.3F">为什么我被要求安装一个插件以查看SVG文件?</h3> - -<p>This is probably because there is an <code><embed></code> or <code><object></code> tag in the HTML page and its 'type' attribute is set to the wrong MIME type. The SVG MIME type is <code>image/svg+xml</code> (not <code>image/svg-xml</code> or anything else for that matter). Correct this mistake or ask the document maintainer to correct it.</p> - -<h3 id="How_should_I_report_bugs_in_Mozilla_SVG.3F" name="How_should_I_report_bugs_in_Mozilla_SVG.3F">我需要如何在Mozilla SVG中报告bug?</h3> - -<p>If you discover any problems with our SVG implementation that you think we should know about then we'd like to hear from you. To help us make the best use of our time, please first search in the <a class="link-https" href="https://bugzilla.mozilla.org/query.cgi?product=Core&component=SVG">SVG component of our bug database</a> to check that the issue hasn't already been reported. If you can't find a matching bug please <a class="link-https" href="https://bugzilla.mozilla.org/enter_bug.cgi?product=Core&component=SVG">file a new SVG bug report</a>, preferably attaching a (very small!) SVG file that demonstrates the bug. If you have any problems with the bug database feel free to <a href="#Original_Document_Information">contact contact us</a>.</p> - -<h3 id="Can_I_use_a_plugin_for_SVG_instead_of_Mozilla.27s_native_support.3F" name="Can_I_use_a_plugin_for_SVG_instead_of_Mozilla.27s_native_support.3F">我可以使用一个SVG的插件代替Mozilla的原生支持吗?</h3> - -<p>Individuals can choose to use a plugin to view SVG in Mozilla on their own computers, but there is no way for SVG content authors to make Mozilla use a plugin when people view the SVG files on their website. The native SVG support must be turned off before Mozilla will look to see if there's an SVG plugin installed. This is done by toggling a hidden user configuration preference (pref). To access the pref type <code>about:config</code> into the URL bar, then type <code>svg.enabled</code> into the Filter field. When you double click on the pref you will see its value change to and from true/false, turning the native support on/off.</p> - -<h3 id="How_does_Mozilla.27s_SVG_implementation_compare_to_Adobe.27s.3F" name="How_does_Mozilla.27s_SVG_implementation_compare_to_Adobe.27s.3F">Mozilla的SVG编译器与Adobe的编译器相比如何?</h3> - -<p>Mozilla's native implementation is less complete than Adobe SVG Viewer's in general. There are major features such as filters and SMIL based animation that have still to be implemented in Mozilla. However, Mozilla's implementation already supports some things that Adobe's lacks, particularly parts of the XML and SVG DOMs. For example we support SVG exceptions and SVGTransform objects.</p> - -<h3 id="How_do_you_install_Adobe.27s_SVG_Viewer_in_Mozilla.3F" name="How_do_you_install_Adobe.27s_SVG_Viewer_in_Mozilla.3F">你该如何在Mozilla中安装Adobe的SVG浏览器?</h3> - -<p>The SVG project is about Mozilla's native implementation of SVG, not Adobe/Corel/whoever's plug-in. However, we might as well answer this question to save you searching for this information elsewhere. See <a class="external" href="http://plugindoc.mozdev.org/windows1.html#AdobeSVG">these install instructions</a> on mozdev.org. It's also useful to know that you can check whether Mozilla has recognised your plug-ins by typing 'about:plugins' into your address bar (linking to that doesn't work for security reasons).</p> - -<h3 id="Does_Mozilla_work_with_Corel.27s_SVG_plug-in.3F" name="Does_Mozilla_work_with_Corel.27s_SVG_plug-in.3F">Mozilla可以与Corel的SVG插件共事吗?</h3> - -<p>There are reports that it does, but that it's slower than the Adobe plug-in. See <a class="external" href="http://plugindoc.mozdev.org/windows1.html#CorelSVG">this document</a> for information on how to install it.</p> - -<h3 id="Can_you_have_both_native_SVG_support_and_an_SVG_plug-in_installed.3F" name="Can_you_have_both_native_SVG_support_and_an_SVG_plug-in_installed.3F">原生SVG支持以及SVG插件安装可以共存的吗?</h3> - -<p>Yes. If the plug-in works with the equivalent non-SVG version of Mozilla, then it should also work in the SVG enabled version. To be able to use it, you must make sure the <a class="external" href="http://weblogs.mozillazine.org/tor/archives/2005/02/important_svg_b.html">svg.enabled</a> pref is set to false. This will disable the native SVG support.</p> - -<h3 id="Does_the_.3Cembed.3E_tag_support_SVG_documents.3F" name="Does_the_.3Cembed.3E_tag_support_SVG_documents.3F"><code><embed></code> 标签支持SVG文档吗?</h3> - -<p>Yes. As of 2004-11-11, builds with native SVG support will use the native support to render SVG documents that are embeded by reference into an HTML document using the <code><embed></code> tag. Note that this capability was added to support legacy content. The <code><object></code> tag should be used in preference to the <code><embed></code> tag in new content whenever possible.</p> - -<p>The first milestone builds that will have this support will be SVG enabled builds of Firefox 1.5.</p> - -<h3 id="What_can_I_do_to_help_the_SVG_project.3F" name="What_can_I_do_to_help_the_SVG_project.3F">我可以为SVG项目做什么?</h3> - -<p>Okay so maybe this isn't such a frequently asked question, but if it was, just think how much further on with our SVG implementation we could be! We're always looking for help from anyone willing to lend a hand. If you're a C++ programmer interested in working on the SVG implementation, please <a href="#Original_Document_Information">contact us</a> and we'll be happy to help you get involved. Alternatively, if you're an SVG user you can help by testing the SVG enabled nightlies and filing bugs with <a class="external" href="http://wiki.mozilla.org/MozillaQualityAssurance:Triage#How_to_Really.2C_Really_Help_Developers_on_Bugs_--_Minimal_Testcases">minimal testcases</a> whenever you encounter a problem. If you can't do either of these things you should still feel free to ask us friendly questions and give us constructive feedback.</p> - -<h3 id="Who.27s_currently_working_on_what.3F" name="Who.27s_currently_working_on_what.3F">当前在做什么工作?</h3> - -<p>Other than reviewing patches and fixing the occassional bug, <a class="link-mailto" href="mailto:alex@croczilla.com">Alex</a> is currently taking a break from active SVG development to concentrate on 'real work' and cool stuff like <a class="external" href="http://croczilla.com/xtf/">XTF</a> and <a class="external" href="http://croczilla.com/jssh/">JSSh</a>. <a class="link-mailto" href="mailto:tor@acm.org">Tim</a> is working on implementing <code><filter></code> and working on items that need to be done before turning on SVG by default. After recently implementing gradients, <a class="link-mailto" href="mailto:scootermorris@comcast.net">Scooter</a> is working on fixing some issues that remain outstanding and fixing <code><switch></code>. <a class="link-mailto" href="mailto:jonathan.watt@strath.ac.uk">Jonathan</a> is working on various bugs, especially those that need to be fixed before SVG can be enabled in the official builds. <a class="link-mailto" href="mailto:daa@rm.incc.net">David</a> continues to create SVG enabled nightlies and answer build related questions as he has done for some time. Finally, occasional fixes are provided by other Mozilla hackers.</p> - -<h3 id="How_can_I_get_in_contact_with_you.3F" name="How_can_I_get_in_contact_with_you.3F">怎样和你联系?</h3> - -<p>The best way to get in contact with us is to join the <a class="link-irc" href="irc://irc.mozilla.org/svg">#svg channel</a> on mozilla.org's IRC server. This is where most of us hang out to discuss issues relating to the SVG implementation. If you don't have an IRC client then install <a class="link-https" href="https://addons.mozilla.org/en-US/firefox/addon/16">ChatZilla</a> into Mozilla/Mozilla Firefox (note it may already be built in). Clicking on the link above should then take you straight there. If you'd prefer to contact us by email you can send an email to our newsgroup <a class="link-news" href="news://news.mozilla.org/mozilla.dev.tech.svg">mozilla.dev.tech.svg</a> which is <a class="external" href="http://groups.google.com/group/mozilla.dev.tech.svg/topics">archived here</a>. Alternatively you can email any of us directly of course (see the preceeding question for our email addresses).</p> - -<div class="originaldocinfo"> -<h2 id="Original_Document_Information" name="Original_Document_Information">Original Document Information</h2> - -<ul> - <li>Author(s): <a class="link-mailto" href="mailto:jwatt@jwatt.org">Jonathan Watt</a></li> - <li>Last Updated Date: November 6, 2006</li> - <li>Copyright Information: Portions of this content are © 1998–2007 by individual mozilla.org contributors; content available under a Creative Commons license | <a class="external" href="http://www.mozilla.org/foundation/licensing/website-content.html">Details</a>.</li> -</ul> -</div> - -<p>{{ languages( { "ja": "ja/Mozilla_SVG_Project_FAQ" } ) }}</p> |