A class containing an HTMLIFrameElement along with helper functions to make manipulation easier.

Hierarchy

Constructors

Properties

$document: JQuery<Document>

The JQuery (window.$) object of the iframe.

document: Document

The Document object of the iframe.

elementIndex: {
    [key: string]: HTMLElement[];
}

A set of element arrays indexed by their MediaWiki RDFa type. For example, this array may include the key "Transclusion" from the RDFa type "mw:Transclusion".

Type declaration

etag: string

The ETag of the loaded Parsoid document.

fromExisting: boolean

true if the page exists on the wiki.

The frame element used by this ParsoidDocument instance.

A MutationObserver that watches the document for DOM changes.

page: string

The page currently loaded.

restBaseUri: string

A relative URI to the root of the RESTBase instance that the page was loaded from.

revision: number

The current revision. Only set if fromPage/loadPage was used.

Node: typeof ParsoidTransclusionTemplateNode = ParsoidTransclusionTemplateNode
blankDocument: string = '<html><body><section data-mw-section-id="0"></section></body></html>'

A blank Parsoid document, with a section 0.

defaultDocument: string = ParsoidDocument.blankDocument

The default document to create if a page was not found.

Accessors

Methods

  • Destroys the frame and pops it off of the DOM (if inserted). Silently fails if the frame has not yet been built.

    Returns void

  • Deletes all elements that have the same about attribute as the given element. This effectively deletes an element, be it a transclusion set, file, section, or otherwise.

    Parameters

    Returns void

  • Finds the element with the "data-mw" attribute containing the element passed into the function.

    Parameters

    • element: HTMLElement

      The element to find the parent of. This must be a member of the ParsoidDocument's document.

    Returns HTMLElement

    The element responsible for showing the given element.

  • Protected

    Get additional request options to be patched onto RESTBase API calls. Extend this class to modify this.

    Returns Omit<RequestInit, "body" | "method" | "cache">

  • Load a document from HTML.

    Parameters

    • page: string

      The loaded page's name.

    • html: string

      The page's HTML.

    • Optional restBaseUri: string

      A relative or absolute URI to the wiki's RESTBase root.

    Returns Promise<void>

  • Loads a wiki page with this ParsoidDocument.

    Parameters

    • page: string

      The page to load.

    • revision: number = null

      The revision ID of the page to load

    • options: {
          allowMissing?: boolean;
          followRedirects?: boolean;
          reload?: boolean;
          requestOptions?: RequestInit;
          restBaseUri?: string;
      } = {}

      Options for frame loading.

      • Optional allowMissing?: boolean

        Set to false to avoid loading a blank document if the page does not exist.

      • Optional followRedirects?: boolean

        Whether to follow page redirects or not.

      • Optional reload?: boolean

        Whether the current page should be discarded and reloaded.

      • Optional requestOptions?: RequestInit

        Options to pass to the fetch request.

      • Optional restBaseUri?: string

        A relative or absolute URI to the wiki's RESTBase root. This is /api/rest_ by default, though the window.restBaseRoot variable can modify it.

    Returns Promise<void>

  • Load a document from wikitext.

    Parameters

    • page: string

      The page title of this document.

    • wikitext: string

      The wikitext to load.

    • restBaseUri: string

    Returns Promise<void>

  • Clears the frame for a future reload. This will later permit loadPage and other related functions to run without the reload option.

    Returns void

  • Create a new ParsoidDocument instance from plain HTML.

    Parameters

    • page: string

      The name of the page.

    • html: string

      The HTML to use.

    • Optional restBaseUri: string

      The relative URI to the RESTBase instance to be used for transforms.

    • wrap: boolean = true

      Set to false to avoid wrapping the HTML within the body.

    Returns Promise<ParsoidDocument>

  • Create a new ParsoidDocument instance from a page on-wiki.

    Parameters

    • page: string

      The page to load.

    • revision: number = null

      The revision ID of the page to load

    • options: {
          allowMissing?: boolean;
          followRedirects?: boolean;
          reload?: boolean;
          requestOptions?: RequestInit;
          restBaseUri?: string;
      } = {}

      Options for frame loading.

      • Optional allowMissing?: boolean

        Set to false to avoid loading a blank document if the page does not exist.

      • Optional followRedirects?: boolean
      • Optional reload?: boolean

        Whether the current page should be discarded and reloaded.

      • Optional requestOptions?: RequestInit
      • Optional restBaseUri?: string

    Returns Promise<ParsoidDocument>

Generated using TypeDoc