Bubbling Library > Examples

Examples of plug and play widgets using the Bubbling Technique

Include the corresponding behavior for each context menu can improve the website functionality without worry about the listeners for each element with a context menu attached:

In this case, we can use the injection feature from the Dispatch Plugin (YAHOO.util.Dispatcher) to load the widget onDemand Click here to load the widgets and using this behaviors as widgets (plug and play widgets).

Dynamic Context Menu Example for RSS+Feed links

Click on the icon to get the RSS FEED

YUIBlog.com Syndication Examples

Example link: Click here to Bookmark the YUI - Yahoo! User Interface

Dynamic Context Menu Example for Bookmark links

Click on the icon to Bookmark this this page

Button link: YUI - Yahoo! User Interface

The most common technique for apply context menus to the large number of links is the use of "getElementByTagName", processing each tag and creating one instance of the context menu object attached to each tag. This pre-processing can freeze your browser, and create memory leaks when you are using dynamic areas. With the bubbling technique we can guarantee the success without worry about dynamic areas. Also we don´t need to refer a link directly using the tabName or an unique ID to create the corresponding context menu object, decreasing the count of links with ID included inside the XHTML code.

This implementation has only two instance of the context menu object (Feed Context Menu and Bookmark Content Menu) for the document, decreasing the memory usage and rendering in realtime each "click" or "right click" event.