Report an issue
Class

ElementReplacer (utils)

@ckeditor/ckeditor5-utils/src/elementreplacer

class

Utility class allowing to hide existing HTML elements or replace them with given ones in a way that doesn't remove the original elements from the DOM.

Filtering

Properties

Methods

  • replace( element, [ newElement ] )

    Hides the element and, if specified, inserts the the given element next to it.

    The effect of this method can be reverted by restore.

    Parameters

    element : HTMLElement

    The element to replace.

    [ newElement ] : HTMLElement

    The replacement element. If not passed, then the element will just be hidden.

  • Restores what replace did.