Interface appFrameworkCollection

Index

Properties

Methods

Properties

public length: number

Methods

public addClass(className: string): appFrameworkCollection

Adds a css class to elements.

$().addClass("selected");
title

$().addClass(name)

Parameters

  • className: string

Returns

appFrameworkCollection

appframework object

public append(content: any): appFrameworkCollection

Appends to the elements We boil everything down to an appframework object and then loop through that. If it's HTML, we create a dom element so we do not break event bindings. if it's a script tag, we evaluate it.

$().append("<div></div>"); //Creates the object from the string and appends it
$().append($("#foo")); //Append an object;
title

$().append(element,[insert])

Parameters

  • content: any

Returns

appFrameworkCollection

appframework object

public appendTo(target: any): appFrameworkCollection

Appends the current collection to the selector

$().appendTo("#foo"); //Append an object;
title

$().appendTo(element,[insert])

Parameters

  • target: any

Returns

appFrameworkCollection

public attr(attribute: string): any

Gets or sets an attribute on an element If used as a getter, we return the first elements value. If nothing is in the collection, we return undefined

$().attr("foo"); //Gets the first elements 'foo' attribute
$().attr("foo","bar");//Sets the elements 'foo' attribute to 'bar'
$().attr("foo",{bar:'bar'}) //Adds the object to an internal cache
title

$().attr(attribute,[value])

Parameters

  • attribute: string

    to act upon. If it's an object (hashmap), it will set the attributes based off the kvp.

Returns

any

If used as a getter, return the attribute value. If a setter, return an appframework object

public attr(attributeHash: Object): appFrameworkCollection

Parameters

  • attributeHash: Object

Returns

appFrameworkCollection

public attr(attribute: string, value: string): appFrameworkCollection

Parameters

  • attribute: string
  • value: string

Returns

appFrameworkCollection

public attr(attribute: string, value: any): appFrameworkCollection

Parameters

  • attribute: string
  • value: any

Returns

appFrameworkCollection

public bind(eventHash: Object): appFrameworkCollection

Binds an event to each element in the collection and executes the callback

$().bind('click',function(){console.log('I clicked '+this.id);});
title

$().bind(event,callback)

Parameters

  • eventHash: Object

Returns

appFrameworkCollection

appframework object

public bind(eventName: string, fn: (e: Event) => any): appFrameworkCollection

Parameters

  • eventName: string
  • fn: (e: Event) => any

Returns

appFrameworkCollection

public blur(fn?: (e: Event) => any): appFrameworkCollection

custom events since people want to do $().blur instead of $().bind("blur")

Parameters

  • fn?: (e: Event) => any optional

Returns

appFrameworkCollection

public change(fn?: (e: Event) => any): appFrameworkCollection

custom events since people want to do $().change instead of $().bind("change")

Parameters

  • fn?: (e: Event) => any optional

Returns

appFrameworkCollection

public children(selector?: any): appFrameworkCollection

Returns the child nodes of the elements based off the selector

$("#foo").children('.bar'); //Selector
$("#foo").children($('.bar')); //Objects
$("#foo").children($('.bar').get(0)); //Single element
title

$().children(selector)

Parameters

  • selector?: any optional

Returns

appFrameworkCollection

appframework object with unique children

public click(fn?: (e: Event) => any): appFrameworkCollection

custom events since people want to do $().click instead of $().bind("click")

Parameters

  • fn?: (e: Event) => any optional

Returns

appFrameworkCollection

public clone(deep?: boolean): appFrameworkCollection

Clones the nodes in the collection.

$().clone();// Deep clone of all elements
$().clone(false); //Shallow clone
title

$().clone();

Parameters

  • deep?: boolean optional

Returns

appFrameworkCollection

appframework object of cloned nodes

public closest(selector?: any): appFrameworkCollection

Returns the closest element based off the selector and optional context

$("#foo").closest('.bar'); //Selector
$("#foo").closest($('.bar')); //Objects
$("#foo").closest($('.bar').get(0)); //Single element
title

$().closest(selector,[context]);

Parameters

  • selector?: any optional

Returns

appFrameworkCollection

Returns an appframework object with the closest element based off the selector

