#32 new

Ajax.Autocomplete in IE with Doctype

Reported by olly | June 25th, 2008 @ 01:37 PM

The Ajax.Autocomplete control does not behave correctly in Internet Explorer 6 & 7.

If the HTML document has a doctype declaration then the results of the ajax call will not display the first time something is searched for. If you clear the input box and search again, the results do display.

Comments and changes to this ticket

  • jrochkind

    jrochkind September 5th, 2008 @ 07:30 PM

    I am experiencing this bug too. Very very annoying, autocompleter does not work in IE7. This applies to Autocompleter.Local too.

    If anyone has a patch or workaround, would be very helpful.

    Am getting a bit annoyed at Autocompleters generally flakiness.


  • jrochkind

    jrochkind September 5th, 2008 @ 08:25 PM

    For what it's worth, I am tracing where the problem is being caused exactly. Scriptaculous 1.8.2, prototype 1.6.2.

    Autcompleter sets options.onShow to a function, which calls Position.clone (which incidentally is deprecated in prototype,and just points to Element.clonePosition).

    One of the things Element.clonePosition does is call delta = parent.viewportOffset();

    That's where the error is triggered, I think.

    That's as far as I've gotten right now, and really don't understand what the heck is going on, I am not super familiar with prototype or scriptaculous code, or browser DOM for that matter. (That's why I use scriptaculous, so I don't have to be, right?).

  • jrochkind

    jrochkind September 5th, 2008 @ 08:36 PM

    Okay, I have a patch that seems to work. I don't entirely understand what I'm doing, so use with caution. And sorry I don't have a clean prototype to actually make a real patch (or know how to, for that matter).

    But in Prototype, there is a wrapper for viewportOffset for IE, that has a bug in it.

    Look for the line:

    var offsetParent = element.getOffsetParent();

    Change to:

    var offsetParent = (element.parent) ? element.getOffsetParent() : 0;

    Seems to do the trick for me.

    Seems like it's actually a prototype bug, not a scriptaculous one? But not really sure.

  • yaz

    yaz May 18th, 2010 @ 05:19 PM

    I can confirm this bug in IE 7. In IE 8 is working.

    Using Prototype version 1.6.1 and Scriptaculous 1.8.3.

    Also, I don't know if its relevant, but I'm using this doctype:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

script.aculo.us is an open-source JavaScript framework for visual effects and interface behaviours.
<br/><b>Source available from github</b>
The Git repository resides at:
<a href="http://github.com/madrobby/scriptaculous">http://github.com/madrobby/scriptaculous</a>
<br/>Check out the current development trunk with:
<code>git clone git://github.com/madrobby/scriptaculous.git</code>
<br/>As <b>script.aculo.us 1.xx is feature-frozen</b>, this development trunk is for <b>bugfixes only</b>.
<br/>New development should happen only for
<b>script.aculo.us 2</b>.
<br/><b>Creating a bug report</b>
When creating a bug report, be sure to include as much relevant information as possible. Post a an example that shows off the problem. Preferably, <b>alter the unit tests</b> and show through either changed or added tests how the expected behavior is not occuring.