HTML and CSS Reference
In-Depth Information
<h:outputScript library="js" name="jscolor.js" />
<div id="#{cc.clientId}">
<input jsf:id="#{}" jsf:value="#{cc.attrs.value}" type="color"
<script type="text/javascript">
function html5_supports_input(type) {
var i = document.createElement("input");
i.setAttribute("type", type);
return i.type === type;
if (!html5_supports_input('color')) {
// The color input is not supported on the browser.
// Provide an alternative way of rendering the color picker,
// e.g. jscolor ( )
var componentId = '${cc.clientId}:${}'.replace(/:/g, "\\:");
new jscolor.color(document.getElementById('${cc.clientId}:${}'), {})
Figure 7-4. Fallback version of the inputColor component
rather than implementing your own htML5 feature detection algorithms, you can use a Javascript library
like Modernizr ( ) to detect the availability of native implementations of htML5 and Css3.
Search WWH ::

Custom Search