HTML and CSS Reference
In-Depth Information
formController
and
getElementsByTagName
. Listing 15.79 shows the fea-
ture tests.
Listing 15.79
Feature testing
messageFormController
if (typeof tddjs == "undefined"
||
typeof document == "undefined") {
return;
}
var chat = tddjs.namespace("chat");
if (!chat.formController
||
!document.getElementsByTagName) {
return;
}
/* ... */
As all the controllers are complete, we can now piece together the entire chat client
and take it for a real spin. Listing 15.80 adds the message form to the HTML
document.
Listing 15.80
Adding the message form to
index.html
<!-- ... -->
<dl id="messages"></dl>
<form id="messageForm">
<fieldset>
<input type="text" name="message" id="message"
autocomplete="off">
</fieldset>
</form>
<!-- ... -->
Copy over
message
_
form
_
controller.js
along with
form
_
controller.js
and the updated
user
_
form
_
controller.js
and
add
script
elements to
index.html
to include them. Then update the boot-
strap script, as seen in Listing 15.81.