Bake your own: Atomic use of zjrJS - Beta Test Suite for zjrJS

This information lives on a webpage hosted at the following web address: 'https://www.omegajunior.net/code/zjrjs/beta.php'.

zjrJS already is fairly small. Due to its atomic nature, you can craft an even smaller version for your site. Here is the how and why.

Used zjrJS Version:

Stable Minified version 20141202t2322 of zjrJS.

There is no newer Beta version available.


 

Why atomic?
Most zjrJS methods and properties stand alone. That means you can use them by themselves, so if you copy only those you need, and omit the rest, your version of zjrJS will end up smaller than mine. Small is good for bandwidth.

How do you know whether a method stands alone?
By reading the articles listed in the API Overview. Each article describes a zjrJS member (a function, method, or property), and its dependencies. Members with no dependencies stand alone. Members with dependencies do not stand alone: they depend on other members, which you must include as well.

Smallest atomic zjrJS
The smallest version, that still provides helpful functionality, includes zjrJS.Doc.eid() only. You would use this to reduce the amount of writing and thinking needed, every time your code needs to fetch an element by ID. Here's the sample:

/*
// --------------------------
// zjrJS.js Atomic
// Utility Javascript Library
// (c) A.E.Veltstra 2011 for OmegaJunior Consultancy
// Version 20110712T0858
// --------------------------
*/
if(typeof(zjrJS)=="undefined"){var zjrJS=({})}
zjrJS.Doc=({
eid:function(id){ /* get element by id */
var d=document,e=null;
if(id){if(d){if(d.getElementById){e=d.getElementById(id)}d=null}}
return e;
}
});

Download:

Download zjrJS’ latest stable build (20141202t2322) minified (7.1KB).

Download zjrJS’ latest stable build (20141202t2322) (11.9KB).