new FluentDOM(nodeType, className, parentElt, parent)
Utility class for building DOM elements through code with a fluent API
Parameters:
Name | Type | Description |
---|---|---|
nodeType |
string | type of DOM node (ex: 'DIV') |
className |
css classes |
|
parentElt |
parent DOM element |
|
parent |
WinJSContrib.UI.FluentDOM | parent FluentDOM |
- Source:
Example
var elt = new WinJSContrib.UI.FluentDOM('DIV', 'item-content') .text(item.title) .display('none') .element;
Methods
-
addClass(classname) → {WinJSContrib.UI.FluentDOM}
-
Add a css class
Parameters:
Name Type Description classname
css class
- Source:
Returns:
-
append(nodeType, className, callback) → {WinJSContrib.UI.FluentDOM}
-
create a child FluentDOM and append it to current
Parameters:
Name Type Description nodeType
child node type
className
css classes
callback
callback receiving the new FluentDOM as an argument
- Source:
Returns:
current instance (for method chaining)
-
appendTo(elt) → {WinJSContrib.UI.FluentDOM}
-
append element to another DOM element
Parameters:
Name Type Description elt
parent element
- Source:
Returns:
-
attr(name, val) → {WinJSContrib.UI.FluentDOM}
-
set attribute
Parameters:
Name Type Description name
attribute name
val
attribute value
- Source:
Returns:
-
className(classname) → {WinJSContrib.UI.FluentDOM}
-
set className
Parameters:
Name Type Description classname
css classes
- Source:
Returns:
-
createChild(nodeType, className) → {WinJSContrib.UI.FluentDOM}
-
create a child FluentDOM and append it to current
Parameters:
Name Type Description nodeType
child node type
className
css classes
- Source:
Returns:
child FluentDOM
-
ctrl(ctrl, options) → {WinJSContrib.UI.FluentDOM}
-
create a WinJS control
Parameters:
Name Type Description ctrl
constructor or full name of the control
options
control options
- Source:
Returns:
-
display(display) → {WinJSContrib.UI.FluentDOM}
-
set display
Parameters:
Name Type Description display
display
- Source:
Returns:
-
hide() → {WinJSContrib.UI.FluentDOM}
-
set display 'none'
- Source:
Returns:
-
html(text) → {WinJSContrib.UI.FluentDOM}
-
set innerHTML
Parameters:
Name Type Description text
text
- Source:
Returns:
-
opacity(opacity) → {WinJSContrib.UI.FluentDOM}
-
set opacity
Parameters:
Name Type Description opacity
opacity
- Source:
Returns:
-
style(name, val) → {WinJSContrib.UI.FluentDOM}
-
set style property
Parameters:
Name Type Description name
attribute name
val
attribute value
- Source:
Returns:
-
style(name, val) → {WinJSContrib.UI.FluentDOM}
-
set style property
Parameters:
Name Type Description name
attribute name
val
attribute value
- Source:
Returns:
-
tap(callback, options) → {WinJSContrib.UI.FluentDOM}
-
add tap behavior
Parameters:
Name Type Description callback
tap callback
options
tap options
- Source:
Returns:
-
text(text) → {WinJSContrib.UI.FluentDOM}
-
set textContent
Parameters:
Name Type Description text
text
- Source:
Returns:
-
visibility(visibility) → {WinJSContrib.UI.FluentDOM}
-
set visibility
Parameters:
Name Type Description visibility
visibility
- Source:
Returns: