Another day, another Internet Explorer bug. I was using MooTool’s Request.HTML to load some AJAX content to display within an inline popup and IE kept throwing the classic “Object doesn’t support this property or method” error. The error was occurring inside document.id (i.e. the dollar function) which made the issue even stranger. Looking at the dollar function’s source code, it seems as though methods are copied from Element.prototype to the element being retrieved.
The AJAX content I was loading contained a form which had a form element with ID “position”. When the Request.HTML receives html content it retrieves a list of all elements contained with the AJAX response using getElements(“*”). This caused the document.id method to be called with the form element of ID “position” contained within the HTML response as its argument, which caused the following assignment to be made:
theFormElement["position"] = Element.prototype["position"];
Which then triggered the above mentioned IE error. Since theFormElement["position"] is a read-only reference to the input element contained within the form IE threw an error. Be aware of the ID / name you assign to input elements when debugging obscure bugs in internet explorer!
Step 1: Retrieve Emulator’s Gateway IP Address
Grab the inet number resulting from
Step 2: Add Test Site’s Local Hostname to Window’s Host File
For each site I develop I setup a new Apache virtual host (some info on apache virtual hosts here). For instance, the local domain / hostname for a website could be
. When developing locally there are some hardlinks to the local development hostname, for this reason the it isn’t enough to use the inet vmnet1 address retrieved above when debugging in VMWare / Parallels; the local hostname must be added to the Windows host file.
Wikipedia has an extensive listing of the location of the host file on various systems, on Windows XP it is located here:
Open up the file in notepad and add your host entry, for example:
Step 3: Add Emulator’s Gateway IP Address to Your VirtualHost
In order for apache to properly handle the request coming from the emulator gateway you have to add the emulator gateway IP to the VirtualHost statement.
<virtualhost 127.0.0.1 172.16.232.1>