HTMLObjectElement.tabIndex returning -1

VERIFIED FIXED in mozilla1.0

Status

()

Core
DOM: Core & HTML
VERIFIED FIXED
17 years ago
9 years ago

People

(Reporter: Sivakiran Tummala, Assigned: jst)

Tracking

({testcase})

Trunk
mozilla1.0
testcase
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [HAVE FIX])

Attachments

(1 attachment)

(Reporter)

Description

17 years ago
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.2)
Gecko/20010726 Netscape6/6.1
BuildID:    2001-08-13-09-trunk

HTMLObjectElement.tabIndex returning -1 .attached a testcase to demonstrate the
problem..


Reproducible: Always
Steps to Reproduce:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body>
<object DATA="http://bubblegum/ngdriver/suites/res/mondrian8.jpg" usemap="#map1"
tabIndex="2">
This is a <em>picture</em> of the word Marvin with a border of 4.
</object>
<map name="map1">
<area shape="rect" alt="red" coords="0,0, 63,61"
href="http://bubblegum/ngdriver/suites/res/red.html">
</map>

<script TYPE="text/javascript">

var obj = document.getElementsByTagName("OBJECT").item(0);
document.write("<BR>" + obj.useMap + "<BR>");
document.write(obj.tabIndex);

</script>
</body>
</html>



Actual Results:  -1

Expected Results:  2
(Reporter)

Updated

16 years ago
Target Milestone: --- → mozilla0.9.8
(Assignee)

Comment 1

16 years ago
Futuring.
Target Milestone: mozilla0.9.8 → Future

Comment 2

16 years ago
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"
(Assignee)

Comment 3

16 years ago
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.

Comment 4

16 years ago
Created attachment 67724 [details] [diff] [review]
Proposed fix.

As usual, you were right :-)

Comment 5

16 years ago
Jonas, I need your services again ;-)
Whiteboard: [HAVE FIX]
Target Milestone: Future → mozilla1.0

Comment 6

16 years ago
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.
Attachment #67724 - Flags: review+
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
(Assignee)

Comment 9

16 years ago
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!
Attachment #67724 - Flags: superreview+
(Reporter)

Comment 10

16 years ago
as we have fix on hand, i am nominating for nsbeta1
Keywords: nsbeta1
(Reporter)

Updated

16 years ago
Keywords: testcase
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!
Keywords: nsbeta1 → nsbeta1-
(Assignee)

Comment 12

16 years ago
Fixed.
Status: NEW → RESOLVED
Last Resolved: 16 years ago
Hardware: PC → All
Resolution: --- → FIXED
(Reporter)

Comment 13

16 years ago
marking verified
Status: RESOLVED → VERIFIED

Updated

9 years ago
Component: DOM: HTML → DOM: Core & HTML
QA Contact: stummala → general
You need to log in before you can comment on or make changes to this bug.