3

I don't mean the infamous HTML element <blink>, but the JavaScript function String.prototype.blink. The MDN page in my link - but also a few other sources found by Google - indicate that this is a deprecated feature (W3Schools goes even further and lists it as nonstandard, incorrectly noting that it's not supported by any current browser, but anyway...)

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

After a look into the ES6 specification (current RC is 34), I couldn't find any evidence for those claims: apparently, nothing in the spec suggests that the blink method is deprecated, obsolete or nonstandard.

Same thing for the other string methods big, bold, fixed, fontcolor, fontsize, italics, strike, sub, sup: while the respective HTML elements are deprecated, the JavaScript methods don't look like they are.

Of course, my sources may be inaccurate, but the MDN reference is usually quite reliable, so I'm suspecting that I'm overlooking something here.

Can someone else confirm or debunk the fact that the blink method is deprecated? Sources appreciated.

machineghost
  • 33,529
  • 30
  • 159
  • 234
GOTO 0
  • 42,323
  • 22
  • 125
  • 158
  • 2
    I can't find the word "deprecated" in the ES5 or ES6 specs, so I'm not sure they acknowledge such a thing. – ssube Feb 25 '15 at 20:44
  • @ssube I noticed that too, but then I wonder who decides what's deprecated and what is not. – GOTO 0 Feb 25 '15 at 20:49
  • It would lead me to believe nobody does. The DOM/DOM API group may deprecate tags on their side, but if ES doesn't mark anything as deprecated, then none of the methods really are. – ssube Feb 25 '15 at 20:50

4 Answers4

3

As neither the ES5 nor the ES6 spec uses the word "deprecated" anywhere, that leads me to believe that none of the methods are deprecated. Whether they should be is an entirely different matter...

They may produce tags that have been deprecated by the working group in charge of HTML or the DOM API, but the ECMAScript spec does not seem to recognize (or at least use) the concept of deprecated methods or classes.

Javascript in general doesn't have a concept of deprecation, even within the language, as discussed 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, but not the spec.

Community
  • 1
  • 1
ssube
  • 47,010
  • 7
  • 103
  • 140
2

JavaScript and HTML (on the client side at least) are linked together. The blink method does the following (as per MDN):

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

Since the <blink> tag is deprecated, or at least classified as a non-conforming feature ...

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

Source: http://www.w3.org/wiki/HTML/Elements/blink

... and the blink method generates such a deprecated tag, I think it's inferred that the JavaScript method is deprecated as well.

However, I can't find any official source saying as much, so I understand this is a less than perfect answer.

-EDIT-

As @ssube noted in a comment: A) the ES6 standard isn't even finalized yet, B) the drafts of it (which can be found here: http://wiki.ecmascript.org/doku.php?id=harmony:specification_drafts) don't even have the word "deprecated" in them. So it seems like in some sense it is true that the blink method isn't deprecated, because nothing is deprecated.

However, it seems any responsible documentation site (eg. MDN) is going to list it as deprecated because of it generating a deprecated tag, and that's the true origin of its "deprecated" status.

machineghost
  • 33,529
  • 30
  • 159
  • 234
  • Firefox (I'm running 35.0) still supports the `blink()` function and returns `"text"` when you enter `"text".blink()`. This means that the function returns deprecated html, and as such the function itself should also not be used any more. – Arjan Feb 25 '15 at 20:48
2

Yes


I think the description at the top of Annex B, where all these methods are defined, is pretty clear (emphasis mine):

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.


Note that most of the string methods are not mentioned in ES5. As so often when it comes to web, browser vendors did their own thing and added custom extensions. In this case it got to a point where the TC39 committee decided that is important to at least mention them in the spec.

Community
  • 1
  • 1
Felix Kling
  • 795,719
  • 175
  • 1,089
  • 1,143
-1

What i found:

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.

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

I hope this can help you.

Community
  • 1
  • 1
  • 2
    @GOTO 9 specifically mentioned MDN (the site you linked) in their question; as I understand it they were well aware of MDN, but were looking for a more canonical source. – machineghost Feb 25 '15 at 20:47