mobile.dom
Methods
create(element, props, child1, child2, …, childn)
This method is called to create a dom node.
Parameters
Name |
Type |
Description |
element |
String |
Name of the HTML element to create. |
props |
Object |
Optional. Properties to set on the element. |
childx |
DOMNode |
Nodes to append to the newly created element. |
Returns
Type |
Description |
DOMNode |
The newly created element. |
Examples
var $ = mobile.dom.create;
var table = $("table", {
"class" : "bordered-table",
style : "font-weight:bold"
},
$("tbody",
$("tr",
$("td", "content")
)
)
);
var node = $("div", {
style : {
color : "red",
cursor : "pointer",
fontWeight : "bold"
},
},
$("span", "text")
);
escapeString(str)
Escapes HTML special characters in str
so it can be used inside HTML documents.
Name |
Type |
Description |
str |
String |
String to escape |
getCss(path, doc)
Get the DOMNode from a document linking to the given stylesheet.
Parameters
Name |
Type |
Description |
path |
String |
Path of the stylesheet location. |
doc |
Document |
Document in which to look for the stylesheet link. Defaults to document . |
addCss(path, doc, media)
Add a link to the given stylesheet to a document.
Parameters
Name |
Type |
Description |
path |
String |
Path of the stylesheet location. |
doc |
Document |
Document to add the stylesheet link to. Defaults to document . |
media |
String |
String describing the media types supported by the stylesheet. |