Cyclone3 Skin

Programming in XUL

From Cyclone3 Wiki


Common programming concepts

Code style and indentation

Please use a semicolon (;) after every statement. Even when its the single statement in the line and thus not required by JavaScript.


alert('moo'); alert('mee');
document.getElementById('something').setAttribute('a', 'b');
alert('hello world');


alert('moo'); alert('mee');
document.getElementById('something').setAttribute('a', 'b')
alert('hello world')

Variable naming conventions

Start variables and methods with lowercase letters. Use all-lowercase letters and underscores for variables, use a fnc_-prefix (possibly) and Upper-case first letters starting from the second word in functions.


i, j, my_variable, little_old_lady_who

Functions, Methods:

fnc_help, fnc_drawThePicture, doThis, doThat

Resolving Particular Situations

Common methods in bindings

  • onSoapLoad
  • fnc_init
  • fnc_set
  • fnc_get
  • fnc_save
  • fnc_reload

Variable use and naming in bindings

  • tthis - often used as a reference to this when this = binding element. Used in asynchronously called functions and closures.
  • e - commonly used to keep track of the error message in try/catch statements


In bindings we commonly use 2 arbitrary attributes to replace the common use of the id atribute in XUL documents.

  • IDanon, sometimes idanon, is used as a replacement the id attribute. Use it for images, GUI elements and menus or menu items.
  • IDdata - used as a replacement for the id attribute. For data-holding elements, such as textboxes. IDdata elements are usually filled from SOAP messages and used in retrieving the values for saving data.

See also

Developing XUL CMS