Javascript 1.5 goes Beta!Wednesday January 12th, 2000Javascript 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! 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 stby ERICmurphy Wednesday January 12th, 2000 11:30 PM 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. 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. 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) It's the DOM. Unfortunately it is not backwards compatible with IE or NSCP4.x. Does Netscape not see a problem with making a web browser that does not work with many of the webpages that already exist? 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 stby danielhill Thursday January 13th, 2000 1:55 AM 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 Javascripby jlondon Thursday January 13th, 2000 1:40 PM 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 Javasby danielhill Friday January 14th, 2000 2:55 AM Excellent. Is this a book or a site? And where can I get it? #10 Re: Re: Re: What's the story with old-school Javasby reboughner Friday January 14th, 2000 2:28 PM 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 stby reboughner Friday January 14th, 2000 2:37 PM 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. 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? 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 Javascripby Tanyel Saturday January 15th, 2000 10:18 AM Well I know Mozilla is not trying to satisfy Microsoft. I thought maybe W3C was. 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.com/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/~rginda/js_examples/divpopup.html will help. Rob. 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 |