Closed
Bug 12849
Opened 25 years ago
Closed 25 years ago
[blocker]GFX Select: event.target is an option, not the <select> element
Categories
(Core :: XUL, defect, P3)
Core
XUL
Tracking
()
VERIFIED
FIXED
M10
People
(Reporter: alecf, Assigned: pollmann)
References
Details
Attachments
(2 files)
Got another one for ya rod.... with the new GFX combo boxes that went in a few days ago, the event.target of a select is now the option child rather than the select widget itself. When I switch back to native widgets, the event target is back to being the the select element. This is majorly confusing the search dialog (again) because it expects event.target to be the select widget. I couldn't find a spec for this, but I would imagine that since the onselect= event handler is on the select and not the option, that the select should be the event target.
Reporter | ||
Comment 1•25 years ago
|
||
here's a good test: <html:select onclick="selectClicked(event);"> <html:option>opt1</html:option> <html:option>opt2</html:option> <html:option>opt3</html:option> </html:select> and then the JS code looks like function selectClicked(event) { dump("The target is " + event.target + "\n"); } With GFX widgets, you'll see: The target is [HTMLOptionElement] with native widgets, you'll see: The target is [HTMLSelectElement]
Comment 2•25 years ago
|
||
Updated•25 years ago
|
Assignee: rods → joki
Severity: major → blocker
Summary: GFX Select: event.target is an option, not the <select> element → [blocker]GFX Select: event.target is an option, not the <select> element
Target Milestone: M10
Comment 3•25 years ago
|
||
This is a blocker for turning on GFX selects. Tom, I think this would be your bug. I can't see at the moment what I would/could do differently in the select code to change the target of the event when the option gets selected so the target is the select instead of the option for the :onselect: JS event. I am adding Eric P. and Kevin to the cc list.
Comment 4•25 years ago
|
||
Forgot to add myself to the cc list.
Updated•25 years ago
|
Assignee: joki → rods
Comment 5•25 years ago
|
||
Actually I'd say its yours for the same reasons. The basic issue, though, is that we now have multiple frames where we used to have just one. So we used to hit the SELECT frame and go no deeper. Now we dig all the way down to the text frames. The gfx SELECT implementation is going to have to hide the existence of those frames if it doesn't want the DOM to expose them via events. I'll help with this but its not mine. As far as proper behavior, yes there is no spec for this per se. Nav4 couldn't go down this deep, IE does what we did with native widgets which is just give back the SELECT. I'd vote for just the SELECT since usually the reason you'd want to know about the particular OPTION that was hit and pretty much that info can be gotten after the onchange event.
Reporter | ||
Comment 6•25 years ago
|
||
yes, I would say we need to be at least consistent with nav4...
Reporter | ||
Comment 7•25 years ago
|
||
just discovered Nav4 doesn't have onclick/onselect (at least on linux) so I guess consistency with IE is best..
Comment 8•25 years ago
|
||
Tom and I talked about this and we think that it should return the option element instead of the select element. The select can be easily gotten from the event.target which is the parent of the returned option element. Also, it might be helpful to get the option back, after all that was the DOM element that was selected. I have a fix to check in.
Reporter | ||
Comment 9•25 years ago
|
||
I really have to STRONGLY disagree on this one, for two major reasons: 1) the onclick= handler is put on the <select> element. why would event.target return the option element? 2) most importantly - we are just making web developer's lives difficult if we are intentionally different from IE when we could easily be the same. You may not realize how difficult it already is to write cross-browser web applications, but there's no reason to add one more gotcha. But you said you had a fix....is the fix to return the select element or the option element?
Reporter | ||
Comment 10•25 years ago
|
||
As it turns out, onchange= is the HTML4 sanctioned event that we should be talking about. Nav4 has onchange= and it returns the select element, as it has since Nav2. we'd even be inconsistent with Nav2-4 if we changed this.
Comment 11•25 years ago
|
||
I initially was thinking about IE compatibility but I've changed my mind. Our goal is to make web developers lives easier by giving them standards support, not by cloning IE. Although the spec doesn't say anything about this specific case, in general when you click on an element in a container you get the lowest element, which in this case is the option. Trust me, IE5 has such bad DOM support in general that we're not going to be anywhere near compatible with them anyway.
Comment 12•25 years ago
|
||
The onselect event is a separate issue. The test case here talks about click events which didn't work on these elements in Nav4. This code would not change the behavior of the onchange event. The targetting of the onchange event isn't mouse driven and happens through an entirely different mechanism.
Reporter | ||
Comment 13•25 years ago
|
||
oh, ok, then this bug should be for the onchange= handler, because that is the one that is busted. I have no idea how the onclick handler works, but choosing the option makes sense. Sorry I wasn't explicit in my original bug report (whoops!) Should I file a seperate bug or clarify the summary of this bug?
Comment 14•25 years ago
|
||
adding to 12902, gfx widgets tracker
Comment 15•25 years ago
|
||
Ok, so forget about onselect. Summary: onchange for selects should have the select as the target onclick for selects is going to have the option as the target onclick for the option would (of coarse) of the option as the target If the above is true, and the onchange happens outside of event processing then this is an Eric Pollmann bug?
Reporter | ||
Comment 16•25 years ago
|
||
that all sounds like the correct behavior to me! Now the question is, what ACTUALLY happens in these three cases?
Updated•25 years ago
|
Assignee: rods → pollmann
Comment 17•25 years ago
|
||
onchange for selects return option as the target this WRONG onclick for selects returns the option as the target CORRECT onclick for the option returns the option as the target CORRECT Reassigning to Eric
Comment 18•25 years ago
|
||
Assignee | ||
Updated•25 years ago
|
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 19•25 years ago
|
||
Checked in a fix.
Comment 20•25 years ago
|
||
verified fixed on 1999-09-13-08-M10 RedHat Linux 6.0 (GNOME/enlightenment) 1999-09-13-08-M10 WinNT 4.0 sp5
You need to log in
before you can comment on or make changes to this bug.
Description
•