body)
{
page = page.parentNode;
parent = parent.parentNode;
}
var frag = document.createElement(parent.localName);
frag.innerHTML = source;
page.removeChild(parent);
while (frag.firstChild)
page.appendChild(frag.firstChild);
}
Chapter 3: Implementing the Interface
74
If a click is generated from a normal AJAX link, then the contents of the external URL will be displayed
in a new page. Therefore, a div is created and the document fragment is added as the innerHTML of the
element. The iui.insertPages() method adds the new nodes to create a new page, and then this page
is passed to iui.showPage() :
insertPages: function(nodes)
{
var targetPage;
for (var i = 0; i < nodes.length; ++i)
{
var child = nodes[i];
if (child.nodeType == 1)
{
if (!child.id)
child.id = ???__??? + (++newPageCount) + ???__???;
var clone = $(child.id);
if (clone)
clone.parentNode.replaceChild(child, clone);
else
document.body.appendChild(child);
if (child.getAttribute(???selected???) == ???true??? || !targetPage)
targetPage = child;
--i;
}
}
if (targetPage)
iui.showPage(targetPage);
}
Loading an iUI Dialog
If the node that is passed into the main showPage() function is a dialog ( class=???dialog??? ), then the
showDialog () function is called, which in turn calls showForm() .
Pages:
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102