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
-
private
_replacedElements : Array<object>
module:utils/elementreplacer~ElementReplacer#_replacedElements
The elements replaced by
replace
and their replacements.
Methods
-
constructor()
module:utils/elementreplacer~ElementReplacer#constructor
-
replace( element, [ newElement ] ) → void
module:utils/elementreplacer~ElementReplacer#replace
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.
Returns
void
-
restore() → void
module:utils/elementreplacer~ElementReplacer#restore
Every day, we work hard to keep our documentation complete. Have you spotted outdated information? Is something missing? Please report it via our issue tracker.