Open Bug 289165 Opened 20 years ago Updated 2 years ago

onmouseout() generates onmouseover() when onmouseover() is not set

Categories

(Core :: DOM: Events, defect, P5)

1.7 Branch
x86
Windows 2000
defect

Tracking

()

UNCONFIRMED

People

(Reporter: s_milberg, Unassigned)

Details

(Keywords: testcase)

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.6) Gecko/20050317 Firefox/1.0.2
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.6) Gecko/20050317 Firefox/1.0.2

When a cursor enters an element that has an onmouseout() event associated with
it but does not have an onmouseover() event associated with it, Firefox fires
the onmouseout() event with event.relatedTarget unset.  onmouseout() works as
expected upon exiting the element.

Below is some HTML code that illustrates the problem:

<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01//EN'
'http://www.w3.org/TR/html4/strict.dtd'>
<html>
<head>
  <title>Test</title>
</head>
<body id='body'>

<div id='container'
     style='background-color: #CCC; width: 200px;
            height: 200px; padding: 10px'>id: container

  <div id='test_div'
       style='background-color: #DDD; border: solid; border-width: 1px;
              position: fixed; padding: 10px'
       onmouseout='event_h(event)'>id: test_div</div>

</div>

<script language='javascript' type='text/javascript'>

  function event_h(e)
  {
    if(typeof(e) != 'undefined')
    {
        if (e.relatedTarget)
        {
          alert('event.type: ' + e.type + '\n'
                + 'event.relatedTarget.id: ' +  e.relatedTarget.id + '\n'
                + 'event.target.id: ' + e.target.id);
        }
    	  else
        {
          alert('event.type: ' + e.type +  '\n'
                + 'event.relatedTarget.id: ' +  'undefined' + '\n'
                + 'event.target.id: ' + e.target.id);
  } } }
</script>
</body>
</html>

Reproducible: Always

Steps to Reproduce:
1.Create a div element with an onmouseout event, but not an onmouseover event
2.Have the cursor enter the aforementionned element
3.Onmouseout is then fired, without setting relatedTarget
4.The code included in the details reproduces this error

Actual Results:  
onmouseout() fired 

Expected Results:  
nothing should happen
Keywords: testcase
Move the mouse over the border of the textarea.
Observed result: 3 events are fired when the mouse moves into or out of the
textarea.
Expected result: 1 event would be expected when the mouse moves into or out of
the textarea.
I entered another testcase as attachment to this bug but i'm not sure if it is
the same bug or a new one. When the mouse is moved over the border of a textarea
or input, an onmouseover event is fired. Then when the mouse moves from the
border to the "content" of the textarea/input, an onmouseout and an onmouseover
are fired.

Firefox 1.0.3 on WinXP SP2
Testcase from attachment 179730 [details] WFM with Mozilla/5.0 (Windows; U; Windows NT
5.1; en-US; rv:1.8b5) Gecko/20051015 Firefox/1.4.1

Reporter, can you still reproduce the problem with Firefox 1.5 beta?
Assignee: firefox → events
Component: General → DOM: Events
Product: Firefox → Core
QA Contact: general → ian
Version: unspecified → 1.7 Branch
Assignee: events → nobody
QA Contact: ian → events
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046

Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: