what has replaced the document.domconfig in javascript - javascript

document.domconfig is obsolete and removed. Any heads up on what it was replaced with? Or how can I get the DOMConfiguration which is also obsolete?

Based on the javascript tag and lack of comments to the contrary, I'm assuming this question is about web browsers.
document.domConfig (and the related interface DOMConfiguration) was introduced in W3C DOM Level 3 Core in 2004.
The standard was not created only with web browsers in mind, as a matter of fact none of the implementations required to become a W3C Recommendation were part of a web browser.
So when the web browser renaissance began, a version of the DOM spec specifically for web browsers was created, now known as DOM Living Standard. Since there were no implementations of DOMConfiguration (indicating lack of interest from implementers and presumably web developers, particularly because many of the features are not relevant to the HTML DOM), the feature was simply pruned from the specification.
It was not replaced by anything in particular; there was nothing to replace.
If you asked "I could do X with domConfig, how do I do it in a web browser" you might get a better answer, but for a generic question about an interface with a dozen rather obscure options I guess this is what the answer should be.

Related

Is window.navigator.userAgent really going to be deprecated?

I just read on MDN about window.navigator.userAgent:
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.
I am not finding any other significant reference on the web confirming this statement. User agent information are widely used by many companies for various reasons (analytics, bug fixes in specific browser ...). While I understand that one should use feature detection over ua sniffing it just seems incredible that this information would go away.
Is it really going away or is it just a Mozilla thing?
If so, is there a replacement for it?
The deprecation notice seems to be gone now. It was removed yesterday, over a year after this question was first asked, with the following comment:
rm deprecation marker. This is not removed from the living spec and no deprecation either. Most use cases are discouraged for quality reasons, but that's something else.
The WHATWG Living standard hasn't deprecated this property, so that confirms that the property isn't going away. Sure, it's a crapshoot and easily spoofed, but "not recommended for use" is not the same as "deprecated". As you note, too many authors and organizations depend on this property for it to be simply specced out of existence and removed from implementations.
Perhaps confusion over the meaning of the word "deprecated" is what resulted in the deprecation notice in the first place. The article itself is still incorrectly tagged "Deprecated", by the way.
Note that Mozilla is not responsible for contributions to the MDN docs. The community is. And as with any other community-curated, unofficial knowledge base (including this very site), don't treat its information as gospel, always cross-reference, etc (as you have done here).
Use feature detection. If you need to use feature X, test to see if X is available.

Is the blink() method really deprecated?

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.
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.
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.
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.
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.

