[Laszlo-dev] For Review: Change 20090603-hqm-U Summary: fix for text selection in DHTML

Henry Minsky henry.minsky at gmail.com
Thu Jun 4 10:07:56 PDT 2009


On Thu, Jun 4, 2009 at 9:44 AM, P T Withington <ptw at pobox.com> wrote:

> I have a couple of comments:
>
> o Should we be browser-switching in getSelectedText, rather than probing
> for functions?  If we do probe for functions, are we doing it in the right
> order (which to me would be: 1) DOM2 Standard, 2) IE, 3) Firefox, 4) etc.
>
> o Similarly, should we use browser-switching to insert the appropriate
> browser-specific CSS, rather than just shoving them all in there?  I can
> imagine there might be a performance penalty for stray styles, or even a
> confusion if a browser tries to emulate another.


Yeah,  conditionalizing on browser type would be a  more deterministic
than probing for features. I guess it does seem a little too much
wishful-programming to think that
by seeing that some function is in the environment that things will
magically work in some unknown browser.


>
>
> o I'm confused as to why we have both Khtml- and Webkit- specific styles.
>  I thought Webkit was the new Khtml?  Is there still a Khtml browser that is
> not Webkit?
>

Hmm, I guess there probably aren't any KDE browsers out there that we need
to worry about.. (was it Konqueror? That's so 1998...)




> o Can you put a comment where you removed "// FIXME: [20090602 anba]",
> explaining what is being done, so future generations will not be mystified?
>  (e.g., "We have handled the event, so we stop propagation to outer divs,
> but, we still want the browser default action (e.g., select in an input
> text) to occur, so we _don't_ return false.")  Even better, to my mind,
> would be to use the actual DOM2 interface to the event and call
> `.stopPropagation()`, but not `.preventDefault()`.
>

Yeah, I have to  make sure I understand which bug cases that code was trying
to avoid when it cancelled the events entirely, and check that they are not
brought back to life by this change. Max suggested putting in a debug print
to see which event it is that we are cancelling that specifically is causing
text selection to break, whether it is the
mouse-down or maybe the mouse-moves, I should verify that for future
reference, and make a comment.


>
> On 2009-06-03, at 22:56EDT, Henry Minsky wrote:
>
>  Change 20090603-hqm-U by hqm at badtzmaru.home on 2009-06-03 22:27:28 EDT
>>   in /Users/hqm/openlaszlo/trunk5
>>   for http://svn.openlaszlo.org/openlaszlo/trunk
>>
>> Summary:  fix for text selection in DHTML
>>
>> New Features:
>>
>> Bugs Fixed: LPP-8200
>>
>> Technical Reviewer: max
>> QA Reviewer: andre
>> Doc Reviewer: (pending)
>>
>> Documentation:
>>
>> Release Notes:
>>
>> Details:
>>
>> +  LzSprite.js: only toggle the focus in focus_on_mouseover quirk when
>> there is some text selected.
>>
>> + LzKeyboardKernel.js: Instead of cancelling a mouse event completely,
>>  just cancel bubbling. This lets the div handle the event, and allows
>>  text selection to work, but should disable it from propagating to
>>  global handlers.
>>
>> + LzMouseKernel.js: don't cancel event with keyCode == 0 entirely, just
>> cancel bubbling.
>>
>> + LzTextSprite.js: use correct CSS properties for toggling selectability,
>> in Safari
>>
>> + LzInputTextSprite.js: do not bind the global document.onselectstart
>> handler, that prevents
>> text selection from working in some browsers
>>
>> + LzText.lzs: add the 'onselectable' event, not required for this
>> patch, but I noticed it was missing when writing a test case
>>
>> Tests:
>>
>> + added lpp-8200.lzx test, try selecting a region in each the text
>> fields, except for the last (non-selectable) one.
>>
>> + text selection should work in DHTML on selectable text or input text,
>> all
>> browsers
>>
>> + NOTE: there is a bug in IE7 text selection [maybe related to
>> (LPP-8249) "IE7 DHTML text letter spacing looks bad"], where in the
>> test case lpp-8200, if you try to drag the mouse to select the text in
>> the <text> view which says "This is selectable text", you cannot use
>> the mouse to select the last word ('text'). I think that maybe the
>> letter spacing setting causes the browser to miscalulate the text
>> width?
>>
>> Files:
>> A      test/lfc/lpp-8200.lzx
>> M      WEB-INF/lps/lfc/kernel/dhtml/LzKeyboardKernel.js
>> M      WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
>> M      WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js
>> M      WEB-INF/lps/lfc/kernel/dhtml/LzMouseKernel.js
>> M      WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js
>> M      WEB-INF/lps/lfc/views/LzText.lzs
>>
>> Changeset:
>> http://svn.openlaszlo.org/openlaszlo/patches/20090603-hqm-U.tar
>>
>
>


-- 
Henry Minsky
Software Architect
hminsky at laszlosystems.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.openlaszlo.org/pipermail/laszlo-dev/attachments/20090604/85de8fc1/attachment-0001.html


More information about the Laszlo-dev mailing list