Click here to register.
      

Firefox anomaly in JavaScript

Design Squid
Firefox anomaly in JavaScript
fdillon · 2/25/2009 10:27 am

While coding YUI dialog boxes this past week, I ran into the following error that seemed to only happen in Firefox:

Error: [Exception… “‘Permission denied to get property XULElement.selectedIndex’ when calling method: [nsIAutoCompletePopup::selectedIndex]”


Try as I might, I could not make this error go away.  After doing some research on the web, I discovered that the error stems from calling focus() or blur() from a keydown event handler in Firefox (it is thrown when called from other handlers).  Apparently this is a known bug with autocomplete that has existed for some time

The real issue was that this wasn't something I was doing myself, but rather something in YUI's dialog code that was calling the focus() method when the dialog box opened up, triggering the error.  To solve the issue, I added the following code to my page init to disable autocomplete on all the input elements:


if (document.getElementsByTagName) {
   var inputElements = document.getElementsByTagName("input");
    for (i=0; inputElements; i++) {
        inputElements.setAttribute("autocomplete","off");
    }
}

It's not the most elegant solution, but it worked!  As WebGUI uses more and more YUI components we will certainly run into issues like this one, so I plan to keep you updated on all the little anomalies I find.

Re: Firefox anomaly in JavaScript·
patspam · 3/2/2009 4:58 pm

Good sleuthing Frank! I assumed it was just one of those weird Firebug issues that only the odd developer would see. Did you report it as a bug at the new YUI bug page?

·
Stick
Lock
Subscribe