MCPcopy Create free account
hub / github.com/TruthHun/BookStack / appendBody

Function appendBody

static/js/printThis.js:54–78  ·  view source on GitHub ↗
($body, $element, opt)

Source from the content-addressed store, hash-verified

52 }
53
54 function appendBody($body, $element, opt) {
55 // Clone for safety and convenience
56 // Calls clone(withDataAndEvents = true) to copy form values.
57 var $content = $element.clone(opt.formValues);
58
59 if (opt.formValues) {
60 // Copy original select and textarea values to their cloned counterpart
61 // Makes up for inability to clone select and textarea values with clone(true)
62 copyValues($element, $content, 'select, textarea');
63 }
64
65 if (opt.removeScripts) {
66 $content.find('script').remove();
67 }
68
69 if (opt.printContainer) {
70 // grab $.selector as container
71 $content.appendTo($body);
72 } else {
73 // otherwise just print interior elements of container
74 $content.each(function() {
75 $(this).children().appendTo($body)
76 });
77 }
78 }
79
80 // Copies values from origin to clone for passed in elementSelector
81 function copyValues(origin, clone, elementSelector) {

Callers 1

printThis.jsFile · 0.85

Calls 2

copyValuesFunction · 0.85
$Function · 0.50

Tested by

no test coverage detected