/// // Defines a basic HTMLInputElement wrapper. /// // Defines a basic HTMLTextAreaElement wrapper. /// // Defines a basic content-editable wrapper. /// // Defines a basic design-mode IFrame wrapper. /// // Defines a basic touch-alias element wrapper. /// namespace com.keyman.dom { export function wrapElement(e: HTMLElement): text.OutputTarget { // Complex type scoping is implemented here so that kmwutils.ts is not a dependency for test compilations. // TODO: Use dom.Utils.instanceof instead of the current mild code replication done here. if(Utils.instanceof(e, "HTMLInputElement")) { return new Input( e); } else if(Utils.instanceof(e, "HTMLTextAreaElement")) { return new TextArea( e); } else if(Utils.instanceof(e, "TouchAliasElement")) { return new TouchAlias( e); } else if(Utils.instanceof(e, "HTMLIFrameElement")) { let iframe = e; if(iframe.contentWindow && iframe.contentWindow.document && iframe.contentWindow.document.designMode == "on") { return new DesignIFrame(iframe); } else if (e.isContentEditable) { // Do content-editable