By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,291 Members | 3,096 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,291 IT Pros & Developers. It's quick & easy.

Clarify me on this issue - ECMAscript

P: n/a
Hi,

I am one of the many that get fed up with browser sniffing and cross
platform issues. Is ECMAscript a new independant cross platform
specification that can do loads of nice things that JavaScript can do?
If so, is it well supported?

If someone could give me brief overview of this that would be great,
thanks

Burnsy

Aug 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
bi******@yahoo.co.uk writes:
I am one of the many that get fed up with browser sniffing and cross
platform issues.
Agree on browser sniffing, but cross platform issues are inherent in a
heterogenic environment, which anything targeting "browsers" need to
account for.
Is ECMAscript a new independant cross platform
specification that can do loads of nice things that JavaScript can do?
ECMAScript is a standard specifying a language that incorporates
features from earlier versions of Netscape's JavaScript (Core) and
Microsoft's JScript. Later versions of these are ECMAScript compliant
(except for the odd bug).

It is not exactly new. The third version of ECMAScript was
standardized in 1999.

It is *only* the language, not the environment, that is standardized,
so all DOM features are not there. These are standardized by W3C in
the DOM 2 specifications, and there is still a core of de-factor
standard features that browsers implement without an official standard
specifying them.

That's also the features that differs mmost between platforms, so
ECMAScript won't help you there.
If so, is it well supported?
Not so, but very well supported :)
If someone could give me brief overview of this that would be great,
thanks


<URL:http://en.wikipedia.org/wiki/ECMAScript>

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Aug 18 '05 #2

P: n/a


bi******@yahoo.co.uk wrote:
Is ECMAscript a new independant cross platform
specification that can do loads of nice things that JavaScript can do?


ECMAScript is nothing new, the latest edition of that standard is
edition 3 which was published in 1999.

It is a standardization of the core language (e.g. the types like
number, string, boolean, object, the operators like +, -, *, typeof
delete, the expressions, the native objects like Object, Function, Date,
Array, String, Number, Boolean, RegExp, Error, the statements like
if/else, while) a scripting engine like the (former Netscape now
Mozilla) Spidermonkey engine or the MS JScript engine implements.

At the time of publication the 3rd edition contained some features (like
try/catch/finally exception handling) not yet or not yet completely
implemented but for some years now the latest versions of the
implementations (JavaScript 1.5, JScript 5.5 and 5.6, Opera's engine
since at least Opera 7) are trying to implement that edition completely.

As for scripting in the browser that standard of course helps achieving
compatible behavior for the stuff mentioned above that it covers, but
that is as you can see not anything browser related. And for quite some
time on the web you had (or depending on your views you still have) to
deal with various browsers (for instance like Netscape 4) which do not
implement the complete language like try/catch and throw syntax errors
on such statements so you could (or still can) not simply rely on things
in the standard and use them.

In regards to web scripting (of HTML documents and XML documents) what
is more important than the ECMAScript specification is the W3C DOM
specification <http://www.w3.org/DOM/DOMTR#dom2>, it specifies its
objects respectively interfaces and properties and methods in an IDL, in
a Java binding, and in an ECMAScript binding.

But that specification has three levels and the three levels have
different modules finished between 1998 and 2004, if you look at the age
of IE 6, the currently latest IE version on Windows, it becomes clear
that you cannot simply rely on the W3C DOM specification to write cross
browser compatible scripts.

IE is certainly the greatest problem as its DOM implementation has grown
from the not W3C compatible IE 4 DOM and then it seems the W3C DOM has
been implemented on top of that where it was easy or seen more useful.
So with IE you can often experience the surprise that a core DOM method
like appendChild works on some elements or with some argument but not
with others. In such cases there are often ways using the IE DOM to
achieve what you want but then you have to fork and write one branch of
code using the W3C DOM stuff and another using the IE DOM stuff.

On the other hand of the other current browsers like Mozilla, Opera,
Safari, Konqueror only Mozilla for some time had the high goal to
implement the W3C DOM first and only while Opera for instance as far as
I see it always tried to be compatible to both the W3C DOM and the IE DOM.
By now you will find a wide spread use of a mixture of the W3C DOM (for
instance createElement) and the IE DOM (for instance innerHTML).

So there is no short and simple answer, it certainly helps to read the
W3C DOM standards and learn to understand what that standard then means
in an ECMAScript implementation but you will still need to learn the
particular implementations in different browsers.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Aug 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.