I am working on a hack to detect if a browser is able to deal with HTML5 new tag. I wrote this code:
- Code: Select all
- var element=document.createElement('section');
 document.body.appendChild(element);
 if (typeof element !='undefined'&& element instanceof HTMLElement && element.hasChildNodes()){
 
 $("#result6").html('OK');
 }
 else
 {
 $("#result6").html('KO');
but it returns a wrong result with browser like chrome. The problem is that the element.hasChildNodes() retruns false. In the HTML5 specification they said that section tag must have at least 1 child node.
Does any one have an idea how to detect their support in a browser?
Thank you all


