I create an iFrame element in a script type:
var iFrameElement : HTMLIFrameElement = document.createElement("iframe");
iFrameElement.sandbox.add('allow-forms');
iFrameElement.sandbox.add('allow-scripts');
iFrameElement.sandbox.add('allow-same-origin');
However, the sandbox property is undefined, so an addition is added here (value: string).
I can't figure out how to instantiate a sandbox property, here is the interface defined in lib.d.ts:
interface HTMLIFrameElement {
sandbox: DOMSettableTokenList;
}
interface DOMSettableTokenList extends DOMTokenList {
value: string;
}
interface DOMTokenList {
length: number;
contains(token: string): boolean;
remove(token: string): void;
toggle(token: string): boolean;
add(token: string): void;
item(index: number): string;
[index: number]: string;
toString(): string;
}
I think there is only some syntax that I don’t know how to use here, or there is some other trick to make this work. I searched this site and the Internet in general many times, but the results were not particularly useful.
, , TypeScript (Type 'String' 'value' 'DOMSettableTokenList'), . , , , .
stackoverflow, - .