HTML and CSS Reference
In-Depth Information
15.4.5 Feature Tests
The message list controller can only work correctly if it is run in an environment with
basic DOM support. Listing 15.62 shows the controller with its required feature
tests.
Listing 15.62 Feature tests for messageListController
(function () {
if (typeof tddjs == "undefined" ||
typeof document == "undefined"
||
!document.createElement) {
return;
}
var element = document.createElement("dl");
if (!element.appendChild ||
typeof element.innerHTML != "string") {
return;
}
element = null;
/* ... */
}());
15.4.6 Trying it Out
As the controller is now functional, we will update chapp to initialize it once the user
has entered his name. First, we need a few new dependencies. Copy the following
files from Chapter 13, Streaming Data with Ajax and Comet, into public/js :
json2.js
url params.js
ajax.js
request.js
poller.js
comet client.js
Also copy over the message _ list _ controller.js file, and finally add
script elements to the index.html below the previous includes in the order
listed above. Make sure the js/chat _ client.js file stays included last.
 
 
Search WWH ::




Custom Search