public computedStyle(css: string): appFrameworkCollection

Gets the computed style of CSS values

$("#main").computedStyle('display');
title

$().computedStyle()

Parameters

  • css: string

    property

Returns

appFrameworkCollection

css vlaue

public concat(items?: appFrameworkCollection[]): appFrameworkCollection[]

Parameters

Returns

appFrameworkCollection[]

public css(property: string): any

Gets or sets a css property for the collection If used as a get, the first elements css property is returned This will add px to properties that need it.

$().css("background"); // Gets the first elements background
$().css("background","red")  //Sets the elements background to red
title

$().css(attribute,[value])

Parameters

  • property: string

Returns

any

an appframework object

public css(property: string, value: any): appFrameworkCollection

Parameters

  • property: string
  • value: any

Returns

appFrameworkCollection

public css(properties: any): appFrameworkCollection

Parameters

  • properties: any

Returns

appFrameworkCollection

public data(attribute: string): any

Gets or set data-* attribute parameters on elements (when a string) When used as a getter, it's only the first element

$().data("foo"); //Gets the data-foo attribute for the first element
$().data("foo","bar"); //Sets the data-foo attribute for all elements
$().data("foo",{bar:'bar'});//object as the data
title

$().data(key,[value]);

Parameters

  • attribute: string

Returns

any

returns the value or appframework object

public data(attribute: string, value: string): appFrameworkCollection

Parameters

  • attribute: string
  • value: string

Returns

appFrameworkCollection

public data(attribute: string, value: any): appFrameworkCollection

Parameters

  • attribute: string
  • value: any

Returns

appFrameworkCollection

public delegate(selector: any, eventHash: {}): appFrameworkCollection

Delegate an event based off the selector. The event will be registered at the parent level, but executes on the selector.

$("#div").delegate("p",'click',callback);
title

$().delegate(selector,event,callback)

Parameters

  • selector: any
  • eventHash: {}

Returns

appFrameworkCollection

appframework object

public delegate(selector: any, eventName: string, fn: (e: Event) => any): appFrameworkCollection

Parameters

  • selector: any
  • eventName: string
  • fn: (e: Event) => any

Returns

appFrameworkCollection

public each(fn: (index: number, item: any) => any): appFrameworkCollection

Iterates through all elements and applys a callback function

$().each(function(){console.log(this.value)});
title

$().each(function)

Parameters

  • fn: (index: number, item: any) => any

Returns

appFrameworkCollection

an appframework object

public empty(): appFrameworkCollection

Sets the innerHTML of all elements to an empty string

$().empty();
title

$().empty()

Returns

appFrameworkCollection

an appframework object

public end(): appFrameworkCollection

Rolls back the appframework elements when filters were applied This can be used after .not(), .filter(), .children(), .parent()

$().filter(".panel").end(); //This will return the collection BEFORE filter is applied
title

$().end();

Returns

appFrameworkCollection

returns the previous appframework object before filter was applied

public eq(index: number): appFrameworkCollection

Reduce the set of elements based off index

$().eq(index)
title

$().eq(index)

Parameters

  • index: number
    • Index to filter by. If negative, it will go back from the end

Returns

appFrameworkCollection

appframework object

public error(fn?: (e: Event) => any): appFrameworkCollection

custom events since people want to do $().error instead of $().bind("error")

Parameters

  • fn?: (e: Event) => any optional

Returns

appFrameworkCollection

public filter(selector?: any): appFrameworkCollection

Filters elements based off the selector

$("#foo").filter('.bar'); //Selector
$("#foo").filter($('.bar')); //Objects
$("#foo").filter($('.bar').get(0)); //Single element
title

$().filter(selector);

Parameters

  • selector?: any optional

Returns

appFrameworkCollection

Returns an appframework object after the filter was run

public find(selector: string): appFrameworkCollection

Searches through the collection and reduces them to elements that match the selector

$("#foo").find('.bar');
$("#foo").find($('.bar'));
$("#foo").find($('.bar').get(0));
title

$().find(selector)

Parameters

  • selector: string

Returns

appFrameworkCollection

an appframework object filtered

public focus(fn?: (e: Event) => any): appFrameworkCollection

custom events since people want to do $().focus instead of $().bind("focus")

