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.
Properties
-
_replacedElements : Array<object>
privatemodule:utils/elementreplacer~ElementReplacer#_replacedElements
The elements replaced by
replace
and their replacements.
Methods
-
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