Goon 1.0 Released Today

Goon is a JavaScript tool for DOM-based on-demand script loading

Features

  • Independent
    Goon is a selfcontained script, no external library needed
  • Short
    Goon is less than 2 KB (packed)
  • Rigorous
    Goon guarantees that required scripts are executed before the requiring script is executed
  • Clean
    Goon is tree oriented. Each gooned script is a node: if it’s not required by another node, then it’s a root, and if it’s not requiring any node, then it’s a leaf. Loading goes from root to leaves, while execution goes the other way around.
  • Easy
    Goon’s nodes are calls to the Goon() function, nodes’ results are available as entries of the goon repository, and the last tree’s result by means of the goony shortcut
  • Elegant
    Goon provides a simple environment, where a node can access imported results by means of this, and export its own results by means of return
  • Flexible
    Goon can load the same node many times in the same tree and its behavior can be tailored by specifying how each script is required: in link mode, in exec mode, or in redo mode
  • Flexible
    Goon’s nodes can be used as roots for their subtrees, without any modification, simply by loading them directly from a page
  • Flexible
    Gooned pages can load all the needed trees, each with its own root, and they can be completely independent or grafted
  • Flexible
    Goon’s loading trees can be transplanted between hosts, for example from localhost to a deployment host, by changing the query string used for loading Goon itself

Files

HTML Recipe: Dashed Attributes

Another little improvement for the HTML recipe. This time is for properly highlighting attributes whose name contains a dash, like “http-equiv”. I also touched the tag rule, so that the DOCTYPE is recognized now:

HTML Recipe: Multiline Attributes

Some days ago I discovered that an HTML tag can have attributes whose values span multiple lines. This is very useful when the value is a piece of javascript code, which in fact is immune to white space.

The HTML recipe I bundled to Chili 1.5 is a bit wrong, though, because it doesn’t consider that possibility. This is one that does: