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

Ticket #7938 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

Insertion.After inserts table rows the wrong way round in IE

Reported by: howardr Assigned to: Tobie
Priority: normal Milestone: 1.x
Component: Prototype Version: edge
Severity: normal Keywords: 1.5.2
Cc:

Description

In IE7 (posibly IE6) Insertion.After of table rows after a table row revereses the order of the rows.

var rows = '<tr><td>row 1</td></tr>';
rows += '<tr><td>row 2</td></tr>';
rows += '<tr><td>row 3</td></tr>';

new Insertion.After('someTableRow', rows.join(''));

In Firefox, the rows will show up in order. In IE7, row 3 will show up first, then row 2, row 1, etc...

view live example here: howardr.s3.amazonaws.com/proto-test.html

to fix it, i did this:

Insertion.After = Class.create();
Insertion.After.prototype = Object.extend(new Abstract.Insertion('afterEnd'), {
  initializeRange: function() {
    this.range.setStartAfter(this.element);
  },

  insertContent: function(fragments) {
    debugger;
    fragments.each((function(fragment) {
      this.element.parentNode.insertBefore(fragment,
        null);  // by making this line 'null' it will always enter the node as the last child
    }).bind(this));
  }
});

Attachments

insertion-after-fix.patch (392 bytes) - added by howardr on 03/29/07 15:35:27.
diff

Change History

03/29/07 15:13:17 changed by howardr

sorry, the last line of the first code block should be

new Insertion.After('someTableRow', rows);

03/29/07 15:14:16 changed by howardr

  • severity changed from normal to major.

03/29/07 15:35:27 changed by howardr

  • attachment insertion-after-fix.patch added.

diff

04/19/07 12:11:40 changed by docware

Also problem for Insertion.Bottom when used with PeriodicalUpdater like in

<table id="insert" border="1">

<tr id="insertAfter"><th>col1</th><th>col2</th></tr>

</table>

<script type="text/javascript">

new Ajax.PeriodicalUpdater("insert", "row.html", {

insertion: Insertion.Bottom

});

</script>

Firefox will periodically increase the table. IE7 will not show anything and stops firing.

04/19/07 12:13:21 changed by docware

forgot to say Ie tested with 1.5.0 and 1.5.1_rc2

04/20/07 12:11:02 changed by docware

same problem in IE6

04/20/07 12:30:08 changed by docware

Howard's patch had no success for me in 1.5.0

04/20/07 13:12:09 changed by docware

Insert.After works

04/26/07 22:55:50 changed by howardr

I updated my example url. It was referencing a version of prototype that i patched myself. I now have it pointing to fresh releashed prototype 1.5 rc3.

04/27/07 09:42:14 changed by docware

my problem still there is 1.5.1-rc3

04/27/07 15:10:16 changed by howardr

@docware

Is my patch breaking your script, or is it not fixing your issues? If it is not fixing your issue I can take a look if you give me an example URL for your issue.

My example url above (http://howardr.s3.amazonaws.com/proto-test.html) is supposed to show how the script is broken not how it is fixed.

04/27/07 15:51:40 changed by docware

Hello Howard,

I would be glad if you could have a look at my problem. I copied a sample here:

http://demo.docware.de/demo_v7_shop/ajaxbug/AjaxBug.jsp

Michael

04/28/07 17:33:51 changed by howardr

michael,

i figured out what was causing your issue. I have found a couple of quick fixes, but they break the unit tests. the issue though is unrelated to this bug. I will post another bug to the wiki when i figure out the issue. if you want me to let you know what i found, email me at howard(at)uship.com.

--howard

04/30/07 09:25:13 changed by docware

Howard thank you for investigating this. Can you sent me the bug # when you post the new bug report?

Best regards

Michael

05/03/07 02:03:06 changed by Tobie

  • keywords set to 1.5.2.
  • owner changed from sam to Tobie.
  • severity changed from major to normal.
  • summary changed from Insertion.After broken when inserting table rows in IE7 to Insertion.After inserts table rows the wrong way round in IE.

05/12/07 05:02:00 changed by sam

  • status changed from new to closed.
  • resolution set to fixed.

(In [6725]) Merge -r6634:HEAD from ../branches/dom.

* Make Element#update and Element#insert work for SELECT tags in IE and Opera. [Tobie Langel]

* Make Element#insert and Element#update better handle TABLE related elements in IE and Opera. Closes #7776, #8040, #7550, #7776, #7938. [Tobie Langel]

* Make Element#readAttribute('title') work in Opera. [Tobie Langel]

* Make Element#replace work with form elements in Firefox and Safari. Closes #8010, #7989. [dsl239, Tobie Langel]

* Add Element#wrap which wraps the element inside a new one. Closes #5732. [P. Vande, Tobie Langel]

* Make Element into a constructor: new Element(tagName, attributes). Add Element#writeAttribute which accepts a hash of attributes or a name/value pair. Closes #7476. [Mislav Marohni?\196?\135, haraldmartin, Tobie Langel]

* Insertion overhaul: Add Element.insert(content[, position = 'Bottom']). Deprecate Insertion (kept for backwards compatibility). Make Ajax.Updater option.insertion accept both Insertion.Top or the now preferred 'Top'. Closes #7907. [Tobie Langel]