[Laszlo-checkins] r13310 - openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml

bargull@openlaszlo.org bargull at openlaszlo.org
Mon Mar 16 13:57:17 PDT 2009


Author: bargull
Date: 2009-03-16 13:57:15 -0700 (Mon, 16 Mar 2009)
New Revision: 13310

Modified:
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
Log:
Change 20090304-bargull-D5b by bargull at dell--p4--2-53 on 2009-03-04 14:30:47
    in /home/Admin/src/svn/openlaszlo/trunk
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: inputtext loses focus in dhtml

New Features:

Bugs Fixed: LPP-7796 (Tab does not navigate between inputtext and edittext component in DHTML)

Technical Reviewer: max
QA Reviewer: mdemmon
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details:
The relatedTarget of the mouseout-event may point to anonymous div of the input-element in Firefox. This is a Firefox specific bug reported at https://bugzilla.mozilla.org/show_bug.cgi?id=208427.
To workaround this issue, I've added a new quirk "inputtext_anonymous_div" for Firefox. If the quirk is enabled, check "parentNode" of the relatedTarget which will cause a security exception if we got the anonymous div (we can't really do anything else here!). 

    

Tests:
testcases at bugreport



Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js	2009-03-16 20:53:58 UTC (rev 13309)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js	2009-03-16 20:57:15 UTC (rev 13310)
@@ -102,11 +102,23 @@
                 } else {
                     var el = e.relatedTarget;
                 }
+                var quirks = LzSprite.prototype.quirks;
+                if (quirks.inputtext_anonymous_div) {
+                    try {
+                        // Only try to access parentNode to workaround a Firefox bug,
+                        // where relatedTarget may point to an anonymous div of an
+                        // input-element (in which case accessing parentNode throws
+                        // a security exception). (LPP-7796)
+                        el && el.parentNode;
+                    } catch (e) {
+                        return;
+                    }
+                }
                 if (el && el.owner && el.className.indexOf('lz') == 0) {
-                    if (LzSprite.prototype.quirks.fix_ie_clickable) {
+                    if (quirks.fix_ie_clickable) {
                         LzInputTextSprite.prototype.__setglobalclickable(true);
                     }
-                    if (LzSprite.prototype.quirks.focus_on_mouseover) {
+                    if (quirks.focus_on_mouseover) {
                         if (LzInputTextSprite.prototype.__lastshown == null) div.focus();
                     }
                     LzKeyboardKernel.setKeyboardControl(true);
@@ -114,7 +126,7 @@
                     LzMouseKernel.__resetMouse();
                     this.mouseisover = true;
                 } else {
-                    if (LzSprite.prototype.quirks.focus_on_mouseover) {
+                    if (quirks.focus_on_mouseover) {
                         if (LzInputTextSprite.prototype.__lastshown == null) div.blur();
                     }
                     LzKeyboardKernel.setKeyboardControl(false);
@@ -369,6 +381,7 @@
     ,inputtext_strips_newlines: false
     ,swf8_contextmenu: true
     ,dom_breaks_focus: false
+    ,inputtext_anonymous_div: false
 }
 
 LzSprite.prototype.capabilities = {
@@ -529,7 +542,11 @@
             quirks['textdeco_on_textdiv'] = true;
         } else if (browser.isFirefox) {
             // DOM operations on blurring element break focus (LPP-7786)
+            // https://bugzilla.mozilla.org/show_bug.cgi?id=481468
             quirks['dom_breaks_focus'] = true;
+            // anonymous div bug on input-elements (LPP-7796)
+            // see https://bugzilla.mozilla.org/show_bug.cgi?id=208427
+            quirks['inputtext_anonymous_div'] = true;
             if (browser.version < 2) {
                 // see http://groups.google.ca/group/netscape.public.mozilla.dom/browse_thread/thread/821271ca11a1bdbf/46c87b49c026246f?lnk=st&q=+focus+nsIAutoCompletePopup+selectedIndex&rnum=1
                 quirks['firefox_autocomplete_bug'] = true;



More information about the Laszlo-checkins mailing list