blink() 方法真的被弃用了吗?

Is the blink() method really deprecated?

我不是指臭名昭著的 HTML 元素 <blink>, but the JavaScript function String.prototype.blink。 我的 link 中的 MDN 页面——以及 Google 找到的其他一些来源——表明这是一个已弃用的功能(W3Schools 更进一步并将其列为非标准,错误地指出当前的任何浏览器都不支持它,但无论如何...)

alert("Hello World!".blink());

查看 ES6 规范(当前 RC 为 34)后,我找不到任何证据支持这些说法:显然,规范中没有任何内容表明 blink 方法已弃用、过时或非标准。

其他字符串方法也是如此 bigboldfixedfontcolorfontsizeitalicsstrikesubsup:虽然相应的 HTML 元素已弃用,但 JavaScript 方法看起来不像它们。

当然,我的来源可能不准确,但 MDN 参考通常是相当可靠的,所以我怀疑我在这里忽略了什么。

其他人可以证实或揭穿 blink 方法已被弃用的事实吗?消息来源表示赞赏。

JavaScript 和 HTML(至少在客户端)链接在一起。 blink 方法执行以下操作(根据 MDN):

The blink() method creates a HTML element that causes a string to blink.

由于 <blink> 标签已弃用,或者至少被归类为不合格的功能...

The element is a non-standard element. HTML5 classifies it as a non-conforming feature.

来源:http://www.w3.org/wiki/HTML/Elements/blink

...而blink方法生成了这样一个废弃的标签,我认为可以推断出JavaScript方法也被废弃了。

但是,我找不到任何官方来源说这么多,所以我知道这是一个不完美的答案。

-编辑-

正如@ssube 在评论中指出的那样:A) ES6 标准甚至还没有最终确定,B) 它的草案(可以在这里找到:http://wiki.ecmascript.org/doku.php?id=harmony:specification_drafts)甚至没有其中 "deprecated" 个字。所以从某种意义上说,blink 方法确实没有被弃用,因为 nothing 被弃用了。

但是,似乎任何负责任的文档站点(例如 MDN)都会将其列为已弃用,因为它会生成已弃用的标签,这是其 "deprecated" 状态的真正来源。

我发现了什么:

Deprecated

This feature has been removed from the Web standards. Though some browsers may still support it, it is in the process of being dropped. Do not use it in old or new projects. Pages or Web apps using it may break at any time.

来源:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/blink

希望对您有所帮助

由于 ES5 和 ES6 规范都没有在任何地方使用 "deprecated" 这个词,这让我相信方法 中的 none 已被弃用 。他们是否应该是完全不同的事情...

它们可能会生成已被负责 HTML 或 DOM API 的工作组弃用的标签,但 ECMAScript 规范似乎无法识别(或在最少使用)已弃用方法的概念或 类.

Javascript 通常没有弃用的概念,即使在语言中,如所讨论的 in this question. Some language features largely considered ambiguous or poor practice, such as the with statement, are not marked as "deprecated" in any official reference I can find. Methods like unescape are marked as deprecated in their MDN docs,但规范中没有。


我认为 Annex B 顶部的描述非常清楚,其中定义了所有这些方法(强调我的):

The ECMAScript language syntax and semantics defined in this annex are required when the ECMAScript host is a web browser. The content of this annex is normative but optional if the ECMAScript host is not a web browser.

NOTE: This annex describes various legacy features and other characteristics of web browser based ECMAScript implementations. All of the language features and behaviours specified in this annex have one or more undesirable characteristics and in the absence of legacy usage would be removed from this specification. However, the usage of these features by large numbers of existing web pages means that web browsers must continue to support them. The specifications in this annex defined the requirements for interoperable implementations of these legacy features.

These features are not considered part of the core ECMAScript language. Programmers should not use or assume the existence of these features and behaviours when writing new ECMAScript code. ECMAScript implementations are discouraged from implementing these features unless the implementation is part of a web browser or is required to run the same legacy ECMAScript code that web browsers encounter.


请注意,大多数字符串方法在 ES5 中都没有提及。就网络而言,浏览器供应商经常做自己的事情并添加自定义扩展。在这种情况下,TC39 委员会决定至少在规范中提及它们很重要。