473,768 Members | 1,392 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

JavaScript Editors ( Give me a text editor and a good book )

I have still yet to see a JavaScript Editor that comes close to
reading a good JS book, learing it and using it with a text editor.

Anyway, here my recipe for build successfull DHTML Applications:

If you want to support only M$ IE stop here and do the following:
1) Install blindfold
2) Repeat the phrase - I love my cage :p

Buy the Book: Buy O'Reilly's JavaScript The Definitive Guide
~ The best damn JS guide & reference period, end of story, finito

Get a good Text Editor with Syntax Highlighting support
~ Real programmers don't use WYSIWYG tools
~ You will never learn with these tools
~ Code is always inefficient
~ Apps to Use:
~ OSX - BBEdit - Powerful but no MDI support :(
~ Win32 - UltraEdit - Low cost, high power, competent
yntax Highlighting
~ ^nix - Kate or KDevelop - Well written but needs KDE (big)
~ Does not work with OSX's X11 Client :[ - ('+' key
doesn't work)

Browser Development Platform
~ Mozilla (1.3+) (FireFox release suggested)
~ Why Moz?
~ Mozilla based development works in:
~ IE 95% of the time
~ Konquorer (KDE/Apple...), Opera 99%+ of the time
~ Why not IE?
~ IE based development works in standards based
browsers only 50% of the time
~ IE black hole methods (non standards based) causes
people to ignore standards based DHTML objects,
properties and methods.
~ Browser Support Baseline
~ IE 5.5sp2+
~ This is the first (reasonably) stable
version of IE for advanced JS coding.
~ When ever I experience weird bugs from users I have them
them upgrade to IE5.5sp2+ and it goes away.
~ Netscape 6.n+
~ Netscape 4.7 should not be supported!
~ Opera ? (I plead ignorance here)
~ Konquorer/Safari ? (I plead ignorance here)

Debugging Methodology:
~ Use JS Console (Moz)
~ Put try/catches at all error prone functions / methods
~ Because of IE's error stupidity, you should get as
close to the source as possible.
~ Read stack property of error in Mozilla to
read stack of error (powerful)
~ Install JavaScript Console Status in Mozilla
~ Use window.onerror handler
~ In IE, read arguments.calle e.caller... to read stack
~ Goes only to last error throw point ! not error source
point :[
~ Note: at this time, there is no way to to get to
the Error object in Mozilla from this handler.
Therefore no stack in Moz. Use Try/Catch instead

Add the following code to every page:
_w=window
function getElem(s){retu rn document.getEle mentById(s)}
function getEvent(e){ return is.ie?_w.event: e }

Event Declaration
~ Avoid using inline javascript declarations (In HTML Tags)
~ Inline declarations is where you call a function or
run code from the html elements definition
(onclick="<RunS omeCode>")
~ This technique will not allow you to access
the event argument in Mozilla...
~ Instead use getElem("<Eleme nt ID>").onclick=< function name>
~ Declare handlers like:
function mySlickFunction (e){e=getEvent( e)...
~ This will ensure you always have Event Object
~ If you want to get fancy you could normalize the Event
at getEvent()
~ Method Declaration
~ Declare <obj>.<meth>=fu nction <obj_acro>_<eve nt>(args){
~ Example: myObj.smile=fun ction MO_smile(args){ ...
~ Why? - When you build you're stack in the debug
you get the method names!

Other Stuff:
~ Use JSON (www.json.org) as much as possible to nest data
structures (for more complex programming).
~ JSON is fast (primitively supported), stable easy to read.

Could anybody else add to this list?

If people are interested, I can make a document and add other stuff
like JS debugging libraries, Consoles and other slick JS Debugging
stuff.

Happy coding!

Java (script) Dude
Jul 23 '05 #1
3 4373
On 23 Apr 2004 16:53:46 -0700, Java script Dude <de********@yah oo.ca>
wrote:

[snip]
Buy the Book: Buy O'Reilly's JavaScript The Definitive Guide
~ The best damn JS guide & reference period, end of story, finito
I personally prefer Netscape's JavaScript references and ECMA-262. I've
never bought or read a JavaScript book (and I can't say I ever intend to :)

[snip]
Debugging Methodology:
~ Use JS Console (Moz)
Opera's JavaScript console is also very helpful and automatically includes
a stack trace (although I wish "Clear" permanently cleared the list).

[snip]
Add the following code to every page:
_w=window
function getElem(s){retu rn document.getEle mentById(s)}
function getEvent(e){ return is.ie?_w.event: e }
That would imply browser detection, which is a bad idea (simple
alternative below).
Event Declaration
~ Avoid using inline javascript declarations (In HTML Tags)
~ Inline declarations is where you call a function or
run code from the html elements definition
(onclick="<RunS omeCode>")
~ This technique will not allow you to access
the event argument in Mozilla...
Wrong. This isn't explained explicitly by Netscape, but there is an
example provided:

The following example uses the event object to provide the type of
event to the alert message.

<A HREF="http://home.netscape.c om"
onClick='alert( "Link got an event: " + event.type)'Click for link event</A>
The event object appears to be passed as an implicit argument.
~ Instead use getElem("<Eleme nt ID>").onclick=< function name>
~ Declare handlers like:
function mySlickFunction (e){e=getEvent( e)...
The same can be achieved whilst avoiding your (possible) browser detection:

e = e || window.event;
~ This will ensure you always have Event Object


So should the above, as long as all browsers follow either the Netscape or
IE event model.

[snip]

Mike

--
Michael Winter
M.******@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 23 '05 #2
> I personally prefer Netscape's JavaScript references and ECMA-262. I've
never bought or read a JavaScript book (and I can't say I ever intend to :)
I would think that the ECMA-262 would be the best first bet from a
technical perspective. But being a technical document, it probably
would not be a good starting point for first time developers.

The O'Reilly's book is extremely well written and it's reference
structure allows for rapid resolution of syntax, objects, properties
and methods.
Debugging Methodology:
~ Use JS Console (Moz)
Opera's JavaScript console is also very helpful and automatically includes
a stack trace (although I wish "Clear" permanently cleared the list).


Now a stack dump in the console sounds sweet. Currently, I need to be
able to handle the error in moz and then dump with error.stack. If I
could have it in the console, my life would be much easier. Hmmm.
sounds like a suggestion for Moz.
[snip]
The same can be achieved whilst avoiding your (possible) browser detection:

e = e || window.event;


I stand corrected.

However, it would be a good idea to avoid putting complex JavaScript
inside of the inline handlers. It becomes difficult to read and debug
as the code gets more complex. If the handlers were put into a
separate JS file, the page size could also be reduced.

<div id="divTest" onclick="divTes t_click(window. event|event)">C lick
me</div>
<script>
// Handlers
function divTest_click(e ){...}
...
</script>

Thanks for the input Mike!

Tim
Jul 23 '05 #3
Java script Dude wrote:
<snip>
[snip]
The same can be achieved whilst avoiding your (possible) browser
detection:

e = e || window.event;


I stand corrected.

However, it would be a good idea to avoid putting complex JavaScript
inside of the inline handlers. It becomes difficult to read and debug
as the code gets more complex. If the handlers were put into a
separate JS file, the page size could also be reduced.

<div id="divTest" onclick="divTes t_click(window. event|event)">

<<snip> ^
You should be using logical OR rather than bitwise OR (which will result
in zero).

The code provided as the string values for event handling attributes is
the one place where you don't need to normalise the event object because
the implementations that provide an event object as an argument for the
internally generated event handling function use the identifier -
event - as the parameter name. So the unqualified identifier - event -
will resolve as a reference to the event parameter on browsers that pass
an event object to the function, while on browsers that have a global
event object the same identifier will be scope resolved as a property of
the global object - window.event.

So:-

onclick="divTes t_click(event); "

- will pass the event object on to the - div_Test_click - function from
the event handling function in either case.

Richard.
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

22
2942
by: Dan Rumney | last post by:
Hi all, I've been writing Javascript for quite a while now and have, of late, been writing quite a lot of AJAX and AJAX-related code. In the main, my dynamically generated pages are created using Perl on the backend, with Javascript providing limited frontend functionality. As an example, an expanding tree would be fully populated on the server-side and then presented to the browser, with Javascript and CSS being used to vary the...
0
9576
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9407
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10176
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10018
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9963
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8840
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6656
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3540
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2808
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.