[Laszlo-dev] For Review: Change 20090603-hqm-U Summary: fix for text selection in DHTML
André Bargull
andre.bargull at udo.edu
Sat Jun 6 11:24:10 PDT 2009
Maybe it works to cancel selection if it starts on a non-selectable element.
> // prevent text selection in IE
> // can't use lz.embed.attachEventHandler because we need to cancel events
> if (LzSprite.prototype.quirks.ie_prevent_selection) {
> document.onselectstart = function () {
> var src = window.event.srcElement;
> if (src.owner instanceof LzTextSprite) {
> if (! src.owner.selectable) {
> // Debug.write("prevent selection on non-selectable text")
> return false;
> }
> } else {
> // Debug.write("prevent selection on non-text")
> return false;
> }
> }
> }
On 6/6/2009 6:27 PM, Henry Minsky wrote:
>
>
> And one bug in IE:
> Also open the component sampler, mouse down and then move cursor
> while still holding the mouse button.
> Expected: no text selection
> Actual: text selection for all text elements
> Apparently global onselectstart and ondrag were canceled in
> "LzInputTextSprite.js" to avoid this behaviour, cf. [3].
>
>
> But having that code in LzInputTextSprite:
>
> document.onselectstart = LzTextSprite.prototype.__cancelhandler;
> document.ondrag = LzTextSprite.prototype.__cancelhandler;
>
> causes text selection to stop working in globally in IE7, and Safari/OSX.
>
> (Actually, inputtext selection still works in Safari for some reason
> with this code, but
> regular selectable non-input text cannot be selected )
>
> Do you have any ideas how we can keep text selection working in
> IE7/Safari but
> not have the unwanted selection of everything?
>
More information about the Laszlo-dev
mailing list