ElementReplacer (utils)
@ckeditor/ckeditor5-utils/src/elementreplacer
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
-
_replacedElements : Array.<Object>
private
The elements replaced by
replace
and their replacements.
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.
-
restore()
Restores what
replace
did.
Every day, we work hard to keep our documentation complete. Have you spotted an outdated information? Is something missing? Please report it via our issue tracker.