[jQuery] Re: How to keep text from being highlighted when I'm handling the mouse events
We recently dealt with the same problem with IE on the Fluid project. We fixed it by trapping both the ondrag and onselectstart events. Note: these events only need to be trapped in IE and they are not jQuery events so you need to cast the object to a browser DOM object before trapping. Here is our code. Note that domNode is a jQuery object that was set up in an earlier function and get(0) is what casts it to a browser DOM object. if (jQuery.browser.msie) { domNode.get(0).ondrag = function () { return false; }; domNode.get(0).onselectstart = function () { return false; }; } - Eli Cochran user interaction developer ETS, UC Berkeley On Feb 20, 5:23 pm, timothytoe [EMAIL PROTECTED] wrote: Thanks. I got it to work with 2 preventDefaults (the one for IE and the one for the other browsers), but I've not tried IE6 yet, so I may yet need to have your tricks up my sleeve. Thanks. I'll get back here with a final listing of code once I'm sure I'm working on all the A- grade jQuery-supported browsers. On Feb 20, 12:07 pm, Josh Nathanson [EMAIL PROTECTED] wrote: I believe the one for IE is stopPropagation() or something like that. Also, did you try putting return false after all the other code for your mousemove? I seem to recall that helped me in a similar situation. $(#actionSurface).mousemove(function(e){ ... save off current x and y ... ... move shit around return false; --- add this }); -- Josh - Original Message - From: timothytoe [EMAIL PROTECTED] To: jQuery (English) jquery-en@googlegroups.com Sent: Wednesday, February 20, 2008 11:48 AM Subject: [jQuery] Re: How to keep text from being highlighted when I'm handling the mouse events Yeah, so surprise. Doesn't work on IE. Anyone have any ideas for that browser?
[jQuery] Re: Is there a .new() ?
Hi folks, I was mulling over both those two DOM instantiation patterns just this week. Has anyone actually run that test? I'm curious what the numbers were. There is this delightful feel of control and power in $(input type='hidden'/).attr({id:myid, name:myname}).val(foo).appendTo(this); but $(this).append(input type='hidden' name='myname' id='myid' value='foo' /); *seems* more efficient (no chaining). My code has a few of these and I opted for the latter, not only because my brain said less cycles but also because, for me, it proved easier just to write out the markup as markup and then plug that into the JS. Make sense? - Eli On Jan 26, 7:17 am, Karl Swedberg [EMAIL PROTECTED] wrote: On Jan 25, 2008, at 10:13 PM, David Serduke wrote: How about $(input type='hidden'/).attr({id:myid, name:myname}).val(foo).appendTo(this); I think that would work although the way you have it would be faster. Most elements you could just say $(div/) to create a new one but in IE the input requires the type be set. So you have to specify the type in the inital jQuery call as shown above. Hey David, Very interesting that the way you mention above is not as fast as putting in the whole HTML string at once. In our books, Jonathan Chaffer and I chose to build new elements the slower way -- with .attr({}) -- to make the code more readable and to keep it closer to the DOM Scripting ideal, but I hadn't tested comparative speeds, assuming that there wouldn't be much of a performance hit. --Karl _ Karl Swedbergwww.englishrules.comwww.learningjquery.com