API Documentation
ofa.js not only supports template syntax, but also provides a rich API for direct DOM manipulation. Like jQuery , you can use concise ofa.js syntax to replace verbose native JavaScript, easily performing DOM operations.
In component or page module lifecycle functions and custom methods, you can call the API provided by ofa.js at any time to flexibly and efficiently manipulate DOM elements.
Instance Related
Core function in ofa.js for obtaining and manipulating DOM element instances
Get all child element instances of the current element
Get the shadow root of the current element
Get the previous sibling element of the current element
Get all previous sibling elements of the current element
Get the next sibling element of the current element
Get all subsequent sibling elements of the current element
Get all sibling elements of the current element
Get the parent element of the current element
Get all ancestor elements of the current element
Clone the current element and its children
Get child element instances of the current element
Get the root instance to which the current element belongs
Get all child elements of the current element
Get the web component host element to which the current element belongs
Get the o-app component instance to which the current element belongs
Node Operations
Add child elements to the current element
Remove the last child element of the current element
Remove the first child element of the current element
Add the first child element to the current element
Add or remove child elements of the current element
Add sibling elements before the current element
Add sibling elements after the current element
Remove the current element
Wrap the current element within a specified element
Remove the parent wrapper of the current element
Attribute Operations
Get or set the text content of the element
Get or set the HTML content of the element
Get or set attributes of the element
Get or set the styles of the element
Get the style object of the element
Get the class name list of the element
Get or set the data attribute of the element
Event Related
Add an event listener to the element
Add an event listener that executes only once to the element
Trigger a custom event on the element
Remove an event listener from the element
Others
The root component of an ofa.js application, used to manage application state and routing
The page component of ofa.js, used to create single-page application pages
Summary of properties of the return objects of page modules and component modules
Get form data
Get the tag name of the element
Get the index of the element within its parent
Check if the element matches a specified selector
Refresh the current component or page
Get the path of the current page
Extend the functionality of ofa.js
Get the version number of ofa.js
Stanz is the reactive data feature of ofa.js, supporting automatic data updates