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
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.
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?).
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 18.104.22.168, there is a wrapper for viewportOffset for IE, that has a bug in it.
Look for the line:
var offsetParent = element.getOffsetParent();
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.
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" "http://www.w3.org/TR/html4/loose.dtd">
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<br/><b>Source available from github</b>
The Git repository resides at:
<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
<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.