Menu Developer Moovweb University

Global Namespace

breakpoint(breakpointId)
functions
Source (L98)

Calls the debugger and logs a message to the console, provided that the debug mode has been enabled (the moov_debug parameter must exist in the URL and the Dashboard Inspector must be open).

Parameters

Name Type Description
breakpointId String A string for a breakpoint terminal message.

Return Value

`undefined`

Example

if (env.path.indexOf("moov_debug=true") >= 0) {
  breakpoint("Parameter 'moov_debug=true' detected in the URL.");
}
// => Result: Breaks in the Dashboard Inspector and logs the appropriate
//    message.

Back to top


tag(name, [attribs], [content])
functions
Source (L13)

Creates a new element. Note that this is not a Cheerio object: you should wrap it in `$()` if Cheerio methods need to be invoked on it.

Parameters

Name Type Description
name String A string for the name of the element.
[ attribs ] Object Optional. An object containing the attribute-value pairs of the new element.
[ content ] String Optional. A string for the text node for the new element.

Return Value

An object associated with the newly-created DOM element. defined by the arguments passed in (denoted by a `type` value of "tag").

Examples

let grape = tag("li", {class: "grape"}, "Grape");
grape.insertAfter(".apple");
// => Throws: TypeError (grape is not a Cheerio object, and the object
//    associated with the grape DOM element does not have an insertAfter
//    method defined)
$body.find("ul").append(grape);
// => Note: This is OK - you can append a non-Cheerio object here
// => HTML output:
//    <ul id="fruits">
//      <li class="apple" data-which="fuji">Apple</li>
//      <li class="grape">Grape</li>
//      <li class="pear">Pear</li>
//      <li class="orange">Orange</li>
//    </ul>
let $grape = $(tag("div", {class: "grape"}, "Grape"));
$grape.insertAfter(".apple");
// => Returns: original Cheerio object associated with the newly-created
//    `.grape` element
// => HTML output:
//    <ul id="fruits">
//      <li class="apple" data-which="fuji">Apple</li>
//      <li class="grape">Grape</li>
//      <li class="pear">Pear</li>
//      <li class="orange">Orange</li>
//    </ul>

Back to top


txt(content)
functions
Source (L68)

Creates a new text node.

Parameters

Name Type Description
content string A string for the content that the text node will contain.

Return Value

An object associated with the newly-created text node defined by the `content` argument passed in (denoted by a `type` value of "text").

Example

$body.find(".apple").append(txt(", more text"));
// => HTML output:
//    <ul id="fruits">
//      <li class="apple" data-which="fuji">Apple, more text</li>
//      <li class="pear">Pear</li>
//      <li class="orange">Orange</li>
//    </ul>

Back to top


Last updated Tue Nov 15 2016 22:28:30 GMT+0000 (UTC)