Game Development Reference
In-Depth Information
API usage
Now that we've discussed what all of the game elements are and how each HTML5
feature was used to fulfill that role, let's take a deeper look at how to make the most
out of each of these APIs. For each of the following APIs, we'll provide a more con-
crete definition of the feature, what its intended use is, and a code example will follow.
You may also refer to the complete source code attached at the end of the chapter in
order to fill the gap between the code sample and how that feature fits in with the rest
of the game code base. It is also recommended that you code along and play with
the various settings and values in order to experiment with and more fully understand
each API.
Web forms
The new HTML5 web forms API adds 13 new input types that allows for a much more
flexible and powerful experience. What's more, web forms are also able to validate
themselves requiring zero JavaScript intervention.
New input types
The following are the new input types defined in the new web forms chapter of the
HTML5 specification:
Date
The date input type allows the user to select a specific date from a browser-supplied
calendar. The specific format and styling of this calendar is unique to the browser and
platform used. The data that results from a date selection is of the form YYYY-MM-DD .
<input type="date"
min="1935-12-16"
max="2013-08-19"
/>
The optional attributes min and max can be used to force validation of the date se-
lected by the user to be within a given range. Other valid attributes for the date input
type include the following:
Search WWH ::




Custom Search