Closed Bug 359393 Opened 18 years ago Closed 18 years ago

Wrong target reported for the scroll event

Categories

(Core :: DOM: UI Events & Focus Handling, defect)

1.8 Branch
x86
Windows XP
defect
Not set
normal

Tracking

()

VERIFIED FIXED

People

(Reporter: Max.Starets, Assigned: roc)

References

Details

(Keywords: regression, testcase, verified1.8.1.2)

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0

The document object is reported as the event.target for the scroll event instead of the DIV that fired the event. This is a regression in the Gecko/20061010 Firefox/2.0 build. Previous 1.8-based builds reported DIV as the target

Reproducible: Always

Steps to Reproduce:
Code to reproduce (scroll to see the alert popup):

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> 
<html>

<body>

<div id="parentDIV" style="position:relative;width:300px;height:300px;overflow:auto">
  <div style="position:relative;width:600px;height:600px">
  </div>
</div>

</body>
<script>
function handleScroll(evt)
{
  alert(evt.target);
}
var div = document.getElementById("parentDIV");
div.addEventListener("scroll", handleScroll, false);
</script>
</html>

Actual Results:  
Alert displays "Object HTMLDocument"

Expected Results:  
Alert should display "Object HTMLDivElement"
Keywords: regression
Version: Trunk → 1.8 Branch
Attached file testcase
This regressed on the 1.8 branch between 2006-03-26 and 2006-03-28:
http://bonsai.mozilla.org/cvsquery.cgi?treeid=default&module=all&branch=MOZILLA_1_8_BRANCH&branchtype=match&dir=&file=&filetype=match&who=&whotype=match&sortby=Date&hours=2&date=explicit&mindate=2006-03-26+05&maxdate=2006-03-28+06&cvsroot=%2Fcvsroot
I think a regression from bug 305160, somehow.
No idea why that patch would not regress on trunk, but does regress on branch.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: blocking1.8.1.1?
Keywords: testcase
Flags: in-testsuite?
(In reply to comment #2)
> No idea why that patch would not regress on trunk, but does regress on branch.
> 

Because of bug 234455 ;)
Should we fix this on the 1.8.1 branch?
I don't know, I just nominated it because it's a regression from the 1.8.0.x branch.
OK, so I wonder whether we should fix it.
(In reply to comment #6)
> OK, so I wonder whether we should fix it.
>

I've just found this error in my application. I think you should fix it ;).

Wes Gamble

Not blocking a specific branch release, but we definitely want to fix it on the branch, so moving flag to "wanted", and would be happy to see a reviewed, safe, patch!
Flags: wanted1.8.1.x+
Flags: blocking1.8.1.1?
Flags: blocking1.8.1.1-
*** Bug 362818 has been marked as a duplicate of this bug. ***
Attached patch fixSplinter Review
For the case where we're dispatching to content, it's OK to use nsIPresShell::HandleEventWithTarget like we did before. And in fact we need to, otherwise no particular target it set and it falls back to the document.
Assignee: events → roc
Status: NEW → ASSIGNED
Attachment #247765 - Flags: superreview?(mats.palmgren)
Attachment #247765 - Flags: review?
Attachment #247765 - Flags: review? → review?(Olli.Pettay)
Comment on attachment 247765 [details] [diff] [review]
fix

Looks good to me. sr=mats
Attachment #247765 - Flags: superreview?(mats.palmgren) → superreview+
Attachment #247765 - Flags: review?(Olli.Pettay) → review+
Comment on attachment 247765 [details] [diff] [review]
fix

Need branch approval. This can't bake on trunk because it's a branch-only patch.
Attachment #247765 - Flags: approval1.8.1.2?
Attachment #247765 - Flags: approval1.8.0.10?
If this is a regression on the 1.8 branch (possibly from bug 305160) then why is there a 1.8.0 approval request also? Is that a mistake, or is this not a regression?
Blocks: 305160
Comment on attachment 247765 [details] [diff] [review]
fix

That was an error, sorry
Attachment #247765 - Flags: approval1.8.0.10?
Comment on attachment 247765 [details] [diff] [review]
fix

Approved for 1.8 branch, a=jay for drivers.
Attachment #247765 - Flags: approval1.8.1.2? → approval1.8.1.2+
Fixed in 1.8.1.2
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Keywords: fixed1.8.1.2
Resolution: --- → FIXED
Verified using testcase in comment #1: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.2pre) Gecko/20070116 BonEcho/2.0.0.2pre
Status: RESOLVED → VERIFIED
Component: Event Handling → User events and focus handling
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: