Annoying selection in IE8.

146 views
Skip to first unread message

Ross Snider

unread,
Oct 4, 2009, 8:58:13 PM10/4/09
to google-excanvas
I've implemented a cross-browser application. It does some things like
draw lines with the cursor.

Unfortunately IE8 doesn't want to play nice. When I click and drag
with my mouse to draw lines using excanvas, occasionally IE8 will stop
sending events and will highlight the things that have been drawn thus
far.

Has anyone else run into this behavior? If so, do you know any
workarounds?

If need be I can put up an example page.

Thanks,
Ross

Ross Snider

unread,
Oct 4, 2009, 9:04:35 PM10/4/09
to google-excanvas
I investigated more. IE8 highlights everything drawn with VML and
provides "web accelerators" for the selection.

Dean Edwards

unread,
Oct 4, 2009, 9:37:02 PM10/4/09
to google-...@googlegroups.com
On 05/10/2009 02:04, Ross Snider wrote:
>
> I investigated more. IE8 highlights everything drawn with VML and
> provides "web accelerators" for the selection.
>

Try setting "unselectable" to "on":

http://msdn.microsoft.com/en-us/library/ms534706(VS.85).aspx

You *must* use setAttribute() to set this property:

canvasElement.setAttribute("unselectable", "on");

I don't actually know if this will work with VML but it is worth a try.

Let us know if it works. :)

-dean

Dean Edwards

unread,
Oct 4, 2009, 9:44:26 PM10/4/09
to google-...@googlegroups.com
On 05/10/2009 02:37, Dean Edwards wrote:
> On 05/10/2009 02:04, Ross Snider wrote:
>>
>> I investigated more. IE8 highlights everything drawn with VML and
>> provides "web accelerators" for the selection.
>>
>
> Try setting "unselectable" to "on":
>
> http://msdn.microsoft.com/en-us/library/ms534706(VS.85).aspx
>
> You *must* use setAttribute() to set this property:
>
> canvasElement.setAttribute("unselectable", "on");

It seems that you can set it as a property also:

canvasElement.unselectable = "on";

-dean

Ross Snider

unread,
Oct 4, 2009, 9:58:57 PM10/4/09
to google-excanvas
Dean, thanks for the advice.

I have tried setting the elements in question unselectable (using both
methods you mentioned). This doesn't seem to stop IE from selecting/
highlighting all of the drawn VML and castrating its further calls to
the mousemove event handlers.

I've put up a small demonstration page.

http://mdrcdev.rit.edu/~rws1236/ie8vmlbug.htm

A person testing in IE8 will want to test in Gecko compatible browser
first for comparison.

Thank you for any help,
Ross Snider

Dean Edwards

unread,
Oct 4, 2009, 11:10:25 PM10/4/09
to google-...@googlegroups.com
On 05/10/2009 02:58, Ross Snider wrote:
>
> Dean, thanks for the advice.
>
> I have tried setting the elements in question unselectable (using both
> methods you mentioned). This doesn't seem to stop IE from selecting/
> highlighting all of the drawn VML and castrating its further calls to
> the mousemove event handlers.
>

OK. Here is the fix:

el.onselectstart=function(){return false;};

Change "mouseout" to "mouseleave". You are getting a mouseout event
every time you exit a VML element.

-dean

Ross Snider

unread,
Oct 4, 2009, 11:16:35 PM10/4/09
to google-excanvas
Brilliant. That worked.

Dean, thank you for spending your time working on my problem.

- Ross Snider
Reply all
Reply to author
Forward
0 new messages