src/Sprite.js
function Sprite( aElement, aProperties, aContent )
{
    aProperties    = aProperties || {};
    var domElement = "div";

    if ( aElement && typeof aElement !== "object" )
    {
        domElement = /** @type {string} */ ( aElement);
    }

    /* creates HTML element of requested tag type in the DOM */

    if ( !aElement || typeof aElement === "string" )
    {
        this._element = document.createElement( domElement );
    }
    else
    {
        this._element = /** @type {Element} */ ( aElement );
    }

    Object.keys( aProperties ).forEach( function( key )
    {
        this._element.setAttribute( key, aProperties[ key ]);

    }.bind( this ));


    if ( aContent )
    {
        this.setContent( aContent );
    }
    this._children = [];

    Inheritance.super( this );

    this._eventHandler = new EventHandler(); // separate handler for DOM Events
}
function Sprite( aElement, aProperties, aContent )
{
    aProperties    = aProperties || {};
    var domElement = "div";

    if ( aElement && typeof aElement !== "object" )
    {
        domElement = /** @type {string} */ ( aElement);
    }

    /* creates HTML element of requested tag type in the DOM */

    if ( !aElement || typeof aElement === "string" )
    {
        this._element = document.createElement( domElement );
    }
    else
    {
        this._element = /** @type {Element} */ ( aElement );
    }

    Object.keys( aProperties ).forEach( function( key )
    {
        this._element.setAttribute( key, aProperties[ key ]);

    }.bind( this ));


    if ( aContent )
    {
        this.setContent( aContent );
    }
    this._children = [];

    Inheritance.super( this );

    this._eventHandler = new EventHandler(); // separate handler for DOM Events
}
function Sprite ( aElement , aProperties , aContent ) { aProperties = aProperties || { } ; var domElement = "div" ; if ( aElement && typeof aElement !== "object" ) { domElement = /** @type {string} */ ( aElement ) ; } /* creates HTML element of requested tag type in the DOM */ if ( ! aElement || typeof aElement === "string" ) { this . _element = document . createElement ( domElement ) ; } else { this . _element = /** @type {Element} */ ( aElement ) ; } Object . keys ( aProperties ) . forEach ( function ( key ) { this . _element . setAttribute ( key , aProperties [ key ] ) ; } . bind ( this ) ) ; if ( aContent ) { this . setContent ( aContent ) ; } this . _children = [ ] ; Inheritance . super ( this ) ; this . _eventHandler = new EventHandler ( ) ; // separate handler for DOM Events }
A wrapper providing a convenient API to manage a DOM element, provides
Event handling and "display list"s

extends a basic EventTarget for dispatching events

@constructor

@param {string|Element|Node|Window|HTMLDocument=} aElement when String: this function will create an element in the
DOM with the String as tag name.
when HTMLElement: this function will bind the Sprite class to the existing
HTMLElement (for use when connecting existing HTML templates with the framework)
@param {Object=} aProperties      optional properties for the HTML Element ( eg: id, class, etc. )
@param {string=} aContent         optional body content of this Sprite (innerHTML)

@extends {EventDispatcher}
A wrapper providing a convenient API to manage a DOM element provides Event handling and display list s