Pretty sure it's again a unit problem, however this time I can't explain it... the html4.0 spec says tabindex is a number, so NS_IMPL_INT_ATTR should do the right thing. Findings for the record: <object id="obj" tabindex="2">Picture</object> var obj = document.getElementById("obj"); alert(obj.getAttribute("tabindex")); // Alerts "2" alert(obj.tabIndex); // Alerts "-1" obj.setAttribute("tabindex", 5); alert(obj.tabIndex); // Alerts "-1" obj.tabIndex = 10; alert(obj.tabIndex); // Alerts "10"
This is probably due to the lack of handling of tabindex in nsHTMLObjectElement::StringToAttribute(), see nsHTMLAnchorElement::StringToAttribute() for an example of how to make this work.
Jonas, I need your services again ;-)
Actually I have a question... StringToAttribute() is called by SetAttr(), however here it's GetAttr() that's not working, isn't it? nsHTMLAnchorElement doesn't have a AttributeToString() method. Strange.
Comment on attachment 67724 [details] [diff] [review] Proposed fix. r=sicking assuming you've tested this and it works.
If the attribute doesn't get parsed as an eHTMLUnit_Integer then GetTabIndex will fail, see http://lxr.mozilla.org/mozilla/source/content/html/content/src/nsGenericHTMLElem ent.h#738
Comment on attachment 67724 [details] [diff] [review] Proposed fix. There's default code that deals with converting integer attribute values into strings when GetAttr() is called, no need to duplicate that all over. Here GetAttr() is working, but we get back the wrong type of attribute, so .tabIndex can't convert the value into a integer. sr=jst, thanks for the fix!
as we have fix on hand, i am nominating for nsbeta1
I don't see this being worth nsbeta1+, but since there is a fix we should check it in. No need to wait for 1.0 even, go for it, anyone!