[OT] Can't cancel .onmousemove in NN

C

Csaba2000

My comp.lang.javascript friends couldn't help me out on this one,
and you guys sometimes have insightful comments, so I hope you
don't mind if I run this by you:

If you click on or in a table and move the mouse, the default
action is that the "in between" text is supposed to get hilighted.

I can't seem to cancel this behaviour for NN 6.1. The code
below shows a way to do it for IE 5.5. This is not a major
issue, but I'd like to tidy up my code in this respect.

Thanks,
Csaba Gabor from New York

PS. Side notes: NN 6.1, in the code below, is nice enough to
note when there is a mouseup even when the mouse has
left the document area. IE loses track of the mouse status
once the mouse has exited the document area and won't
register the next mouseup even if the mouse returns over
the document (though it will start hilighting at this point).

On the other hand, IE does notify us that the mouse is
leaving the document area, whereas I haven't found a
way to do this with NN.

Opera doesn't like the document.on... constructs, but
when replaced with document.body.on... it will lose
track of the mouse when the mouse exits the body
area along certain paths (south, then west - no kidding).
It is also not cancelling the selection action.

PPS. I am allowing the user to resize a table by dragging
borders. That works in IE/NN. However, NN has this
behavioural artifact that I'd like to tidy up and that's the
motivation for the question.


<BODY style="border:solid 1px red">
Click anywhere on or within the table and drag.<br>
The text hilighting you normally see should not happen<br>
since the onmouseover event is being cancelled.<br>
<TABLE border onmousedown="dragMode(event)">
<TR>
<TD>foo</TD><TD>bar</TD>
<TR></TR>
<TD>baz</TD><TD>frob</TD>
</TR></TABLE>
<SCRIPT type="text/javascript">
function dragMode(evt) { // setup for dragging
var e = evt || window.event; // debugging
var myTarget = e.target || e.srcElement; // debugging
document.body.onmousemove = hilightCancel;
document.onmouseout = dragEndCheck;
document.onmouseup = function () {dragEnd("drag over: mouseup")};
window.status = "dragStart: " + myTarget.nodeName // debugging
}

function hilightCancel (evt) {
var e = evt || window.event; // debugging
var myTarget = e.target || e.srcElement; // debugging
// if (e.preventDefault) e.preventDefault(); // hasn't made a difference
window.status = "hilightCancel: " + myTarget.nodeName // debugging
return false; // should prevent hilighting
}

function dragEndCheck(evt) {
// needed cause IE forgets mouse status leaving the body/window
var e = evt || window.event;
var myTarget = e.target || e.srcElement;
var related = e.relatedTarget || e.toElement || e.fromElement;
var relatedName = (related&&related.nodeName)?related.nodeName:"none";

if (myTarget.nodeName!="BODY" || relatedName!="BODY") {return false;}
dragEnd ("drag over: " + myTarget.nodeName + " / " + relatedName)
}

function dragEnd(msg) {
document.body.onmousemove = null;
document.onmouseout = null;
document.onmouseup = null;
window.status = msg; // debugging
}
</SCRIPT>
</BODY>
 
R

rf

Csaba2000 said:
My comp.lang.javascript friends couldn't help me out on this one,
and you guys sometimes have insightful comments, so I hope you
don't mind if I run this by you:

If you click on or in a table and move the mouse, the default
action is that the "in between" text is supposed to get hilighted.

I can't seem to cancel this behaviour for NN 6.1. The code
below shows a way to do it for IE 5.5. This is not a major
issue, but I'd like to tidy up my code in this respect.

Why on earth would you want to do that [1], it's normal browser behaviour. I
would concentrate on your content rather than reel off pages of javascript
to cripple the browser in some way that is of no benifit whatsoever to your
viewer :)

[1] If you think you are protecting your content then you are not. There are
many many other ways to get to your content, the easiest being file>save
as>web page complete.

Cheers
Ricahrd.
 
C

Csaba2000

rf said:
....

Why on earth would you want to do that [1], it's normal browser behaviour. I
would concentrate on your content rather than reel off pages of javascript
to cripple the browser in some way that is of no benifit whatsoever to your
viewer :)

[1] If you think you are protecting your content then you are not. There are
many many other ways to get to your content, the easiest being file>save
as>web page complete.

