Class YDom
Defined in: YDom.js.
Constructor Attributes | Constructor Name and Description |
---|---|
YDom()
Not instanciable.
|
Method Attributes | Method Name and Description |
---|---|
<static> |
YDom.absoluteOffset(source)
get dom element position from nearest parent with style.position='absolute'.
|
<static> |
YDom.clone(source)
clone dom element, his datas and childrens.
|
<static> |
YDom.collectionToList(collection)
convert elements collection to array
|
<static> |
YDom.contentSize(content)
get content dimensions
|
<static> |
YDom.create(name, datas, childs)
create dom element.
|
<static> |
YDom.geElements(tagNames, criterias, root)
get elements list by criterias
|
<static> |
YDom.get(target)
get dom element from target data.
|
<static> |
YDom.getAttributes(name)
return dom element attributes in a new object
|
<static> |
YDom.getElementsByIds(root)
get all elements having an id from root or in the document
|
<static> |
YDom.offset(source, limit)
get dom element position.
|
<static> |
YDom.parse(Function, datas, root)
parse all elements from root or in the document
|
<static> |
YDom.size(target)
get dom element dimensions
|
Method Detail
<static>
{array}
YDom.absoluteOffset(source)
get dom element position from nearest parent with style.position='absolute'.
- Parameters:
- {domElement/mixed} source
- domElement.
- Returns:
- {array} dom element absolute offset possition.
<static>
{domElement}
YDom.clone(source)
clone dom element, his datas and childrens.
- Parameters:
- {domElement/mixed} source
- domElement.
- Returns:
- {domElement} the created new domElement
<static>
{array}
YDom.collectionToList(collection)
convert elements collection to array
- Parameters:
- {collection} collection
- tags collection.
- Returns:
- {array} tags list
<static>
{array}
YDom.contentSize(content)
get content dimensions
- Parameters:
- {string/domElement} content
- dom object or id or html code.
- Returns:
- {array} content dimensions
<static>
{domElement}
YDom.create(name, datas, childs)
create dom element.
ex:
ex:
YDom.create('label',{style:{border:'solid 1px #088'}},["ok?",YDom.create('input',{type:'checkbox'})]);
- Parameters:
- {string} name
- dom tag name.
- {object} datas Optional
- the dom element parameters object. ex {width:100,style:{width:"100px"}}
- {array} childs Optional
- the dom element childs. child units can be domElement or string.
- Returns:
- {domElement} the created new domElement
<static>
{array}
YDom.geElements(tagNames, criterias, root)
get elements list by criterias
- Parameters:
- {string/string Array} tagNames
- tags names.
- {string/string Array} criterias
- elements properties filters (ex:{title:'the title',name:'the name'}).
- {dom} root Optional
- default = document
- Returns:
- {array} tags list
<static>
{domElement/null}
YDom.get(target)
get dom element from target data.
- Parameters:
- {string/domElement} target
- dom object or id.
- Returns:
- {domElement/null} domElement if target is window, document , a dom object or its id , else null.
<static>
{object}
YDom.getAttributes(name)
return dom element attributes in a new object
- Parameters:
- {string/domElement} name
- dom object or id.
- Returns:
- {object} dom element attributes
<static>
{array}
YDom.getElementsByIds(root)
get all elements having an id from root or in the document
- Parameters:
- {dom} root Optional
- default = document.documentElement
- Returns:
- {array} tags list indexed by their ids;
<static>
{array}
YDom.offset(source, limit)
get dom element position.
get position in window if limit==0 or not set.
get position in window if limit==0 or not set.
- Parameters:
- {domElement/mixed} source
- domElement.
- {int} limit
- element offset recursions. Infinite if <=0 .
- Returns:
- {array} dom element offset possition.
<static>
YDom.parse(Function, datas, root)
parse all elements from root or in the document
- Parameters:
- {function} Function
- invoked on every parsed dom element. type:Function(domElement,datas)
- {mixed} datas
- used when Function is invoked
- {dom} root Optional
- default = document.documentElement
<static>
{array}
YDom.size(target)
get dom element dimensions
- Parameters:
- {string/domElement} target
- dom object or id.
- Returns:
- {array} dom element dimensions