Parameters

  • fn?: (e: Event) => any optional

Returns

appFrameworkCollection

public forEach(fn: (item: any, index: number) => any)

Parameters

  • fn: (item: any, index: number) => any

public get(): Array<HTMLElement>

Returns the raw DOM element.

$().get(0); //returns the first element
$().get(2);// returns the third element
title

$().get([index])

Returns

Array<HTMLElement>

raw DOM element

public get(index: number): HTMLElement

Parameters

  • index: number

Returns

HTMLElement

public hasClass(className: string, element: HTMLElement): boolean

Checks to see if an element has a class.

$().hasClass('foo');
$().hasClass('foo',element);
title

$().hasClass(name,[element])

Parameters

  • className: string
  • element: HTMLElement

Returns

boolean

public height(): string

returns the height of the element, including padding on IE

$().height();
title

$().height()

Returns

string

height

public hide(): appFrameworkCollection

Sets the elements display property to "none". This will also store the old property into an attribute for hide

$().hide();
title

$().hide()

Returns

appFrameworkCollection

an appframework object

public html(): string

Gets or sets the innerHTML for the collection. If used as a get, the first elements innerHTML is returned

$("#foo").html(); //gets the first elements html
$("#foo").html('new html');//sets the html
$("#foo").html('new html',false); //Do not do memory management cleanup
title

$().html([html])

Returns

string

an appframework object

public html(html: string): appFrameworkCollection

Parameters

  • html: string

Returns

appFrameworkCollection

public html(html: string, cleanup: boolean): appFrameworkCollection

Parameters

  • html: string
  • cleanup: boolean

Returns

appFrameworkCollection

public index(): number

Returns the index of the selected element in the collection

$().index(elem)
title

$().index(elem)

Returns

number

integer - index of selected element

public index(selector: any): number

Parameters

  • selector: any

Returns

number

public indexOf(searchElement: appFrameworkCollection, fromIndex?: number): number

Parameters

Returns

number

public insertAfter(target: any)

Inserts collection after the target (adjacent)

$().insertAfter(af("#target"));
title

$().insertAfter(target);

Parameters

  • target: any

public insertBefore(target: any): appFrameworkCollection

Inserts collection before the target (adjacent)

$().insertBefore(af("#target"));
title

$().insertBefore(target);

Parameters

  • target: any

Returns

appFrameworkCollection

public is(selector: any): number

Returns boolean if the object is a type of the selector

$().is(selector)

param {String|Object} selector to act upon

title

$().is(selector)

Parameters

  • selector: any

Returns

number

boolean

public keydown(fn?: (e: Event) => any): appFrameworkCollection

custom events since people want to do $().keydown instead of $().bind("keydown")

Parameters

  • fn?: (e: Event) => any optional

Returns

appFrameworkCollection

public keypress(fn?: (e: Event) => any): appFrameworkCollection

custom events since people want to do $().keypress instead of $().bind("keypress")

Parameters

  • fn?: (e: Event) => any optional

Returns

appFrameworkCollection

public keyup(fn?: (e: Event) => any): appFrameworkCollection

custom events since people want to do $().keyup instead of $().bind("keyup")

Parameters

  • fn?: (e: Event) => any optional

Returns

appFrameworkCollection

public load(fn?: (e: Event) => any): appFrameworkCollection

custom events since people want to do $().load instead of $().bind("load")

Parameters

  • fn?: (e: Event) => any optional

Returns

appFrameworkCollection

public map(fn: (index: number, item: any) => any): appFrameworkCollection

This is a wrapper to $.map on the selected elements

$().map(function(){this.value+=ind});
title

$().map(function)

Parameters

  • fn: (index: number, item: any) => any

Returns

appFrameworkCollection

an appframework object

public not(selector?: any): appFrameworkCollection

Basically the reverse of filter. Return all elements that do NOT match the selector

$("#foo").not('.bar'); //Selector
$("#foo").not($('.bar')); //Objects
$("#foo").not($('.bar').get(0)); //Single element
title

$().not(selector);

Parameters

  • selector?: any optional

Returns

appFrameworkCollection

Returns an appframework object after the filter was run

