O'Reilly logo

Liferay User Interface Development by Frank Yu, Xinsheng Chen, Jonas X. Yuan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Node and Nodelist

Node is the interface for DOM operations in Alloy UI. The Node API is based on DOM. Additionally, a Node instance (node) has properties and methods that make its manipulation easier—it is a wrapped DOM element. A node is for a single element, while a nodelist (Nodelist instance) is for a collection of elements.

To manipulate a node, we must put our JavaScript code in such a sandbox as follows:

AUI().use('node', function(A) {
var aNode = A.one('#demo');
});

The Alloy UI sandbox is the same as the YUI sandbox, as we have studied in the YUI3 section. AUI() creates an instance of the AUI class. The use method loads the node module including all the required JavaScript files into the context. The function(A) is a callback method. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required