MCPcopy Create free account
hub / github.com/breck7/scroll / _fnLayoutDom

Function _fnLayoutDom

external/.datatables.js:3545–3606  ·  view source on GitHub ↗

* Draw the table with the legacy DOM property * @param {*} settings DT settings object * @param {*} dom DOM string * @param {*} insert Insert point

(settings, dom, insert)

Source from the content-addressed store, hash-verified

3543 * @param {*} insert Insert point
3544 */
3545 function _fnLayoutDom(settings, dom, insert) {
3546 var parts = dom.match(/(".*?")|('.*?')|./g)
3547 var featureNode, option, newNode, next, attr
3548
3549 for (var i = 0; i < parts.length; i++) {
3550 featureNode = null
3551 option = parts[i]
3552
3553 if (option == "<") {
3554 // New container div
3555 newNode = $("<div/>")
3556
3557 // Check to see if we should append an id and/or a class name to the container
3558 next = parts[i + 1]
3559
3560 if (next[0] == "'" || next[0] == '"') {
3561 attr = next.replace(/['"]/g, "")
3562
3563 var id = "",
3564 className
3565
3566 /* The attribute can be in the format of "#id.class", "#id" or "class" This logic
3567 * breaks the string into parts and applies them as needed
3568 */
3569 if (attr.indexOf(".") != -1) {
3570 var split = attr.split(".")
3571
3572 id = split[0]
3573 className = split[1]
3574 } else if (attr[0] == "#") {
3575 id = attr
3576 } else {
3577 className = attr
3578 }
3579
3580 newNode.attr("id", id.substring(1)).addClass(className)
3581
3582 i++ // Move along the position array
3583 }
3584
3585 insert.append(newNode)
3586 insert = newNode
3587 } else if (option == ">") {
3588 // End container div
3589 insert = insert.parent()
3590 } else if (option == "t") {
3591 // Table
3592 featureNode = _fnFeatureHtmlTable(settings)
3593 } else {
3594 DataTable.ext.feature.forEach(function (feature) {
3595 if (option == feature.cFeature) {
3596 featureNode = feature.fnInit(settings)
3597 }
3598 })
3599 }
3600
3601 // Add to the display
3602 if (featureNode) {

Callers 1

_fnAddOptionsHtmlFunction · 0.85

Calls 7

_fnFeatureHtmlTableFunction · 0.85
replaceMethod · 0.80
indexOfMethod · 0.80
splitMethod · 0.80
parentMethod · 0.80
forEachMethod · 0.80
$Function · 0.70

Tested by

no test coverage detected