Welcome to European Tribune. It's gone a bit quiet around here these days, but it's still going.
About the Document Object Model - MDC
What is the DOM?

The Document Object Model is an API for HTML and XML documents. It provides a structural representation of the document, enabling you to modify its content and visual presentation. Essentially, it connects web pages to scripts or programming languages.

All of the properties, methods, and events available to the web developer for manipulating and creating web pages are organized into objects (e.g., the document object that represents the document itself, the table object that represents a HTML table elements, and so forth). Those objects are accessible via scripting languages in most recent web browsers.

The DOM is most often used in conjunction with JavaScript. That is, the code is written in JavaScript, but it uses the DOM to access the web page and its elements. However, the DOM was designed to be independent of any particular programming language, making the structural representation of the document available from a single, consistent API. Though we focus on JavaScript throughout this site, implementations of the DOM can be built for any language.


Welcome to XULPlanet

The XML User Interface Language (XUL) is a markup language for describing user interfaces. With XUL you can create rich, sophisticated cross-platform web applications easily.

JavaScript - MDC

JavaScript is a small, lightweight, object-oriented, cross-platform scripting language.

For information about using JavaScript in browsers, please see DOM and DHTML topics. The Gecko DOM Reference describes the host objects available in Gecko-based browsers.

All extensions are open source. They ship as installable xpi's, which is really just a compressed directory structure. Sometimes they contain jar files, which are another type of compressed directory. My extension uses instead directly the source files. (They are interpreted, not compiled.) So, if you install the TribExt you get the source files. Just search for tribext@someone among your files and you'll find the directory with the source files. You will also find that I never comment my code...

by someone (s0me1smail(a)gmail(d)com) on Thu Mar 15th, 2007 at 05:41:44 AM EST
[ Parent ]
OK, I haven't looked into it, but I gather that the .xpi is just a zipped archive of javascript that operates on some sort of syntactic tree for the webpage, with XML describing where to insert action hooks in the general operation of Firefox.

But it must be horrendeously painful to code the scripts in vi, restart firefox to test, etc.. Any thing that gets a little bigger than 30 lines would need hot-swapping of script code, a full blown debugger with step-by-step, variable inspection, test-case replay, etc...

Have you got any of these that you would recommend ?


by Pierre on Thu Mar 15th, 2007 at 05:51:18 AM EST
[ Parent ]
Look at this resource first. You really need to setup those prefs!
Setting up extension development environment - MozillaZine Knowledge Base

Then install this:
Ted's Mozilla page - Extension Developer's Extension

The Extension Developer's Extension exists to make life easier for Firefox extension developers. Testing JavaScript code, prototyping XUL layouts, and building XPI packages are all made easier by this extension. Install it and try it out!

I also found it convenient to use a trick to prevent javascript caching to cause a major headache. If one writes a script in a file which is read into a string in another script, and the evaluated with the eval() function there are no caching problems. There is also a convenient javascriptobject.toSource(); For writing evaluatable script strings from object. This comes in handy also because sharing data between different window entities is quite inconvenient. I would say this is also a must read:
Working with windows in chrome code - MDC

Working with windows in chrome code From MDC

This article describes working with multiple windows in Mozilla chrome code (XUL applications and Extensions). It contains tips and example code on opening new windows, finding an already opened window, and passing data between different windows.

It tells you important stuff, like how to get to the top level chrome window, how to access the sidebar, etc. All in all it is a minor nightmare. Not a very logical layout of an object model at all!

by someone (s0me1smail(a)gmail(d)com) on Thu Mar 15th, 2007 at 06:25:53 AM EST
[ Parent ]
Thanx, I'll look into all that someday !

by Pierre on Thu Mar 15th, 2007 at 07:35:55 AM EST
[ Parent ]


Occasional Series