« Back to the index

WA.get: make operations on DOM Nodes examples

The get method is a centralized method to access all the DOM nodes based on filters, and make many operations on them, mainly calling grouped Manager functions on all the found nodes.

The get() method works as followed:

1. The code will search all the nodes corresponding to the filter you give it.
There are 3 posibilities:
a - No nodes were found. The subsequent operations will do nothing.
b - There was only one node found. The subsequent operations will work directly on this node.
c - There was more than 1 node found (from 2 to the whole DOM). The subsequent operations will work for each one of the found nodes.
2. The operation is applied to the node(s).
3. The operations can be chained.

The parameter of get() method is a string used to search the nodes:

"#id": If you want to find a single node by its unique id, using the CSS syntax.
".class": If you want to find a list of nodes by their class, using the CSS syntax.
"tag": If you want to find a list of nodes by their tag type, using the CSS syntax.
"!name": If you want to find a list of nodes by their name.

Notes:

Using the "#id" syntax will always returns only one node, the first one found in the page, even if there are more than one node with this id. This is due to the unicity rule of the ID of a Node.
Other syntaxes may return more than one node if they apply to the searched filter.
If no node corresponde to the filter, null is considered and no operation are possible as the result of get().

The operations are grouped by themes:


Examples of Direct access to the nodes
Examples of Content of the nodes
Examples of CSS operations on the nodes
Examples of Metrics of the nodes
Examples of Animations on the nodes (call to animManager)
Examples of Events on the nodes (call to eventManager)


« Back to the index