MozillaZine

Javascript 1.5 goes Beta!

Wednesday January 12th, 2000

Javascript 1.5 has reached beta, and you can test it out in Mozilla now. You can read more about Javascript in Mozilla here, and the 1.5 announcement here. The announcement page also has links to discussions going on in the jseng newsgroup regarding some of the new features.

So, what's new? Well, some ECMA-262, revision 3 changes: Conditional function declaration, runtime errors reported as exceptions, and regular expression enhancements. Also, multiple catch clauses, getters and setters, catch keyword, and "strict" mode. Lots of info in the announcement page, so check it out!


#1 What's the story with old-school Javascript stuff

by just

Wednesday January 12th, 2000 5:50 PM

Reply to this message

I admit I'm completely ignorant of the full story behind Javascript in Mozilla, so can someone explain to me when I can expect, if at all, traditional javascript applications like 'rollovers' and popping up layers to work in Mozilla?

Case study: <http://www.php.net.> The rollovers for the images on the menu do not work properly (though they do have some functionality) and the pop-up 'quick reference' and 'search' don't appear.

I understand that Mozilla probably uses a different DOM to its predecessors but even when using this new DOM I can't seem to get layers (yes, I'm using DIVs, not LAYER tags) to pop-up under current builds of Mozilla.

Is this a bug? Something yet to be developed? Something I'm doing wrong?

Thanks

#2 Re: What's the story with old-school Javascript st

by ERICmurphy <murphye@gmail.com>

Wednesday January 12th, 2000 11:30 PM

Reply to this message

I feel your frustration, but a lot a Javascript out there is not compatible with the newer standards.

I am not sure what effect specifying the version of the Javascript code you are using in your HTML will have, but it might turn on some backward compatibility features.

Give it a try... you never know.

#4 Javascript and DOM

by sjoerd <sjoerd@heeten.nl>

Thursday January 13th, 2000 9:45 AM

Reply to this message

DOM and Javascript are two different things. Javascript is a language. The DOM is a collection of object which are supposed to be language independant.

#6 Re: Javascript and DOM

by just

Thursday January 13th, 2000 2:24 PM

Reply to this message

Exactly. My question is, is it Mozilla's implementation of Javascript or the DOM (as defined by the w3c) that stops older javascript functions from working.

Also, there must be a bug somewhere as at the link provided <http://www.php.net> if you pass the mouse over the 'rollover' buttons and then scroll down and back up the coloured (or highlighted) image is shown. I'm sure this isn't the correct behaviour. (I'm pretty sure this is true, but mozilla, the nightly from a day or two ago, crashes every time I load a page now)

#7 Re: Re: Javascript and DOM

by danielhill <danielhill@hotmail.com>

Friday January 14th, 2000 2:53 AM

Reply to this message

It's the DOM. Unfortunately it is not backwards compatible with IE or NSCP4.x.

#14 Re: Re: Re: Javascript and DOM

by Tanyel <tanyel@straightblack.com>

Friday January 14th, 2000 9:52 PM

Reply to this message

Does Netscape not see a problem with making a web browser that does not work with many of the webpages that already exist?

#19 Re: Re: Re: Re: Javascript and DOM

by gerbilpower <gerbil@ucdavis.edu>

Sunday January 16th, 2000 12:12 AM

Reply to this message

It's obviously a debateable problem. To be able to support existing sites and prevent webmaster-frustration at the same time, or to completely discourage use of old proprietary code and make the web more consistent and much less problematic than it is now?

Not an easy answer for me, personally, I'll be satisfied either way, although I do lean more towards discouraging use of the nonstandards.

<:3)~~

#3 Re: What's the story with old-school Javascript st

by danielhill <danielhill@hotmail.com>

Thursday January 13th, 2000 1:55 AM

Reply to this message

Are you using the new DOM methods and variables? You can't use the same object model as IE or NS4.

Speaking of Object Models, is there an easy to read reference to the DOM? I looked on W3C, but that was very hard to understand and IMO geared towards programmers of browsers.

#5 Re: Re: What's the story with old-school Javascrip

by jlondon

Thursday January 13th, 2000 1:40 PM

Reply to this message

A great DOM reference, and CSS 1+2 for that matter, is DHTML, by Danny Goodman. Not only does it list every property, attribute and method available ine NN4 and IE4, but also against the standards, i.e. DOM1 or CSS 1 or 2

#8 Re: Re: Re: What's the story with old-school Javas

by danielhill <danielhill@hotmail.com>

Friday January 14th, 2000 2:55 AM

Reply to this message

