forked from jquery/api.jquery.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevents.js
31 lines (28 loc) · 952 Bytes
/
events.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
jQuery.print = function(message, insertionType) {
if (typeof(message) == 'object') {
var string = '{<br />',
values = [],
counter = 0;
$.each(message, function(key, value) {
if (value && value.nodeName) {
var domnode = '<' + value.nodeName.toLowerCase();
domnode += value.className ? ' class="' + value.className + '"' : '';
domnode += value.id ? ' id="' + value.id + '"' : '';
domnode += '>';
value = domnode;
}
values[counter++] = key + ': ' + value;
});
string += values.join(',<br />');
string += '<br />}';
message = string;
}
var $output = $('#print-output');
if ($output.length === 0) {
$output = $('<div id="print-output" />').appendTo('body');
}
var $newMessage = $('<div class="print-output-line" />');
$newMessage.html(message);
insertionType = insertionType || 'append';
$output[insertionType]($newMessage);
};