mrspoonzy at gmail Cube by Noah Ellman A powerful javascript toolkit, in research © by Noah Ellman

JWee's Core And Global Functions

global wee(...)
wee getUniqueId(...)

In the context below, global just means the function is global, and part of the window object.

function global.wee(...)( string or element or array )
Gets an element by ID / ensures an element has extended properties.
  1. Pass a element id, an element, or an array of either of these
Returnsthe extended element or false if error
ImportantThis is a important function/property to know.

Note - The function wee is the SAME as $.

This is the most important function to know. The $ function is similar to the $ in jQuery and Prototype.

  • Most importantly, $ is the same as document.getElementById(...), to get the element from its “id”, such as #mainContent or #pageHeader.
  • And secondly, $ ensures the element is extended with all the new "magic" methods provided by the framework here. ((See Dom Elements page))

$(...) will deal with whatever you pass to it, be it a string, an element itself, or even an array of both.

  • Passing a element id string (with or without the #) returns the extended element back or false if it does not exist.
  • Passing an element returns the element back to you (extended it not already).
  • Passing an array of elements returns the same array, with all the elements extended (if not already).
  • Passing an array of strings IDs returns the array of the associated elemenets.

An important note -
JWee takes full advantage of the new DOM features in Internet Explorer 8.0+, Firefox, Safari, Chrome, (and maybe Opera). This means that in those browsers, all elements on the page will be already fully extended with the special methods before the page even loads. This is great for us, because it conserves a huge amount of memory and elimiates the extra work required to extend every element manually.
However, Internet Explorer 6.0 does not have this feature. In order to write fullly compatable code, you must ensure you always pass an element through $ at least once, prior to using any of the extended methods.

function global.$a(...)( array-like object )
Utility function to convert an array-like object to a plain javascript array
  1. Anything that has length, such as a DOM array or arguments within a function
ReturnsNormal javascript array
ImportantThis is a important function/property to know.
function global.isScalar(...)( mixed )
Check if variable is a "primitive" type (string, number, or boolean)
function global.isElement(...)( mixed )
Check if variable is a DOM element.`
function global.isNothing(...)( mixed )
Check if the variable is nothing ("undefined", "null", or a empty string).
function global.trace(...)( mixed )
Output something to debugging console or wee's console.

Object containing basic user-agent information if you really need it. The ua object at this very moment in your browser equal:

if( > 7 ) // ie and version must be 8 or highere
if( frodo.browser.firefox ) // firefox
if( frodo.browser.opera ) // opera
function wee.getUniqueId(...)( [string prefix] )
Create a new unique identifier with optionally supplied prefix
  1. (optional) {string} a prefix such as "apple"
Returns{string} a new unique id, such as “apple_1”, “apple_2”, and so on

This code below should explain it.

wee.getUniqueId( "foo" )  // returns foo_1
wee.getUniqueId( "foo" )  // now returns foo_2
wee.getUniqueId( "foo" )  // now returns foo_3
wee.getUniqueId( "foo" )  // now returns foo_4
wee.getUniqueId( "bar" ) // returns bar_1
wee.getUniqueId( "bar" ) // returns bar_2
wee.getUniqueId( "foo"  ) // returns foo_5

function wee.evalStyle(...)( string code )
Dynamically add CSS code to the document
  1. {string} valid CSS code of any lenfth

wee.evalStyle( "div.newclass { background:yellow; } #blackbox { border:2px solid black; }" );

You can do this at any point after the page has been loaded. If you define a style that is already defined else in another stylesheet, the original style will not be replaced. However, individual style properties will be overriden according to normal CSS cascading rules.

function wee.evalScript(...)( string code )
This is like eval() except faster and executes globally
  1. {string} any amount of javascript code

This will eval your string in the global scope. This function works by dynamically appending your script in a new script on the head of the document. This is not the same as eval, it is much faster. this in the script will refer to window.

function wee.addScript(...)( string url )
Add a SCRIPT tag to the page.
  1. The URL to a valid .js file.

Add a new script to the page dynamically. If the page has already loaded, then a new script tag will be created dynamically in your page head. If the page has NOT loaded yet, then this function will use document.writeln to output a new script tag.

jwarp.addScript( "/js/newfeature.js" );

function wee.addStyle(...)( string path )
Add a STYLE tag to the page.
  1. The URL to a valid .css file.
function wee.navigate(...)( string url )
Redirect browser to a new URL
  1. {string} a URL to redirect browser to

jwarp.navigate( "/website/index2.htm" );
toolkit wee.dom
DOM related functions and selecting elements.
toolkit wee.cookie
Cookie handling functions. Setting, Getting, simple to use
toolkit wee.elem
All element related functions.
toolkit wee.fx
The tweening engine and a toolkit of other special effects and animation
toolkit wee.form
All form related functions.
class new wee.Class()
Create new class
  1. {string} Class name
  2. {object} Object containing methods and properties. The constuctor should be called "construct" or "initialize"
ReturnsThe new javascript class
??? Form?
??? URL?
??? Ajaxclass?
??? Weebox?
Object containing information about the browser (user agent).

Discussion on /learn/api/wee

Smithc409 10/17/16 :  


itoa('1135173802') 10/06/16 :  

Post a message

Xymon 11/05/14 :  

Hmm... Why are they called cookies? Do you know the relevance between an actual cookie and an HTTP cookie?

TheDoctor 11/05/14 :  

You might want to add more options to wee.cookie.set(). (secure,domain,path,etc.)

Xymon 11/05/14 :  

Yup, I haven't experimented any with it so I can't say it is bug-free. However, here it is:

Admin 11/05/14 :  

Yes I squeezed it down - there is so much chat!

Xymon 11/05/14 :  

Jwee comes in handy on the javascript/html5 gaming framework i'm working on. Specifically wee.dom.

Xymon 11/05/14 :  

That's because I moved it to the /resource/ folder.

Xymon 11/05/14 :  

$("div.content") ).each( function() { this.innerHTML='This handles all div tags with the class of "content". '; } );

Xymon 11/05/14 :  

You can also just copy/paste the javascript documents to your computer by visiting the index of

Xymon 11/05/14 :  

TheDoctor: I'd say he's probably fully aware of the downloader not working. I'll help you out though, go to In this text document you'll find a list of script tags, add these to the head tag of your document to use them, you can also download them all manually by visiting each source.

Admin 11/05/14 :  

Response: Frodo was the previous name of the framework. I ditched the name because I couldn't get the domainname. Wherever it says Frodo is were I haven't changed it to Jwee yet just in the text.