Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions js_src/pid_display.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
goog.provide('app.MessageStructure');

goog.require('goog.dom');
goog.require('goog.html.sanitizer.HtmlSanitizer');
goog.require('goog.ui.Component');
goog.require('goog.ui.Tooltip');

Expand Down Expand Up @@ -88,9 +89,8 @@ app.MessageField.prototype.createDom = function() {
app.MessageField.prototype.enterDocument = function() {
app.MessageField.superClass_.enterDocument.call(this);

var tt = (
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I always thought this was an object at first glance, so I changed it to make it more clear that it's a string.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wondered if that was a linter fix, but perhaps not looking at the blame.

'Type: ' + this._field_info['type'] + '<br>' +
'Name: ' + this._field_info['name'] + '<br>');
var tt = 'Type: ' + this._field_info['type'] + '<br>';
tt += 'Name: ' + this._field_info['name'] + '<br>';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how good the optimiser is, but this would be slightly better if it was just one concat of strings across two lines I think, or does it then throw an error and is that what the brackets were for?


if (this._field_info['multiplier'] != undefined) {
tt += 'Multipler: 10<sup>' + this._field_info['multiplier'] + '</sup><br>';
Expand Down Expand Up @@ -118,8 +118,10 @@ app.MessageField.prototype.enterDocument = function() {
tt += '</ul>';
}

var sanitizer = new goog.html.sanitizer.HtmlSanitizer.Builder().build();

this.tt = new goog.ui.Tooltip(this.getElement());
this.tt.setHtml(tt);
this.tt.setSafeHtml(sanitizer.sanitize(tt));
};


Expand Down Expand Up @@ -231,7 +233,7 @@ app.MessageGroup.prototype.attachTooltip = function(field) {
} else if (max != undefined) {
tt += 'This group repeats at most ' + max + ' times.';
}
this.tt.setHtml(tt);
this.tt.setText(tt);
};


Expand Down
Loading