One method for defining a tab’s content is to create a tab out of an
existing HTML DOM node, such as a
div. This is an excellent tab method to use if
you are trying to promote Model-View-Controller (MVC) design
patterns, which separate markup from programming logic.
Applying what we have learned thus far about the tab creation methods in a gadget XML spec, we can build out a tab using a base HTML node as our foundation:
The full code for this sample is available at https://github.com/jcleblanc/programming-social-applications/blob/master/chapter_4/creating_tabs_from_markup.xml.
In this example, we create two tabs, one with just plain text and
another with additional HTML markup within the
div node. To prevent a jarring UI switch, we
set the display for both tabs to
to hide them until they’re built.
script block, we
create a new
TabSet object with the module ID as the first parameter and the name of the default tab as the second ...