What's the difference between JavaScript, JScript & ECMAScript? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
OK, so I'm trying to learn JavaScript properly so that I can write good, clean client-side code, but whenever I think I'm making progress, something stops me dead in my tracks!
I want to know:
What is the different between JavaScript, ECMAScript and JScript?
Which should I focus on learning?
If these are versioned, which version should I be supporting?
Are there any really good references (web / books etc) that are a must have/read?
How do I ensure that what I write will be compliant with all major browsers (IE, FF, Safari, Chrome, Opera etc.) ?
MOST IMPORTANTLY...Is there a reference of the core objects (Array, Number etc) so I know what is implemented already and what I need to do myself?
Thanks.
Javascript is the original name when the language was developed by Netscape.
JScript is Microsoft's name of their own implementation.
ECMAScript is the name of the language standard developed by ECMA, from the original Javascript implementation.
So, it's just one language, with different implementations.
The implementations of Javascript and JScript differ somewhat in what they support, but each version supports what's in the corresponding version of the ECMAScript standard. Generally you just use what's supported a few versions back, so that it works in all the browsers that are still in use.
One reference is the Mozilla Developer Network, as Mozilla is the current developer of Javascript. For each method and property you can find which version it is supported in.
JScript is documented at the Microsoft Developer Network, and has similar information about support. (Note that all Microsoft documentation is there, not only JScript, so for example you would need to search for "jscript array" rather than just "array".)
Using a library like jQuery is useful to avoid dealing with some of the compatibility problems between browsers.
ECMAScript is the scripting language standardized by Ecma International in the ECMA-262 specification and ISO/IEC 16262. The language is widely used for client-side scripting on the web, in the form of several well-known dialects such as JavaScript, JScript, and ActionScript.
Depends on you, but I think most commonly used for web dev is JavaScript
JavaScript was formalized in the ECMAScript language standard and is primarily used in the form of client-side JavaScript
I would recommend this book
By learning more and more about the language itself and writing tests
Look here
It is important to understand, that ECMAScript is a standard, defined in the last century. :D Whereas Javascript is derived from ECMAScript. Derived in a sense, that it implements the standard.
The big difference is, that Javascript actually only exists within the Browser, saying, it is by no means a standard in itself. Every browser can (and a lot do) implement it's own methods.
So, if you seriously want to learn it and write clean code, then IMHO you have to first get familiar with the ECMAScript standard.
To 3: Since Javascript is implemented by the browser, this really depends on what browsers you want to develop code for. Older browser may have to be dealt with trought some seperate handling in your code.
To 5: Again, javascript can check what browser (or what client software in general) requestet the page it is loaded in. Meaning: If bad comes to worse, you can deal with each browser seperately in your code. But most of the time they are pretty compliant (at least the later versions)
On 4 and 6 I'd have to check first for myself.
Hope I could help you out a bit.
Regards
ECMAScript is the language, JavaScript and JScript are dialects
I would, personally, look at and learn JavaScript.
It depends on what browsers you want to support, easily googled.
MDN is a pretty good web source. JavaScript: The Good Parts and JavaScript: The Definitive Guide are both very good books, the first short and concise the latter very detailed.
JavaScript libraries like jQuery is very good for this reason. It all comes down to learning all the quirks of the browsers. Google is your friend.
MDN.
Wikipedia please.
Javascript is a language, this is probably what you want to learn rather than a spec.
Welcome in hell, all. Modernizr and jQuery exists for a reason. Unless you are doing Javascript on the server side with Node.js for example, in this case you can focus on only one JS Engine (V8 for Node).
MDN
Test, Test, Test and re Test. Try never to use too recent features and use libraries.
MDN tells you which browser supports what.
They're one and the same - for an history on JavaScript watch the Douglas Crockford webcasts on YouTube.
http://youtu.be/_DKkVvOt6dk
http://youtu.be/hQVTIJBZook
2,3,4. Start with this http://eloquentjavascript.net/
Libraries like jQuery do a good job in normalising behaviour across browsers.
I think this is what you are looking for http://dochub.io/#javascript/

Why does Google Chrome still support __proto__?

__proto__ is deprecated. Why do big browsers like Google Chrome still use it? Are there any plans to dump it?
One of the hardest thing to do in a language / framework is actually remove a deprecated feature. There is still loads of code in the world which depends on this feature. Removing it will break websites. Chrome has apparently looked at the cost of maintenance vs. the pain /cost of removal and chosen maintenance.
__proto__ is not only deprecated, it was actually never part of the standard. Removing the feature from Chrome would mean that some pages would no longer work in Chrome, and there is no reason to break these pages.
The feature has been added to JavaScript (ECAMScript 5) as the 'getPrototypeOf' function, and new JavaScript programs should use that instead.
A proto pseudo property has been included in §B.3.1 of the draft ECMAScript ed. 6 specification (note that the specification codifies what is already in implementations and what webites may currently rely on).
https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/proto

