sanitized user view as well

This commit is contained in:
nova 2019-12-07 14:47:25 +05:30
parent e110ce5135
commit f19fef7c57
2 changed files with 7 additions and 3 deletions

View File

@ -7,6 +7,7 @@ import { TemplateFactory } from "../template/TemplateFactory";
import { ActiveUserViewModel } from "../viewmodel/ActiveUserViewModel"; import { ActiveUserViewModel } from "../viewmodel/ActiveUserViewModel";
import { ChatModel } from "../model/ChatModel"; import { ChatModel } from "../model/ChatModel";
import log = require("loglevel"); import log = require("loglevel");
import * as DOMPurify from "dompurify";
export class UserView implements Observer { export class UserView implements Observer {
private readonly _model: Model; private readonly _model: Model;
@ -30,7 +31,8 @@ export class UserView implements Observer {
data.forEach((element: ActiveUserViewModel) => { data.forEach((element: ActiveUserViewModel) => {
html += template(element); html += template(element);
}); });
this._element.innerHTML = html; // this._element.innerHTML = html;
$(this._element).html(DOMPurify.sanitize(html));
this.addUserCallBacks(); this.addUserCallBacks();
console.log(this._element.innerHTML); console.log(this._element.innerHTML);
} }

File diff suppressed because one or more lines are too long