Skip to content

Commit 2116353

Browse files
committed
just use innerHTML when making nodes
1 parent 05abf5a commit 2116353

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

view_notebook.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,11 @@
33

44
console.log("nbchrome loading");
55

6-
function make_node(tag, attributes, innerText, innerHTML) {
6+
function make_node(tag, attributes, innerHTML) {
77
var node = document.createElement(tag);
88
for (var a in attributes) {
99
node.setAttribute(a, attributes[a]);
1010
}
11-
if (innerText) {
12-
node.innerText = innerText;
13-
}
1411
if (innerHTML) {
1512
node.innerHTML = innerHTML;
1613
}
@@ -52,13 +49,13 @@ function render_markdown_cell(cell) {
5249
make_node('div', {class: 'prompt input_prompt'}));
5350
div.appendChild(
5451
make_node('div', {class: 'inner_cell'})).appendChild(
55-
make_node('div', {class: 'text_cell_render border-box-sizing rendered_html'}, undefined, markdown_html));
52+
make_node('div', {class: 'text_cell_render border-box-sizing rendered_html'}, markdown_html));
5653

5754
return div;
5855
}
5956

6057
function render_dummy_cell(cell) {
61-
return make_node('div', {}, undefined, 'Cell type ' + cell.cell_type + ' not supported');
58+
return make_node('div', {}, 'Cell type ' + cell.cell_type + ' not supported');
6259
}
6360

6461
function make_code_input_div(cell) {
@@ -68,7 +65,7 @@ function make_code_input_div(cell) {
6865
var input = make_node('div', {class: 'input'});
6966

7067
input.appendChild(
71-
make_node('div', {class: 'prompt input_prompt'}, undefined, 'In [' + (cell.execution_count || '') + ']:'));
68+
make_node('div', {class: 'prompt input_prompt'}, 'In [' + (cell.execution_count || '') + ']:'));
7269

7370
input.appendChild(
7471
make_node('div', {class: 'inner_cell'})).appendChild(
@@ -97,7 +94,7 @@ function make_output_area(output) {
9794
var output_area = make_node('div', {class: 'output_area'});
9895

9996
if ('execution_count' in output) {
100-
output_area.appendChild(make_node('div', {class: 'prompt output_prompt'}, undefined, 'Out[' + output.execution_count + ']:'));
97+
output_area.appendChild(make_node('div', {class: 'prompt output_prompt'}, 'Out[' + output.execution_count + ']:'));
10198
}
10299
else {
103100
output_area.appendChild(make_node('div', {class: 'prompt'}));
@@ -127,7 +124,7 @@ function make_output_area(output) {
127124
}
128125

129126
function make_html_output(output) {
130-
return make_node('div', {class: 'output_html rendered_html output_subarea output_execute_result'}, undefined, output.data['text/html'].join(''));
127+
return make_node('div', {class: 'output_html rendered_html output_subarea output_execute_result'}, output.data['text/html'].join(''));
131128
}
132129

133130
function make_text_output(output) {
@@ -144,7 +141,7 @@ function make_image_output(output) {
144141

145142
function make_stream_output(output) {
146143
var output_text = make_node('div', {class: 'output_subarea output_stream output_stdout output_text'});
147-
output_text.appendChild(make_node('pre', {}, undefined, output.text.join('')));
144+
output_text.appendChild(make_node('pre', {}, output.text.join('')));
148145
return output_text;
149146
}
150147

0 commit comments

Comments
 (0)