EconsorDOMObject (in progress)
What is the EconsorDOMObject?
The EconsorDOMOBject is a simple Object that includes a DOM Node in it's element property and allows you to call multiple functions on it, not unlike JQuery.
danger
Use the Helper to create them!!
Properties
element: The contained DOM NodeclassesThe classlist of the contained Node.
Methods
closest(query)
Like the JQuery/JS Method, but returns the equivalent EconsorDOMObject instead.
find(query)
Like the JQuery/JS Method, but returns the equivalent EconsorDOMObject(s) instead.
data(name (optional), value (optional))
- If no parameters are given, will return the element's dataset.
- If you specify the data name, will return that specific data's value.
- If you specify both data name and a value, it will set/add that data attribute.
attribute(name (optional), value (optional))
- If no parameters are given, will return the element's attributes.
- If you specify the attribute name, will return that specific attribute's value.
- If you specify both attribute name and a value, it will set/add that attribute.
hasClass(class name)
Returns a boolean value, checking if the Node has the class youre looking for.
setClass(class name, flag (optional))
- If you dont specify a flag, will add a class to the Node. If the class already exists, this will do nothing.
- If you specify a flag, it will either remove or add the class depending on whether the flag is
falseortrue.
toggleClass(class name, flag (optional))
- If you dont specify a flag, will add a class to the Node. If the class already exists, it will remove the class.
- If you specify a flag, it will either remove or add the class depending on whether the flag is
falseortrue.
replaceClass(replace, replaceWith)
Will replace the class given as the first parameter with the class given as the second parameter.
load()
Will create the loading overlay from Shopware's ElementLoadingIndicatorUtil on the element.
unload()
Will remove the loading overlay from Shopware's ElementLoadingIndicatorUtil from the element.