Overview

In ActiveWAFL applications, Javascript's native elements have been extended to provide additional, higher-level, functionality.

Shared methods

These methods are available on all HTML elements.
HTML element instance methods
//get a clone of the element
var clone = element.Clone(deepClone);

//make the element's text content unselectable with a mouse or keyboard
element.DisableTextSelect();

//find the nearest element that matches the querySelector
var closestElem = element.FindClosest(querySelector);

//get the value of an attribute on this element
var attributeValue = element.GetAttribute(attributeName);

//get all children (optionallly only those of <em>tag</em> type) with the specified class
element.GetChildrenByClassName(class, tag);

//get the HTML contents of this element
var innerHtml = element.GetInnerHtml();

//get the HTML of this element and it's contents
var outerHtml = element.GetOuterHtml();

//get the text content of the element
var textContent = element.GetText();

//remove all of the element's children from the dom
element.RemoveAllChildren();

//replace all of the element's children with the passed childElements
element.ReplaceAllChildren(childElements);

//set the value of an attribute on this element
element.SetAttribute(attributeName, value);

//replaces the HTML contents of this element with the passed string
element.SetInnerHtml(html);

//set the text value
element.SetText(textvalue);

Events and Handlers

HTML element instance methods dealing with events
element.AddClickHandler(handlerFunction, targetSelector);

element.AddChangeHandler(handlerFunction, targetSelector);

element.AddMouseInHandler(handlerFunction, targetSelector, duringCapture);

element.AddMouseOutHandler(handlerFunction, targetSelector, duringCapture);

element.AddMouseDownHandler(handlerFunction, targetSelector, duringCapture);

element.AddMouseUpHandler(handlerFunction, targetSelector, duringCapture);

element.AddFocusHandler(handlerFunction, targetSelector);

element.AddKeyDownHandler(handlerFunction, targetSelector);

element.AddKeyUpHandler(handlerFunction, targetSelector);

element.AddKeyPressHandler(handlerFunction, targetSelector);

element.AddBlurHandler(handlerFunction, targetSelector);

element.AddLoadHandler(handlerFunction, targetSelector);

element.AddHandler(eventName, handlerFunction, targetSelector, duringCapture);

element.Trigger(eventName);
HTML form element instance method to add a handler on the validated event
element.AddValidatedHandler(handlerFunction);

Strings

String instance methods
var string, encoded, decoded, trimmed, uppercased, unique, font, width;

string = " Do ActiveWAFLs taste better with Syrup?  ";

//determine what the width of the string would be if printed with the specified font
font = "12px serif"; //use a css style font string
width = string.CalculateWidth(font);

//return a copy of the string with the whitespace removed from the beginning and ending of the string
trimmed = string.Trim();

//return a copy of the string with every word's first letter capitalized
uppercased = string.UppercaseWords();

//encode the string for use in a URL (RFC 3986)
encoded = string.UrlEncode();

//decode a URL encoded string (RFC 3986)
decoded = string.UrlDecode();
String static (helper) methods
//create a unique id (rfc 4122)
var uniqueid = String.CreateUUID();

Tables

Table instance methods
//add a tr element to the table's tbody
var row = table.AddRow();

//remove all tr elements in the table
table.RemoveAllRows(includeHeaderRow);
Row instance methods
//remove a tr element from the table
row.Remove();