Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #10096 (new defect)

Opened 3 years ago

Last modified 2 years ago

[patch] Ajax.InPlaceCollectionEditor broken in MSIE 7

Reported by: pandemic Assigned to: madrobby
Priority: normal Milestone: 2.x
Component: script.aculo.us Version: 1.2.3
Severity: normal Keywords:
Cc:

Description

Ajax.InPlaceCollectionEditor works fine in Firefox (1, 1.5, 2.x) but when used in MSIE 7 out-of-the-box it breaks: the text it is anchored to disappears and MSIE raises an error, saying that a method or property is not supported by the object in question. I am finding this error both on my own site and also in the functional tests shipped with the libraries. (Load the functional tests into MSIE 7, choose "ajax inplacecollectioneditor test" from the list under "Controls". Click any highlighting demo and see it disappear and the error be raised.) The error produced is identical to the one I was seeing on my own site.

Interestingly, the IPCE successfully renders in the demos on the script.aculo.us wiki. I could find no fundamental difference between how I am invoking the IPCE and how it is invoked on the demos wiki, apart from the fact that, apparently, the wiki's code is not updated to the most current revision.

Change History

12/12/07 05:56:58 changed by bryanmcguire

I ran into this issue today.

The problem is line 838 of controls.js (version 1.8.0)

 this._controls.editor.update('');

where this._controls.editor is a Select form element.

I don't know what this line is intended to do, but it seems to do nothing in firefox, and in IE7 it causes scripts to abort and break as described.

--- 1.8.0/src/controls.js       2007-11-06 04:01:41.000000000 -0800
+++ fixed/src/controls.js       2007-12-11 21:40:27.000000000 -0800
@@ -835,7 +835,6 @@
     var textFound = this._collection.any(function(entry) {
       return entry[0] == marker;
     }.bind(this));
-    this._controls.editor.update('');
     var option;
     this._collection.each(function(entry, index) {
       option = document.createElement('option');

12/12/07 11:15:53 changed by bryanmcguire

  • summary changed from Ajax.InPlaceCollectionEditor broken in MSIE 7 to [patch] Ajax.InPlaceCollectionEditor broken in MSIE 7.

this is a prototype thing:

<select id="a"><option value = bar>foo</option></select>
<script type="text/javascript">
$('a').update('');
</script>

In firefox, it makes an empty select element. In IE7 you get the dreaded error message in the original description.

The proper patch is to simply remove the line.

Following the code: createEditField() makes a select element object, then calls checkForExternalText(), possibly by way of loadCollection(), neither of which touches this._controls.editor. checkForExternalText calls buildOptionList() possibly by way of loadExternalText(), again nothing messes with the select element created in createEditField().

It's an empty select element, and there's no reason to try to empty it again.

(follow-up: ↓ 5 ) 02/01/08 20:17:38 changed by eggie5

+1

06/30/08 04:58:10 changed by JamesBrooks

+1, I had this issue in IE6 as well as this solved it.

(in reply to: ↑ 3 ) 01/23/09 01:35:10 changed by enoyes

Replying to eggie5:

+1

Yep, this was a showstopper. Thankfully, commenting the code works in every browser I've tried. When in doubt, cut it out! Thanks dudes...