Options
All
  • Public
  • Public/Protected
  • All
Menu

Module FrameTools

A set of utility functions and helpers for IFrames

Index

Variables

Const dragEvents

dragEvents: string[] = ["dragstart","drag","dragenter","dragexit","dragleave","dragover","drop","dragend"]

Const focusEvents

focusEvents: string[] = ["focus","blur","focusin","focusout",]

Const keyboardEvents

keyboardEvents: string[] = ["keydown","keypress","keyup"]

Const mouseEvents

mouseEvents: string[] = ["mouseenter","mouseover","mousemove","mousedown","mouseup","pointerdown","pointerenter","pointerdown","pointermove","pointerup","pointercancel","pointerout","pointerleave","gotpointercapture","lostpointercapture","auxclick","click","dblclick","contextmenu","wheel","mouseleave","mouseout","select","pointerlockchange","pointerlockerror",]

Functions

DisableFramePointerEvents

  • DisableFramePointerEvents(): void
  • Disable all mouse events in all iframes on this page.

    Notes

    This is necessary for many drag-n-drop operations, since without it the frames will not only eat the events, but may leave applications in a bad state.

    While the event copying utilities above mitigate this, they cannot prevent it entirely.

    Returns void

EnableFramePointerEvents

  • EnableFramePointerEvents(): void
  • Enable all mouse events on all iframes on this page.

    Notes

    This accompanies DisableFramePointerEvents, and should be used to revert back to a healthy state after a drag operation is complete.

    see

    DisableFramePointerEvents

    Returns void

bubbleEvents

  • bubbleEvents(childDocument: HTMLDocument, parentElement: HTMLElement): DisposableDelegate
  • Clone events from a given document to an HTMLElement on a different document.

    Parameters

    • childDocument: HTMLDocument

      The document to capture events from

    • parentElement: HTMLElement

      An HTML element to create new events on

    Returns DisposableDelegate

    A disposable delegate that can be used to unhook the bubbling

    Notes

    This is used by the MavenWorks framework to clone events from popups and iframes out to the parent window. There are a number of caveats, which are detailed below.

    Keyboard events

    Keyboard events are copied wholesale, using the original event as an event init dict.

    Caveat: Keyboard events are not cloned if their target is the child document's active element (meaning, it has focus).

    Mouse events

    Mouse events have their clientX and clientY properties corrected to matcch the parent document's positioning. No other properties are corrected in this manner, though such corrections should be implemented if the need arises.

    Drag events

    Drag events do not have their positions corrected, and do not include their dataTransfer objects.

    Focus events

    Focus events will not result in CSS focus being applied.

cloneEvent

  • cloneEvent<T>(type: string, ctor: T, ev: InstanceType<T>, el: HTMLElement, correctForPosition?: boolean): void
  • Type parameters

    • T: object

    Parameters

    • type: string
    • ctor: T
    • ev: InstanceType<T>
    • el: HTMLElement
    • Default value correctForPosition: boolean = false

    Returns void

copyStylesheets

  • copyStylesheets(fromDocument: HTMLDocument, toDocument: HTMLDocument): void
  • Copy stylesheets and base-urls from one document to another.

    Parameters

    • fromDocument: HTMLDocument

      The document to copy and