We would like to use [innerHtml]
which is sanitized but the attribute data-tab
should be bypassed.
Example: http://plnkr.co/edit/dBsWKbfa5MYJmtxLgqzO?p=preview
- Why is
data-tab
considered to be unsafe? - How to bypass?
Extracted code from plunkr example:
@Component({
selector: 'my-app',
template: `
<div>
<h2>Hello {{name}}</h2>
<div [innerHtml]="html"></div>
</div>
`,
})
export class App {
name: string;
// why is data-tab considered to be unsafe ?
// how to bypass?
html: string = `
<div data-tab="first">
More HTML, possible unsafe html
</div>
`;
constructor() {
this.name = 'World :-)'
}
}
(We've developed a table component which we're using in our project. This table may provide additional information in a detail panel which allows (sanitized) HTML. A customer requires now tabs within this detail panel. We're using Semantic UI which requires the attribute data-tab
. Further information to Semantic UI tabs see http://semantic-ui.com/modules/tab.html#/examples.)