presentation-dom
v3.0.3
Published
The Augmented.js Next - Presentation Dom Module.
Downloads
49
Maintainers
Readme
presentation-core
Augmented.js Presentation Dom Module
API
Table of Contents
- $
- Dom
- stringToHTML
- getAttributes
- createDOMMap
- addAttributes
- diffAtts
- makeElem
- diff
$
Augmented jQuery-like selectors usinge native selectors</br/> Will return a nodelist for all selections unless only one is found.
Examples
$("#myElement");
$("section#main header");
- or start from Element:
$("header", mainSectionEl);
Dom
DOM related functions
getViewportHeight
Gets the height of the browser viewport
Returns number The height of the viewport
getViewportWidth
Gets the width of the browser viewport
Returns number The width of the viewport
setValue
Sets the value of an element Will detect the correct method to do so by element type
Parameters
el
(string | Node) el Element or string of element selectorvalue
string Value to set (or HTML)onlyText
boolean Value will set as text only
getValue
Gets the value of an element Will detect the correct method to do so by element type
Parameters
Returns string Returns the value of the element (or HTML)
selector
Selector function Supports full query selection
Parameters
query
string Element or string of element selector
Returns Node Returns the element (or first of type)
selectors
Selectors function Supports full query selection
Parameters
query
string Element or string of element selector
Returns NodeList Returns all the nodes selected
query
Query function Supports full query selection but acts like jQuery
Parameters
query
string Element or string of element selectorel
(string | Node) el Element to start from (optional)
Returns (NodeList | Node) Returns all the nodes selected
hide
Hides an element
Parameters
show
Shows an element
Parameters
el
(string | Node) el Element or string of element selectordisplay
string Value to set for "display" property (optional)
setClass
Sets the class attribute (completely)
Parameters
addClass
Adds a class attribute
Parameters
removeClass
Remove a class attribute
Parameters
replaceClass
Replace a class attribute with a new one
Parameters
el
(string | Node) el Element or string of element selectoroldCls
string the old class valuenewCls
string the new class value
containsClass
Returns true if it contains the class
Parameters
Returns boolean Returns true is contains class
toggleClass
Toggle class on element
Parameters
empty
Empty a element container
Parameters
injectTemplate
injectTemplate method - Injects a template element at a mount point
Parameters
stringToHTML
Convert a template string into HTML DOM nodes
Parameters
str
String The template string
Returns Node The template HTML
getAttributes
Create an array of the attributes on an element
Parameters
attributes
NamedNodeMap The attributes on an element
Returns Array The attributes on an element as an array of key/value pairs
createDOMMap
Create a DOM Tree Map for an element
Parameters
Returns Array A DOM tree map
addAttributes
Add attributes to an element
Parameters
diffAtts
Diff the attributes on an existing element versus the template
Parameters
makeElem
Make an HTML element
Parameters
elem
Object The element details
Returns Node The HTML element
diff
Diff the existing DOM node versus the template