Why is there no OFFICIAL JavaScript reference? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I tried to search for a JavaScript reference, but there's none available. The best two suggested sources are MDN (Mozilla Developer Network) and ECMA (https://262.ecma-international.org/12.0/)
Why?
It's not like there is an official JavaScript release. All the browsers have made their own JavaScript engine - some are using the same though. But especially Internet Explorer has its own version that doesn't support a lot of what the other browsers support, making it very difficult to make a general JavaScript reference.
Edit:
While I know there is an official ECMA standard and development team, my point is that it doesn't really matter as long as browsers (Internet Explorer) doesn't live up to it. At the end of the day, clients want JavaScript to work for Internet Explorer too. They won't care about the ECMA standards, they just want it to work. This is where JavaScript libraries come into the picture, but that's another story.
It's the same issues with HTML and CSS, we can't use these tools for active development until:
All browsers support them.
We supply the browsers with code to make them support it.
It's okay it doesn't work in all browsers.
Edit2:
Internet Explorer is getting close to the grave with the new browser project from Microsoft: Edge. This, however, doesn't really change the overall picture. We still have a lot if different browsers we need to support. Developers are constantly trying to push the boundaries of what's possible. This means that we often have this issue, some browser version we want to support doesn't support some feature of the standard (which usually is a bit fluid), which means we need to make some workaround or use frameworks that implement the missing built in features.
You can try with the official ECMAscript site,
http://www.ecmascript.org/
but the useful thing is actually the implementation of each browser.
I like this cheatsheet from Danny Goodman's JavaScript Bible a lot:
http://media.wiley.com/product_ancillary/12/04705269/DOWNLOAD/9780470526910_Appendix_A.pdf
I would say this one is the "official": https://developer.mozilla.org/en/JavaScript
You also have the ECMAScript Language Specification, 5.1 Edition (or as a PDF, the definitive specification).
And from Microsoft: JavaScript Language Reference: "This documentation explains the Microsoft implementation of JavaScript, which is compliant with the ECMAScript 5th Edition language specification. It also provides additional features that are not included in the Ecma Standards."
If you're using ECMAScript for the web (which 99.9% of people are), then beyond the basics syntactics of the language (covered in the ECMA-262 spec mentioned above), what you're probably looking for is a DOM reference - which is the ECMAScript API that's used to interact with web documents.
I'm very surprised noone has mentioned the DOM api sofar. Current W3C DOM standard is here: http://www.w3.org/TR/DOM-Level-2-Core/
(btw, as for the naming confusion - ECMAScript is the name of the official standard, and "Javascript" and "JScript" are Netscape and Microsoft's proprietary "forks")
Wikipedia's quotation:
Beginnings at Netscape
In November 1996, Netscape submitted JavaScript to Ecma
International ...
JavaScript is officially managed by Mozilla Foundation ...
So, in my opinion, the ECMA is the standard and Mozilla is the official one.
It is very difficult to have an "official" reference as long as there are implementations (in all browsers) and there is a specification (ECMAScript) but no conformance tests of implementations against the specifications.
Now though, we have the EMCAScript 5 conformance suite at http://es5conform.codeplex.com/ - and there seems some consensus that ECMAScript implementations will come closer together, making ECMAScript more likely to be the official reference for the language.
There is an official reference, it just isn't in a very convenient format. It is the ECMA-262 specification. It is a single, very large PDF document, instead of a searchable set of HTML pages.
Any revisions of JavaScript pages on MDC by a member of the Mozilla Documentation team (like Eric Shepherd) is official. JavaScript is officially maintained by Mozilla so only documentation by Mozilla is official. The only engines that support JavaScript are currently made by Mozilla and every other engine implements ECMAScript. JavaScript and ECMAScript have quite a few differences (for example, the awesome let statement).
I find the old-school Netscape 4 JavaScript docs very useful for this purpose. Although they're obviously totally outdated, and some of the DOM features in them like Layers are long gone, for the language basics they're really solid.
That's because before the days of IE supremacy and ECMA standardisation, Netscape's JavaScript was the definitive JavaScript. Other browsers pretty much had to implement exactly what you see in those old docs.
They're also much easier to read than the ECMA-262 document, which even by the standards of standards documents is an absolute horror.
By “official”, I think you mean “written by the people responsible for JavaScript”.
Just speculating here really, but the people responsible for JavaScript (the ECMA) don’t directly make any money out of it, and probably don’t have any particular skills in writing reference documentation. So they have neither the incentive nor the ability to write a good reference.
Personally, I like JavaScript: the Definitive Guide from O’Reilly. There’s a sixth edition coming out in November.
I really like Daniel Krook's apidoc, even though it could use some explanations and examples. I would really like to see a krook w3school mashup.

Categories

Resources