Open Bug 433643 Opened 16 years ago Updated 3 years ago

Javascript issue with <div> element with empty body

Categories

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

x86
Windows XP
defect

Tracking

()

People

(Reporter: abhurtun, Unassigned)

References

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9b5) Gecko/2008032620 Firefox/3.0b5
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9b5) Gecko/2008032620 Firefox/3.0b5

html>
   <body>
      <script type="text/javascript">
         var mouseDown = false;
         function mousedown(event)
         {
            mouseDown = true;
         }

         function mouseup(event)
         {
            mouseDown = false;
         }

         function mouseDrag(event)
         {
            if(mouseDown == false)
            {
               return;
            }

            document.getElementById("console").innerHTML =
                     "x: " + event.clientX + "y: " + event.clientY;
         }
      </script>

      <div style="border:1px solid black;background:black;width:500px;height:300px"
           onmousedown="mousedown(event)" onmousemove="mouseDrag(event)"
           onmouseup="mouseup(event)" onmouseout="mouseup(event)"></div>

      <br/><br/>
      <div id="console" style="border:1px solid;width:100px;height:100px">
      console
      </div>

   </body>

</html>



The above example listens for mouse drags and displays the x and y coordinates of the cursor in the div with id "console".
The first attempt at doing so works fine. If one tries to drag the mouse once again , you will not be allowed to do so. I have narrowed the problem down to the <div> element with id "area". The browser does not seem to like the fact that this <div> element is empty. If a space or carriage return or any character is inserted within this specific div, the javascript works fine.

The above code works fine in previous versions of firefox (i.e. 2.X)

Reproducible: Always

Steps to Reproduce:
1.
2.
3.
Actual Results:  
firefox fails to display x and y coordinates or cursor when dragging the cursor on a <div> element the second time in doing so
The second time it attempts to drag the div. Regression window is:
http://bonsai.mozilla.org/cvsquery.cgi?module=PhoenixTinderbox&date=explicit&mindate=2005-12-07+11%3A00&maxdate=2005-12-07+23%3A00
Could be caused by Bug 316281.
Blocks: 316281
Status: UNCONFIRMED → NEW
Component: Migration → Selection
Ever confirmed: true
Product: Firefox → Core
QA Contact: migration → selection
Version: unspecified → Trunk
Yeah, probably caused by Bug 316281.  Selection is tricky stuff.
Blocks: 573519

Bulk-downgrade of unassigned, >=3 years untouched DOM/Storage bug's priority.

If you have reason to believe this is wrong, please write a comment and ni :jstutte.

Severity: minor → S4
Priority: -- → P5
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: