<script>
if (window.layoutTestController)
    layoutTestController.waitUntilDone();
    
var p1Focused = false;
var p2Focused = false;
var p3Focused = false;
var p4Focused = false;
var p5Focused = false;
var p6Focused = false;
var p7Focused = false;

function test(focusHappened, focusWasExpected, spanNum)
{
    var tabindexSpan = document.getElementById("sp"+spanNum);
    var resultSpan = document.createElement("span");
    if (focusHappened == focusWasExpected) {
        resultSpan.setAttribute("style","color:green");
        resultSpan.innerHTML = "PASSED";
    } else {
        resultSpan.setAttribute("style","color:red");
        resultSpan.innerHTML = "FAILED";
    }
    tabindexSpan.parentNode.insertBefore(resultSpan, tabindexSpan.parentNode.firstChild.nextSibling);
    tabindexSpan.innerHTML = ".tabIndex=" + tabindexSpan.parentNode.tabIndex + " getAttribute('tabindex')='" + tabindexSpan.parentNode.getAttribute('tabindex')+"'";
}

function autoTest()
{
    if (!window.layoutTestController)
        return;
    
    var allParagraphs = document.getElementsByTagName("p");
    for(var i=0; i < allParagraphs.length; ++i) {        
        eventSender.mouseMoveTo(allParagraphs[i].offsetLeft+5,allParagraphs[i].offsetTop+5);
        eventSender.mouseDown();
        eventSender.mouseUp();
    }
    layoutTestController.dumpAsText();
    layoutTestController.notifyDone();
}

</script>
    
<body onload="autoTest()">
From HTML5 spec:<blockquote>
    The tabindex attribute, if specified, must have a value that is a valid 
    integer. If the attribute is specified, it must be parsed using the rules 
    for parsing integers. If parsing the value returns an error, the attribute 
    is ignored for the purposes of focus management (as if it wasn't specified).    
</blockquote>

<p tabindex=" 10" onfocus="p1Focused=true" onclick="test(p1Focused,true,1)">This element should be focusable <br>
<span id="sp1">Click to test manually</span>
</p>
<p tabindex="one" onfocus="p2Focused=true" onclick="test(p2Focused,false,2)">This element shouldn't be focusable <br>
<span id="sp2">Click to test manually</span>
</p>
<p tabindex="007" onfocus="p3Focused=true" onclick="test(p3Focused,true,3)">This element should be focusable <br>
<span id="sp3">Click to test manually</span>
</p>
<p tabindex="1px" onfocus="p4Focused=true" onclick="test(p4Focused,false,4)">This element shouldn't be focusable <br>
<span id="sp4">Click to test manually</span>
</p>
<p tabindex="-0" onfocus="p5Focused=true" onclick="test(p5Focused,true,5)">This element should be focusable <br>
<span id="sp5">Click to test manually</span>
</p>
<p tabindex="" onfocus="p6Focused=true" onclick="test(p6Focused,false,6)">This element shouldn't be focusable <br>
<span id="sp6">Click to test manually</span>
</p>
<p tabindex="-004" onfocus="p7Focused=true" onclick="test(p7Focused,true,7)">This element should be focusable <br>
<span id="sp7">Click to test manually</span>
</p>
<pre id="result"></pre>
</body>