public off(eventHash: {}, selector?: any): appFrameworkCollection

Removes event listeners for .on() If selector is undefined or a function, we call unbind, otherwise it's undelegate

$().off("click","p",callback); //Remove callback function for click events
$().off("click","p") //Remove all click events
title

$().off(event,selector,[callback])

Parameters

  • eventHash: {}
  • selector?: any optional

Returns

appFrameworkCollection

appframework object

public off(eventName: string, fn: (e: Event) => any): appFrameworkCollection

Parameters

  • eventName: string
  • fn: (e: Event) => any

Returns

appFrameworkCollection

public off(eventName: string, selector: string, fn: (e: Event) => any): appFrameworkCollection

Parameters

  • eventName: string
  • selector: string
  • fn: (e: Event) => any

Returns

appFrameworkCollection

public offset(): { left: number; top: number; right: number; bottom: number; width: number; height: number; }

Returns the offset of the element, including traversing up the tree

$().offset();
title

$().offset()

Returns

{ left: number; top: number; right: number; bottom: number; width: number; height: number; }

with left, top, width and height properties

public on(eventHash: {}, selector?: any): appFrameworkCollection

Similar to delegate, but the function parameter order is easier to understand. If selector is undefined or a function, we just call .bind, otherwise we use .delegate

$("#div").on("click","p",callback);
title

$().on(event,selector,callback);

Parameters

  • eventHash: {}
  • selector?: any optional

Returns

appFrameworkCollection

appframework object

public on(eventName: string, fn: (e: Event) => any): appFrameworkCollection

Parameters

  • eventName: string
  • fn: (e: Event) => any

Returns

appFrameworkCollection

public on(eventName: string, selector: string, fn: (e: Event) => any): appFrameworkCollection

Parameters

  • eventName: string
  • selector: string
  • fn: (e: Event) => any

Returns

appFrameworkCollection

public one(eventHash: {}): appFrameworkCollection

Binds an event to each element in the collection that will only execute once. When it executes, we remove the event listener then right away so it no longer happens

$().one('click',function(){console.log('I was clicked once');});
title

$().one(event,callback);

Parameters

  • eventHash: {}

Returns

appFrameworkCollection

appframework object

public one(eventName: string, fn: (e: Event) => any): appFrameworkCollection

Parameters

  • eventName: string
  • fn: (e: Event) => any

Returns

appFrameworkCollection

public parent(selector?: any): appFrameworkCollection

Returns the parent nodes of the elements based off the selector

$("#foo").parent('.bar');
$("#foo").parent($('.bar'));
$("#foo").parent($('.bar').get(0));
title

$().parent(selector)

Parameters

  • selector?: any optional

Returns

appFrameworkCollection

appframework object with unique parents

public parents(selector?: any): appFrameworkCollection

Returns the parents of the elements based off the selector (traversing up until html document)

$("#foo").parents('.bar');
$("#foo").parents($('.bar'));
$("#foo").parents($('.bar').get(0));
title

$().parents(selector)

Parameters

  • selector?: any optional

Returns

appFrameworkCollection

appframework object with unique parents

public prepend(content: any): appFrameworkCollection

Prepends to the elements This simply calls append and sets insert to true

$().prepend("<div></div>");//Creates the object from the string and appends it
$().prepend($("#foo")); //Prepends an object
title

$().prepend(element)

Parameters

  • content: any

Returns

appFrameworkCollection

appframework object

public prependTo(target: any): appFrameworkCollection

Prepends the current collection to the selector

$().prependTo("#foo"); //Prepend an object;
title

$().prependTo(element)

Parameters

  • target: any

Returns

appFrameworkCollection

public prop(attribute: string): any

Gets or sets a property on an element If used as a getter, we return the first elements value. If nothing is in the collection, we return undefined

$().prop("foo"); //Gets the first elements 'foo' property
$().prop("foo","bar");//Sets the elements 'foo' property to 'bar'
$().prop("foo",{bar:'bar'}) //Adds the object to an internal cache
title

$().prop(property,[value])

Parameters

  • attribute: string

Returns

any

If used as a getter, return the property value. If a setter, return an appframework object

public prop(attributeHash: Object): appFrameworkCollection

