Closed
Bug 358601
Opened 19 years ago
Closed 18 years ago
problem document.onmousemove event with clientX & clientY
Categories
(Firefox :: General, defect)
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: hagayg, Unassigned)
References
Details
(Keywords: regression)
Attachments
(2 files)
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0
clientY & clientX propeties for the document.onmousemove event always returns 0
(works just fine with firefox 1.5.0.7)
use the following HTML to reproduce :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Untitled Page</title>
</head>
<body>
<div id="dvOutput" style="background-color:Aqua;position:absolute;left:200px;top:350px;width:100px;height:100px;"></div>
<script type="text/javascript">
var ieForDrag = document.all
var nsForDrag = document.getElementById && !ieForDrag
function DragDivByClassName(e)
{
var fobj = nsForDrag ? e.target : event.srcElement;
var containerObject = fobj;
var ev=e||event;
var offsetx=ev.clientX-containerObject.offsetLeft;
var offsety=ev.clientY-containerObject.offsetTop;
document.onmousemove=function()
{
if (containerObject.style.left == "")
containerObject.style.right=(document.documentElement.clientWidth-containerObject.clientWidth-(ev.clientX-offsetx))+"px";
else
containerObject.style.left=(ev.clientX-offsetx)+"px";
containerObject.style.top=(ev.clientY-offsety)+"px";
document.getElementById("dvOutput").innerHTML = "left: " + containerObject.style.left + ",top:" + containerObject.style.top + "<br>" + ev.clientY +"-"+offsety+"<br>target:"+ev.target;
return false;
}
fobj.onmouseup=function()
{
document.onmousemove=null;
}
}
document.onmousedown=DragDivByClassName;
</script>
</body>
</html>
Reproducible: Always
Steps to Reproduce:
1.get the attached html code
2.load it in firefox 2.0
3.try to drag the div box and notice it always returns 0 for clientX & clientY
4.check in firefox 1.5.0.7 to see how it working perfectly
Actual Results:
div cant be drag well
Expected Results:
div can be drag
Comment 1•18 years ago
|
||
Reporter, do you still see this problem with the latest Firefox 2? If not, can you please close this bug as WORKSFORME. Thanks!
Whiteboard: CLOSEME 07/14
Version: unspecified → 2.0 Branch
Yes , this problem still exists in firefox 2.0.4 (and it really easy to check it...)
Comment 3•18 years ago
|
||
I'm sure it is easy to check it, but I'm reading 100s of bugs at the moment and not using 2.0.0.x to do it.
Please try testing with a trunk build
- http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-trunk/
as it seems to work for me on trunk. If you also find it works on a trunk build, please resolve this bug as WORKSFORME. Thanks!
Sorry , but i dont care from the trunk build , I am trying to support your product in my software , it worked fine with version 1.5 , then you came out with version 2.0 and it doesnt , now it takes you about 7 month to tell me that it should work in version 3 ?
I'll tag it as work for me when it will be fixed in 2.x ...
Comment 5•18 years ago
|
||
Well if it was fixed on the trunk by a large patch, then the chances of getting it backported to the 2.0 branch are minimal. It would also help if you used the 'Add an attachment' link to attach a minimal testcase.
Keywords: regression
Comment 6•18 years ago
|
||
(In reply to comment #5)
> Well if it was fixed on the trunk by a large patch, then the chances of getting
> it backported to the 2.0 branch are minimal. It would also help if you used the
> 'Add an attachment' link to attach a minimal testcase.
Just tested it with http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-trunk/firefox-3.0a9pre.en-US.win32.installer.exe
created on 2007-10-30 and IT DOES NOT WORK (the div cant be dragged like it was in 1.5 or on IE version 6 & 7)
Please some one fix it....
Comment 8•18 years ago
|
||
FWIW the testcase doesn't work on Opera 9.24 either..
(In reply to comment #8)
> FWIW the testcase doesn't work on Opera 9.24 either..
I dont understand the comments here , a certain code worked on version 1.5 and stopped working on 2.x , you being saying to test it under 3 cause it seem to work there , after i test it in 3.0 and see it doesnt work all you can say it doesnt work in other software too ?
did it work in opera 8 ? opera 7 ? your info is worthless...
Comment 10•18 years ago
|
||
We don't know why it stopped working in 2.0 - It could be that your testcase relies on strange or buggy behaviour to work - behaviour which is present in IE, was present in Fx1.5 but got fixed for Fx2, and has never been present in Opera.
Anyway I will see if anyone can look at the reason behind this regression.
Whiteboard: CLOSEME 07/14
Version: 2.0 Branch → Trunk
Comment 11•18 years ago
|
||
For Trunk
=========
Testcase works:
- Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9a1) Gecko/20060307 Firefox/1.6a1 ID:2006030704 [cairo]
Testcase doesn't work:
- Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9a1) Gecko/20060308 Firefox/1.6a1 ID:2006030807 [cairo]
Checkins to module PhoenixTinderbox between 2006-03-07 03:00 and 2006-03-08 08:00 :
http://bonsai.mozilla.org/cvsquery.cgi?treeid=default&module=PhoenixTinderbox&branch=HEAD&branchtype=match&dir=&file=&filetype=match&who=&whotype=match&sortby=Date&hours=2&date=explicit&mindate=2006-03-07+03&maxdate=2006-03-08+08&cvsroot=%2Fcvsroot
For Branch
==========
Testcase Works:
- Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.1a3) Gecko/20060612 BonEcho/2.0a3 ID:2006061204
Testcase Broken:
- Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.1a3) Gecko/20060613 BonEcho/2.0a3 ID:2006061303
Checkins to module PhoenixTinderbox on branch MOZILLA_1_8_BRANCH between 2006-06-12 03:00 and 2006-06-13 04:00 :
http://bonsai.mozilla.org/cvsquery.cgi?treeid=default&module=PhoenixTinderbox&branch=MOZILLA_1_8_BRANCH&branchtype=match&dir=&file=&filetype=match&who=&whotype=match&sortby=Date&hours=2&date=explicit&mindate=2006-06-12+03&maxdate=2006-06-13+04&cvsroot=%2Fcvsroot
I can't see any bug that is common between the two ranges.
Comment 12•18 years ago
|
||
The testcase is very strange. Using mousedown event in mousemove event handler when the dispatching of mousedown has already stopped.
(Note, |ev| is bound to the event which DragDivByClassName gets, so it is the
mousedown event)
The summary of this bug is wrong, and this is invalid bug unless summary is
changed. document.onmousemove works fine and if you use the right event you get
the coordinates.
The change that has happened is that after the event has been dispatched, you can't rely on any coordinate information taken from it, or that coordinates are
0. That is something I could fix.
(Btw, the testcase crashes on my 1.5.0.x builds.)
Comment 13•18 years ago
|
||
I think this is now WONTFIX. We don't want the strange 1.8.0.x behavior back and
the testcase can be easily modified to handle mouseevents properly.
And as I said, there hasn't been any problem with document.onmousemove event,
the problem was how event coordinates are cached.
Status: UNCONFIRMED → RESOLVED
Closed: 18 years ago
Resolution: --- → WONTFIX
Reporter | ||
Comment 14•18 years ago
|
||
(In reply to comment #13)
> I think this is now WONTFIX. We don't want the strange 1.8.0.x behavior back
> and
> the testcase can be easily modified to handle mouseevents properly.
> And as I said, there hasn't been any problem with document.onmousemove event,
> the problem was how event coordinates are cached.
I am not a javascript nor firefox expert , if it can be fixed easilly, please show me an example of how to change it , if you can...
Comment 15•18 years ago
|
||
Use the mousemove event in mousemove event handler. Don't use the mousedown event there. That should bring the functionality you want:
document.onmousemove=function(mousemovee)
{
var mousemoveevent = mousemovee || event;
if (containerObject.style.left == "")
containerObject.style.right=(document.documentElement.clientWidth-containerObject.clientWidth-(mousemoveevent.clientX-offsetx))+"px";
else
containerObject.style.left=(mousemoveevent.clientX-offsetx)+"px";
containerObject.style.top=(mousemoveevent.clientY-offsety)+"px";
document.getElementById("dvOutput").innerHTML = "left: " +
containerObject.style.left + ",top:" + containerObject.style.top + "<br>" +
mousemoveevent.clientY +"-"+offsety+"<br>target:"+mousemoveevent.target;
return false;
}
Comment 16•18 years ago
|
||
Reporter | ||
Comment 17•18 years ago
|
||
(In reply to comment #16)
> Created an attachment (id=288464) [details]
> modified testcase
Thank you very much , i got it working now....
You need to log in
before you can comment on or make changes to this bug.
Description
•