Opened 14 years ago

Closed 9 years ago

#377 closed defect (fixed)

Can't insert column after last column in IE

Reported by: anonymous Owned by: gogo
Priority: normal Milestone: 0.96
Component: Plugin_TableOperations Version: trunk
Severity: normal Keywords:
Cc:

Description

Just contributing a suggested patch here. If you try to insert a new column after the last column in a table, IE returns an error. The solution is to omit the 'ref' parameter when the current cell is the last one in the row:

            case "TO-col-insert-before":
	    case "TO-col-insert-after":
		var td = this.getClosest("td");
		if (!td) {
			break;
		}
		var rows = td.parentNode.parentNode.rows;
		var index = td.cellIndex;
                // added line:
                var lastColumn = (td.parentNode.cells.length == index + 1);
		for (var i = rows.length; --i >= 0;) {
			var tr = rows[i];
			var otd = editor._doc.createElement("td");
			otd.innerHTML = mozbr;
			//added block:
                        if (lastColumn && HTMLArea.is_ie) {
				tr.insertBefore(otd);
			} else {
				var ref = tr.cells[index + (/after/.test(button_id) ? 1 : 0)];
				tr.insertBefore(otd, ref);
			}
		}

Note that the line 'var ref = ' was moved

Change History (6)

comment:2 Changed 13 years ago by gogo

  • Resolution set to fixed
  • Status changed from new to closed

comment:3 Changed 12 years ago by guest

  • Resolution fixed deleted
  • Status changed from closed to reopened
  • Version set to trunk

i tried to insert a column before the last column in IE 7 (don't know about IE 6), and it's not working, it inserts after.
when with Firefox it works great.

working with today's download of Xinha_0.931.zip

comment:4 Changed 12 years ago by wymsy

It works correctly for me in IE 6. I don't have IE 7 so can't test that.

comment:5 Changed 11 years ago by ray

  • Milestone set to 0.96

I can confirm it inserts the column after in IE6 & 7

comment:6 Changed 9 years ago by gogo

  • Resolution set to fixed
  • Status changed from reopened to closed

So I think that means it's fixed.

Note: See TracTickets for help on using tickets.