April 2003
Javascript Common Library
Javascript is a prototype based, dynamically typed language. It is an excellent scripting language given its simplicity. Javascript even allows inheritance; I have a document that covers inheritance in a prototype based language .
DHTML is a Problem
Javascript has a problem: Good libraries are essential to making a language useful, and Javascript has few to none. This page is the framework for creating a common library that interfaces with the plethora of browsers' Document Object Models (DOMs).
The SuperTable
As a first test of this new library (current works on Mozilla 5, Netscape6+ and IE4+) I have made the SuperTable. I will be adding features to this in the future. Try Resizing the columns.
|
The Design
Order is important so that the objects are created correctly.
-
Utility Functions
The Debug and String modules have some function that you may find useful. The String module has a few useful functions that the Javascript prototypical object lacks. This String module is incomplete. - Browser Specific Wrappers for Docum
ent Objects
Each type of document object for each type of browser is given a browser specific class object. The name of the class begins with an "a" and has a 3 character suffix signifying the browser it supports. All translation between the document objects and the class interface is done here. -
Useful Objects
These objects are built on top of the class objects and add functionality. Things like moving, dragging and my SuperTable object. -
The BrowserType Module
The BrowserType module identifies the browser being run and maps the browser specific class objects to more general interface objects -
The Main Routine
This is what you write to instantiate objects and perform useful tasks.