Excellent. Is this a book or a site? And where can I get it?

#9 Re: Goodman's Book

by zontar

Friday January 14th, 2000 5:58 AM

Reply to this message

I believe the previous poster was referring to _DHTML: The Complete Reference_ from O'Reilly -- <http://www.ora.com/dhtmlref/> -- I haven't actually seen it myself, but if his _JS Bible_ is any indication, it's got to be pretty good.

#10 Re: Re: Re: What's the story with old-school Javas

by reboughner <reboughner@widomaker.com>

Friday January 14th, 2000 2:28 PM

Reply to this message

I've got both of Goodman's books -- JS Bible 3rd Edition and Dynamic HTML: The Definitive Reference. The latter book is a good reference; I use it frequently to determine what's available in IE and Netscape. It doesn't however cover any of the W3C recommended methods and properties. For that you need to go to the w3c.org site and and read the recommendations.

#11 Re: What's the story with old-school Javascript st

by reboughner <reboughner@widomaker.com>

Friday January 14th, 2000 2:37 PM

Reply to this message

If you want to have your page work in the Gecko engine you'll have to rework your javascript so that it adheres to the W3C recommendations. To access elements in your document you'll have to use the document.getElementsByTagName() or document.getElementById()functions.If you use the LAYER tags then the browser will treat them as unknown tags and just display what's contained between them. From what I saw of your code you should be okay in IE5 since it all supports document.all which is backward compatible with IE4.0. It also supports the newer W3C methods and properties that Gecko supports.

#15 Re: Re: What's the story with old-school Javascrip

by Tanyel <tanyel@straightblack.com>

Friday January 14th, 2000 10:05 PM

Reply to this message

Why would they choose DIV instead of LAYER? LAYER seems to make much more sense to me, if the goal is to create layers of webpage elements. Were they trying to satisfy Microsoft? Am I misunderstanding the use of the LAYER and DIV tags?

#17 Re: What's the story with old-school Javascrip

by rginda

Saturday January 15th, 2000 2:42 AM

Reply to this message

FWIW, Mozilla hasn't chosen DIV *instead* of LAYER, and Mozilla is certainly not trying to satisfy Microsoft. Even if LAYER were supported, the DIV and SPAN tags would still be necessary.

That being said, the decision to put off the implementation of LAYER has been publicly debated on the Mozilla newsgroups as recently as 1/11/2000.

I'd suggest searching (at <http://www.deja.com/home_ps.shtml> ) for the keyword LAYER in the netscape.public.mozilla.* newsgroups.

Rob.

#18 Re: Re: What's the story with old-school Javascrip

by Tanyel <tanyel@straightblack.com>

Saturday January 15th, 2000 10:18 AM

Reply to this message

Well I know Mozilla is not trying to satisfy Microsoft. I thought maybe W3C was.

#12 Re: What's the story with old-school Javascript st

by rginda

Friday January 14th, 2000 2:50 PM

Reply to this message

Unfortunately many pages are written under the assumption that users will have *EITHER* NS4 or IE4, your example <http://www.php.net> is one of them. The page checks which browser is in use by looking for DOMisms, in the following snippet:

NS4 = (document.layers) ? 1 : 0; IE4 = (document.all) ? 1 : 0; ver4 = (NS4 || IE4) ? 1 : 0;

In Mozilla, all three of these vars will be 0, which should leave the page completely static. However, the rest of the script in this page *assumes* that if NS4 is 0, IE4 must be 1. <http://bugzilla.mozilla.org/show_bug.cgi?id=22517> is another example of a highly visible page with broken JavaScript. Erick Krock has put together a browser detection page with more information on the subject, it is available at <http://developer.netscape…/viewsource/krock_v5.html> .

I'm not sure what you mean by "I can't seem to get layers ... to pop-up", but perhaps the (mozilla only) example at <http://www.netcom.com/~rg…js_examples/divpopup.html> will help.

Rob.

#13 Re: Re: What's the story with old-school Javascrip

by just

Friday January 14th, 2000 9:35 PM

Reply to this message

Thanks for your help. I managed to work out what I was doing from the link you provided on hiding and displaying layers. And, as a result of my fiddling with it, I uncovered a bug and filed my first ever bug report! <http://bugzilla.mozilla.org/show_bug.cgi?id=24041>

#16 Re: What's the story with old-school Javascrip

by rginda

Saturday January 15th, 2000 2:03 AM

Reply to this message

Excellent testcase! It looks like your bug is a dupe of 19178, you may want to mark it as such and attach your testcase there instead.

Rob.