Parameters

  • attributeHash: Object

Returns

appFrameworkCollection

public prop(attribute: string, value: string): appFrameworkCollection

Parameters

  • attribute: string
  • value: string

Returns

appFrameworkCollection

public prop(attribute: string, value: any): appFrameworkCollection

Parameters

  • attribute: string
  • value: any

Returns

appFrameworkCollection

public push(items?: appFrameworkCollection[]): number

Parameters

Returns

number

public ready(fn: Function): appFrameworkStatic

This is executed when DOMContentLoaded happens, or after if you've registered for it.

$(document).ready(function(){console.log('I'm ready');});
title

$().ready(function)

Parameters

  • fn: Function

Returns

appFrameworkStatic

an appframework object

public reduce(callbackfn: (previousValue: appFrameworkCollection, currentValue: appFrameworkCollection, currentIndex: number, array: appFrameworkCollection[]) => appFrameworkCollection, initialValue?: appFrameworkCollection): appFrameworkCollection

Parameters

  • callbackfn: (previousValue: appFrameworkCollection, currentValue: appFrameworkCollection, currentIndex: number, array: appFrameworkCollection[]) => appFrameworkCollection
  • initialValue?: appFrameworkCollection optional

Returns

appFrameworkCollection

public remove(): appFrameworkCollection

Removes elements based off a selector ``` $().remove(); //Remove all $().remove(".foo");//Remove off a string selector var element=$("#foo").get(0); $().remove(element); //Remove by an element $().remove($(".foo")); //Remove by a collection

```

title

$().remove(selector)

Returns

appFrameworkCollection

appframework object

public remove(selector: string): appFrameworkCollection

Parameters

  • selector: string

Returns

appFrameworkCollection

public remove(element: HTMLElement): appFrameworkCollection

Parameters

  • element: HTMLElement

Returns

appFrameworkCollection

public remove(elements: Array<any>): appFrameworkCollection

Parameters

  • elements: Array<any>

Returns

appFrameworkCollection

public remove(elements: appFrameworkCollection): appFrameworkCollection

Parameters

Returns

appFrameworkCollection

public removeAttr(attribute: string): appFrameworkCollection

Removes an attribute on the elements

$().removeAttr("foo");
title

$().removeAttr(attribute)

Parameters

  • attribute: string

Returns

appFrameworkCollection

appframework object

public removeClass(className: string): appFrameworkCollection

Removes a css class from elements.

$().removeClass("foo"); //single class
$().removeClass("foo selected");//remove multiple classess
title

$().removeClass(name)

Parameters

  • className: string

Returns

appFrameworkCollection

appframework object

public removeProp(attribute: string): appFrameworkCollection

Removes a property on the elements

$().removeProp("foo");
title

$().removeProp(attribute)

Parameters

  • attribute: string

Returns

appFrameworkCollection

appframework object

public replaceClass(oldClassName: string, newClassName: string): appFrameworkCollection

Replaces a css class on elements.

$().replaceClass("on", "off");
title

$().replaceClass(old, new)

Parameters

  • oldClassName: string
  • newClassName: string

Returns

appFrameworkCollection

appframework object

public resize(fn?: (e: Event) => any): appFrameworkCollection

custom events since people want to do $().resize instead of $().bind("resize")

Parameters

  • fn?: (e: Event) => any optional

Returns

appFrameworkCollection

public select(fn?: (e: Event) => any): appFrameworkCollection

custom events since people want to do $().select instead of $().bind("select")

Parameters

  • fn?: (e: Event) => any optional

Returns

appFrameworkCollection

public serialize(): string

Serailizes a form into a query string

$().serialize();
title

$().serialize()

Returns

string

public show(): appFrameworkCollection

Shows all the elements by setting the css display property We look to see if we were retaining an old style (like table-cell) and restore that, otherwise we set it to block

$().show();
title

$().show()

Returns

appFrameworkCollection

an appframework object

public siblings(selector?: any): appFrameworkCollection

Returns the siblings of the element based off the selector

$("#foo").siblings('.bar'); //Selector
$("#foo").siblings($('.bar')); //Objects
$("#foo").siblings($('.bar').get(0)); //Single element
title

$().siblings(selector)

Parameters

  • selector?: any optional

Returns

appFrameworkCollection

appframework object with unique siblings

public size(): number

Returns the number of elements in the collection

$().size();
title

$().size();

Returns

number

public slice(start: number, end?: number): appFrameworkCollection[]

Parameters

  • start: number
  • end?: number optional

Returns

appFrameworkCollection[]

public submit(fn?: (e: Event) => any): appFrameworkCollection

custom events since people want to do $().submit instead of $().bind("submit")

Parameters

  • fn?: (e: Event) => any optional

Returns

appFrameworkCollection

public text(): string

Gets or sets the innerText for the collection. If used as a get, the first elements innerText is returned

$("#foo").text(); //gets the first elements text;
$("#foo").text('new text'); //sets the text
title

$().text([text])

Returns

string

an appframework object

public text(text: string): appFrameworkCollection

Parameters

  • text: string

Returns

appFrameworkCollection

public toggle(show?: boolean): appFrameworkCollection

Toggle the visibility of a div

$().toggle();
$().toggle(true); //force showing
title

$().toggle([show])

Parameters

  • show?: boolean optional

Returns

appFrameworkCollection

an appframework object

public toggleClass(name: string, state?: boolean): appFrameworkCollection

Adds or removes a css class to elements.

$().toggleClass("selected");
title

$().toggleClass(name)

Parameters

  • name: string
  • state?: boolean optional

Returns

appFrameworkCollection

appframework object

public trigger(eventName: string, data?: any): appFrameworkCollection

This triggers an event to be dispatched. Usefull for emulating events, etc.

$().trigger("click",{foo:'bar'});//Trigger the click event and pass in data
title

$().trigger(event,data);

Parameters

  • eventName: string
  • data?: any optional

Returns

appFrameworkCollection

appframework object

public trigger(eventHash: {}, data?: any): appFrameworkCollection

Parameters

  • eventHash: {}
  • data?: any optional

Returns

appFrameworkCollection

public unbind(eventHash: {}): appFrameworkCollection

Unbinds an event to each element in the collection. If a callback is passed in, we remove just that one, otherwise we remove all callbacks for those events

$().unbind('click'); //Unbinds all click events
$().unbind('click',myFunc); //Unbinds myFunc
title

$().unbind(event,[callback]);

Parameters

  • eventHash: {}

Returns

appFrameworkCollection

appframework object

public unbind(eventName?: string): appFrameworkCollection

Parameters

  • eventName?: string optional

Returns

appFrameworkCollection

public unbind(eventName: string, fn?: (e: Event) => any): appFrameworkCollection

Parameters

  • eventName: string
  • fn?: (e: Event) => any optional

Returns

appFrameworkCollection

public undelegate(selector: any, eventHash: {}): appFrameworkCollection

Unbinds events that were registered through delegate. It acts upon the selector and event. If a callback is specified, it will remove that one, otherwise it removes all of them.

$("#div").undelegate("p",'click',callback);//Undelegates callback for the click event
$("#div").undelegate("p",'click');//Undelegates all click events
title

$().undelegate(selector,event,[callback]);

Parameters

  • selector: any
  • eventHash: {}

Returns

appFrameworkCollection

appframework object

public undelegate(selector: any, eventName: string, fn: (e: Event) => any): appFrameworkCollection

Parameters

  • selector: any
  • eventName: string
  • fn: (e: Event) => any

Returns

appFrameworkCollection

public val(): string

Gets or sets an elements value If used as a getter, we return the first elements value. If nothing is in the collection, we return undefined

$().value; //Gets the first elements value;
$().value="bar"; //Sets all elements value to bar
title

$().val([value])

Returns

string

A string as a getter, appframework object as a setter

public val(value: string): appFrameworkCollection

Parameters

  • value: string

Returns

appFrameworkCollection

public vendorCss(transform: string): appFrameworkCollection

Performs a css vendor specific transform:translate operation on the collection.

$("#main").cssTranslate('200px,0,0');
title

$().vendorCss(value)

Parameters

  • transform: string

Returns

appFrameworkCollection

an appframework object

public width(): string

returns the width of the element, including padding on IE

$().width();
title

$().width()

Returns

string

width