From my original post:
PPS. I am allowing the user to resize a table by dragging
borders. That works in IE/NN. However, NN has this
behavioural artifact that I'd like to tidy up and that's the
motivation for the question.

There's no notion of protectionism here. Consider a vanilla
table (no resizing code) in IE (with borders). If you click on
a border and drag, you won't see any text selection [The point
of the example, with respect to IE is to show that cancelling
the event will also cancel text selection, as it is something
that is dependent on the event]. So actually, I am simply
trying to simulate in Netscape what the vast majority of
people already experience. You may, of course, disagree
with how Microsoft does this in the first place.

But just to reiterate, I am only interested in cancelling text
selection when resizing is going on. Having tested my
resizing code in both NN and IE, I find NN's text hilighting
during a resizing operation distracting. This resizing by
the way, is only initiated by someone clicking on a table
border. In conclusion, I would say that rather than crippling
the browser, I am enhancing the viewing experience by
allowing the user to customize his page to an even greater
extent.

Cheers, Csaba
 
H

Hywel Jenkins

rf said:
Csaba2000 said:
My comp.lang.javascript friends couldn't help me out on this one,
and you guys sometimes have insightful comments, so I hope you
don't mind if I run this by you:

If you click on or in a table and move the mouse, the default
action is that the "in between" text is supposed to get hilighted.

I can't seem to cancel this behaviour for NN 6.1. The code
below shows a way to do it for IE 5.5. This is not a major
issue, but I'd like to tidy up my code in this respect.

Why on earth would you want to do that [1], it's normal browser behaviour.

Perhaps he's building and application that requires drag and drop
features, so if the UA selects an object using the default action the
interface fails.

[1] If you think you are protecting your content then you are not.

He didn't even hint that he is trying to do that.
 
R

rf

Hywel Jenkins said:
"rf" <[email protected]> wrote in message
Why on earth would you want to do that [1], it's normal browser
behaviour.

Perhaps he's building and application that requires drag and drop
features, so if the UA selects an object using the default action the
interface fails.

Building such an application is fine, if it is for a captive audience.
Putting such an application out on the world wide internet is, at best,
fragile.
[1] If you think you are protecting your content then you are not.

He didn't even hint that he is trying to do that.

My bad I didn't read the entire post correctly.

Cheers
Richard.
 
C

Csaba2000

rf said:
Hywel Jenkins said:
"rf" <[email protected]> wrote in message
Why on earth would you want to do that [1], it's normal browser
behaviour.

Perhaps he's building and application that requires drag and drop
features, so if the UA selects an object using the default action the
interface fails.

Building such an application is fine, if it is for a captive audience.
Putting such an application out on the world wide internet is, at best,
fragile.

So let me see if I get this right. You are declaring that me implementing
a type of standard behaviour (and I hope we can agree that Excel exhibits
standard behaviour since, like it or not, it is a standard) on an area where
there is no standard behaviour (considering that text selection behaviour
in browsers where a table border is selected is not well defined) is fragile?
Doesn't NN get any declarative pronouncements for not properly
canceling the onmousemove event that I asked about? Perhaps you could
elaborate a bit on what you mean by this 'fragile' term.

Cheers,
Csaba

PS. I'm not ready yet for public demo as this bit is a secondary part
of my real goal, which I am still some months from.
[1] If you think you are protecting your content then you are not.

He didn't even hint that he is trying to do that.

My bad I didn't read the entire post correctly.

Cheers
Richard.
 
R

rf

Csaba2000 said:
So let me see if I get this right. You are declaring that me implementing
a type of standard behaviour (and I hope we can agree that Excel exhibits
standard behaviour since, like it or not, it is a standard) on an area where
there is no standard behaviour (considering that text selection behaviour
in browsers where a table border is selected is not well defined) is fragile?
Doesn't NN get any declarative pronouncements for not properly
canceling the onmousemove event that I asked about? Perhaps you could
elaborate a bit on what you mean by this 'fragile' term.

You have already come across the fragility. You have found a browser where
your system breaks. What happens when you test this in the other hundreds of
browsers out there.

Cheers
Richard.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,061
Latest member
KetonaraKeto

Latest Threads

Top