Skip to content

Commit 839a27d

Browse files
authored
Merge pull request #209 from FloEdelmann/closure
Fix ClosureJS error
2 parents a65cc88 + c01a419 commit 839a27d

File tree

3 files changed

+101
-81
lines changed

3 files changed

+101
-81
lines changed

js_src/pid_display.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
goog.provide('app.MessageStructure');
2121

2222
goog.require('goog.dom');
23+
goog.require('goog.html.sanitizer.HtmlSanitizer');
2324
goog.require('goog.ui.Component');
2425
goog.require('goog.ui.Tooltip');
2526

@@ -88,9 +89,8 @@ app.MessageField.prototype.createDom = function() {
8889
app.MessageField.prototype.enterDocument = function() {
8990
app.MessageField.superClass_.enterDocument.call(this);
9091

91-
var tt = (
92-
'Type: ' + this._field_info['type'] + '<br>' +
93-
'Name: ' + this._field_info['name'] + '<br>');
92+
var tt = 'Type: ' + this._field_info['type'] + '<br>' +
93+
'Name: ' + this._field_info['name'] + '<br>';
9494

9595
if (this._field_info['multiplier'] != undefined) {
9696
tt += 'Multipler: 10<sup>' + this._field_info['multiplier'] + '</sup><br>';
@@ -113,13 +113,15 @@ app.MessageField.prototype.enterDocument = function() {
113113
tt += 'Labeled Values: <ul>';
114114
var enums = this._field_info['enums'];
115115
for (var i = 0; i < enums.length; ++i) {
116-
tt += '<li>' + enums[i]['value'] + ': ' + enums[i]['label'] + '</li/>';
116+
tt += '<li>' + enums[i]['value'] + ': ' + enums[i]['label'] + '</li>';
117117
}
118118
tt += '</ul>';
119119
}
120120

121+
var sanitizer = new goog.html.sanitizer.HtmlSanitizer.Builder().build();
122+
121123
this.tt = new goog.ui.Tooltip(this.getElement());
122-
this.tt.setHtml(tt);
124+
this.tt.setSafeHtml(sanitizer.sanitize(tt));
123125
};
124126

125127

@@ -231,7 +233,7 @@ app.MessageGroup.prototype.attachTooltip = function(field) {
231233
} else if (max != undefined) {
232234
tt += 'This group repeats at most ' + max + ' times.';
233235
}
234-
this.tt.setHtml(tt);
236+
this.tt.setText(tt);
235237
};
236238

237239

0 commit comments

Comments
 (0)