Replace .html with .text everywhere possible

Jonathan Frederic 12 years ago
parent af4809bec4
commit 35a02a0436

@ -59,7 +59,7 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){
if (description.length === 0) {
this.$label.hide();
} else {
this.$label.html(description);
this.$label.text(description);
this.$label.show();
}
}
@ -103,9 +103,9 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){
var description = this.model.get('description');
if (description.length === 0) {
this.$el.html(' '); // Preserve button height
this.$el.text(' '); // Preserve button height
} else {
this.$el.html(description);
this.$el.text(description);
}
}
return ToggleButtonView.__super__.update.apply(this);

@ -31,12 +31,10 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){
// Called when the model is changed. The model may have been
// changed by another view or by a state update from the back-end.
var description = this.model.get('description');
description = description.replace(/ /g, ' ', 'm');
description = description.replace(/\n/g, '<br>\n', 'm');
if (description.length === 0) {
this.$el.html('&nbsp;'); // Preserve button height
this.$el.text(' '); // Preserve button height
} else {
this.$el.html(description);
this.$el.text(description);
}
if (this.model.get('disabled')) {

@ -71,7 +71,6 @@ define(["notebook/js/widgets/widget"], function(WidgetManager) {
}, this);
this.$el
.html('')
.on("remove", function(){
that.$window.remove();
});
@ -135,7 +134,7 @@ define(["notebook/js/widgets/widget"], function(WidgetManager) {
});
this.$title = $('<div />')
.addClass('widget-modal-title')
.html('&nbsp;')
.text(' ')
.appendTo(this.$title_bar);
this.$body = $('<div />')
.addClass('modal-body')
@ -144,7 +143,7 @@ define(["notebook/js/widgets/widget"], function(WidgetManager) {
.appendTo(this.$window);
this.$show_button = $('<button />')
.html('&nbsp;')
.text(' ')
.addClass('btn btn-info widget-modal-show')
.appendTo(this.$el)
.click(function(){
@ -227,21 +226,17 @@ define(["notebook/js/widgets/widget"], function(WidgetManager) {
// Called when the model is changed. The model may have been
// changed by another view or by a state update from the back-end.
var description = this.model.get('description');
description = description.replace(/ /g, '&nbsp;', 'm');
description = description.replace(/\n/g, '<br>\n', 'm');
if (description.length === 0) {
this.$title.html('&nbsp;'); // Preserve title height
this.$title.text(' '); // Preserve title height
} else {
this.$title.html(description);
this.$title.text(description);
}
var button_text = this.model.get('button_text');
button_text = button_text.replace(/ /g, '&nbsp;', 'm');
button_text = button_text.replace(/\n/g, '<br>\n', 'm');
if (button_text.length === 0) {
this.$show_button.html('&nbsp;'); // Preserve button height
this.$show_button.text(' '); // Preserve button height
} else {
this.$show_button.html(button_text);
this.$show_button.text(button_text);
}
if (!this._shown_once) {

@ -20,8 +20,7 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){
render : function(){
// Called when view is rendered.
this.$el
.addClass('widget-hbox-single')
.html('');
.addClass('widget-hbox-single');
this.$label = $('<div />')
.appendTo(this.$el)
.addClass('widget-hlabel')
@ -34,14 +33,14 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){
this.$droplabel = $('<button />')
.addClass('btn')
.addClass('widget-combo-btn')
.html('&nbsp;')
.text(' ')
.appendTo(this.$buttongroup);
this.$dropbutton = $('<button />')
.addClass('btn')
.addClass('dropdown-toggle')
.addClass('widget-combo-carrot-btn')
.attr('data-toggle', 'dropdown')
.html('<span class="caret"></span>')
.append($('<span />').addClass("caret"))
.appendTo(this.$buttongroup);
this.$droplist = $('<ul />')
.addClass('dropdown-menu')
@ -59,12 +58,10 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){
if (options === undefined || options.updated_view != this) {
var selected_item_text = this.model.get('value');
selected_item_text = selected_item_text.replace(/ /g, '&nbsp;');
selected_item_text = selected_item_text.replace(/\n/g, '<br>\n');
if (selected_item_text.length === 0) {
this.$droplabel.html('&nbsp;');
this.$droplabel.text(' ');
} else {
this.$droplabel.html(selected_item_text);
this.$droplabel.text(selected_item_text);
}
var items = this.model.get('values');
@ -73,7 +70,7 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){
for (var index in items) {
var that = this;
var item_button = $('<a href="#"/>')
.html(items[index])
.text(items[index])
.on('click', $.proxy(this.handle_click, this));
$replace_droplist.append($('<li />').append(item_button));
}
@ -97,7 +94,7 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){
if (description.length === 0) {
this.$label.hide();
} else {
this.$label.html(description);
this.$label.text(description);
this.$label.show();
}
}
@ -109,7 +106,7 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){
// Calling model.set will trigger all of the other views of the
// model to update.
this.model.set('value', $(e.target).html(), {updated_view: this});
this.model.set('value', $(e.target).text(), {updated_view: this});
this.touch();
},
@ -148,7 +145,7 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){
if (this.$el.find(item_query).length === 0) {
var $label = $('<label />')
.addClass('radio')
.html(items[index])
.text(items[index])
.appendTo(this.$container);
$('<input />')
@ -188,7 +185,7 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){
if (description.length === 0) {
this.$label.hide();
} else {
this.$label.html(description);
this.$label.text(description);
this.$label.show();
}
}
@ -239,7 +236,7 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){
$('<button />')
.attr('type', 'button')
.addClass('btn')
.html(items[index])
.text(items[index])
.appendTo(this.$buttongroup)
.on('click', $.proxy(this.handle_click, this));
}
@ -255,7 +252,7 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){
// Remove items that no longer exist.
this.$buttongroup.find('button').each(function(i, obj) {
var value = $(obj).html();
var value = $(obj).text();
var found = false;
for (var index in items) {
if (items[index] == value) {
@ -273,7 +270,7 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){
if (description.length === 0) {
this.$label.hide();
} else {
this.$label.html(description);
this.$label.text(description);
this.$label.show();
}
}
@ -285,7 +282,7 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){
// Calling model.set will trigger all of the other views of the
// model to update.
this.model.set('value', $(e.target).html(), {updated_view: this});
this.model.set('value', $(e.target).text(), {updated_view: this});
this.touch();
},
});
@ -321,7 +318,7 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){
var item_query = ' :contains("' + items[index] + '")';
if (this.$listbox.find(item_query).length === 0) {
$('<option />')
.html(items[index])
.text(items[index])
.attr('value', items[index])
.appendTo(this.$listbox)
.on('click', $.proxy(this.handle_click, this));
@ -337,7 +334,7 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){
// Remove items that no longer exist.
this.$listbox.find('option').each(function(i, obj) {
var value = $(obj).html();
var value = $(obj).text();
var found = false;
for (var index in items) {
if (items[index] == value) {
@ -355,7 +352,7 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){
if (description.length === 0) {
this.$label.hide();
} else {
this.$label.html(description);
this.$label.text(description);
this.$label.show();
}
}
@ -367,7 +364,7 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){
// Calling model.set will trigger all of the other views of the
// model to update.
this.model.set('value', $(e.target).html(), {updated_view: this});
this.model.set('value', $(e.target).text(), {updated_view: this});
this.touch();
},
});

@ -46,7 +46,7 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){
accordian
.find('.accordion-heading')
.find('.accordion-toggle')
.html(titles[page_index]);
.text(titles[page_index]);
}
}
@ -107,7 +107,7 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){
that.model.set("selected_index", index, {updated_view: this});
that.touch();
})
.html('Page ' + index)
.text('Page ' + index)
.appendTo(accordion_heading);
var accordion_body = $('<div />', {id: uuid})
.addClass('accordion-body collapse')
@ -190,7 +190,7 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){
var tab_text = $('<a />')
.attr('href', '#' + uuid)
.attr('data-toggle', 'tab')
.html('Page ' + index)
.text('Page ' + index)
.appendTo(tab)
.click(function (e) {
@ -221,7 +221,7 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){
for (var page_index in titles) {
var tab_text = this.containers[page_index];
if (tab_text !== undefined) {
tab_text.html(titles[page_index]);
tab_text.text(titles[page_index]);
}
}

@ -27,7 +27,7 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){
//
// Called when the model is changed. The model may have been
// changed by another view or by a state update from the back-end.
this.$el.html(this.model.get('value'));
this.$el.html(this.model.get('value')); // CAUTION! .html(...) CALL MANDITORY!!!
return HTMLView.__super__.update.apply(this);
},
});
@ -45,7 +45,7 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){
//
// Called when the model is changed. The model may have been
// changed by another view or by a state update from the back-end.
this.$el.html(this.model.get('value'));
this.$el.text(this.model.get('value'));
MathJax.Hub.Queue(["Typeset",MathJax.Hub,this.$el.get(0)]);
return LatexView.__super__.update.apply(this);
@ -58,8 +58,7 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){
render: function(){
// Called when view is rendered.
this.$el
.addClass('widget-hbox')
.html('');
.addClass('widget-hbox');
this.$label = $('<div />')
.appendTo(this.$el)
.addClass('widget-hlabel')
@ -101,7 +100,7 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){
if (description.length === 0) {
this.$label.hide();
} else {
this.$label.html(description);
this.$label.text(description);
this.$label.show();
}
}
@ -131,8 +130,7 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){
render: function(){
// Called when view is rendered.
this.$el
.addClass('widget-hbox-single')
.html('');
.addClass('widget-hbox-single');
this.$label = $('<div />')
.addClass('widget-hlabel')
.appendTo(this.$el)
@ -162,7 +160,7 @@ define(["notebook/js/widgets/widget"], function(WidgetManager){
if (description.length === 0) {
this.$label.hide();
} else {
this.$label.html(description);
this.$label.text(description);
this.$label.show();
}
}

Loading…
Cancel
Save