Constructor.
the original element to wrap
CKEditor instance
the namespaces to take into account
signals, if this proxy should be mutable; trying to modify an immutable proxy will raise an error.
Readonly
classA mutable list of classes applied to the element.
Readonly
nodeRepresents the node instance. For ElementProxy
this is just the
proxy class itself.
Mimics ElementFilterParams
, which helps to deal with rule processing.
Readonly
parentRepresents the parent rule. No-Operation rule for ElementProxy
.
Mimics ElementFilterParams
, which helps to deal with rule processing.
Provides access to the attributes of the element. Any modifications are interpreted as modification requests, thus, they are not directly forwarded to the element, but need to be persisted later on.
Setting an attribute to a new value, will change the value later on.
Deleting an attribute, or setting its value to null
will later
remove the attribute from the element.
Returns the wrapped delegate.
This delegate should not be used for directly manipulating the DOM, as nested rules may not veto applied changes.
If a manipulation is done, it must be ensured, that previously run rules on this node may be rerun. It is generally considered safe to do manipulation to child elements, as these are processed after this node, so that all applicable rules have a chance to modify these nodes again.
Represents the editor instance. May be used to access configuration options for example.
Mimics ElementFilterParams
, which helps to deal with rule processing.
Get direct access to the delegate element.
Signals, if this node is empty, thus, has no child nodes.
isEmpty
Signals, if this is the last node in parent. Always false
if no
parent exists.
Signals, if this element is mutable.
Retrieve the name of the element. If the name got changed, will return this changed name instead.
Set a new name for this element. Setting a name different to the original name signals, that in the end the delegate element shall be replaced by the new element.
new name for the element; case does not matter.
Get namespace URI of current element.
Access owner document.
Retrieves the name of the node (lower case).
If renaming is supported by this instance, it may differ from
name
, otherwise, it is the same.
Signals, if this node is meant to be removed. This includes recursive removal (including children) as well as just removing this node (replacing it by its children).
Signals, if this mutable element represents a state, where the element shall be removed, including all its children.
It is important to note, that setting this modifies the NodeProxy#state, thus setting this overrides any other decisions upon the state of the node.
Duplicate Spaces: If you apply this modification, it may
end up having duplicate space characters in your DOM. For example if
removing the `
you will end up having:
with two white space characters in the middle. You may want to detect such
states, and remove the duplicate space. You shouldn't do this, though, if
you are within a space preserving context such as ``.
Signals, if this node represents a state, where the children of the node should be removed.
Sets, if this node represents a state, where the children of the node shall be removed.
It is important to note, that setting this modifies the NodeProxy#state, thus setting this overrides any other decisions upon the state of the node.
true
to mark as remove children; false
otherwise.
Signals, if this node represents a state, where the node shall be removed, while attaching the children to the parent node.
Sets, if this node represents a state, where the node shall be removed, while attaching the children to the parent node.
It is important to note, that setting this modifies the NodeProxy#state, thus setting this overrides any other decisions upon the state of the node.
true
to mark as replace with children; false
otherwise.
Signals, if this is the only child node at parent node.
Apply given rules. If any of the rules will invalidate this element either by deletion, no further rules will be applied.
Rest
...rules: (undefined | ElementFilterRule)[]rules to apply in given order
a node, if filtering should be continued from this node; null
for default as next node.
Protected
continueHelper function for return value, which signals to continue with another node, but to do not abort current processing.
node to continue with
Get first (matching) child node of the given element.
Optional
condition: string | ChildPredicatestring: the node name to match (ignoring case), predicate: the predicate to apply.
Signals, if this element is empty.
Optional
considerChildNode: ChildPredicatesignals, if a given node shall be considered while determining empty state
Protected
persistNode should be kept, but may require applying attribute changes or to replace the element by a new one.
Protected
persistPersists removal of all child nodes.
Protected
persistPersists the deletion of this node and all its child nodes.
Protected
persistPersists, that only the node itself shall be removed. The default implementation will replace the node with its child nodes.
Protected
requireProtected
restartHelper function for return value, which signals "restart from".
node to restart from
Static
instantiateThis provides a light-weight proxy, which is unaware of the editor.
It is meant for testing purpose only, thus, not recommended for production
use, as filters may rely on the editor
property being set.
the original element to wrap
Static
proxyWraps the given node into a NodeProxy. If the node is falsy, null
will be returned.
node to wrap
signals, if this representation is mutable or not
NodeProxy for given node; null
for falsy values
A wrapper for a given element, which allows storing changes to be applied to the DOM structure later on.