J
Jens Müller
Hi,
as I couldn't figure out how to post to the Ruby Spinoffs forum
directly, I am starting a new post here and hope some kind admin can
move it over to the appropriate forum.
I am trying to insert a new row to a table using prototype's "new
Insertion.Bottom" which works fine in all popular browsers except for
Opera. Digging into the code of prototype 1.5.0_rc0 I discovered that
insertAdjacentHTML() is used for Opera:
---- lines 1147-1154 --->
if (this.adjacency && this.element.insertAdjacentHTML) {
try {
this.element.insertAdjacentHTML(this.adjacency, this.content);
} catch (e) {
var tagName = this.element.tagName.toLowerCase();
if (tagName == 'tbody' || tagName == 'tr') {
this.insertContent(this.contentFromAnonymousTable());
} else {
<------------------------
If I insert a simple "throw('bla')" in the first try-block, so that the
catch-part is run, it works in opera.
I boiled down the lengthy code and put up a test case [1] which uses
insertAdjacentHTML() to add a new table row and you can see (when the
updated innerHTML of the table is displayed) how opera seems to
completely ignore the TR and TD tags yet handling B and I correctly.
---- interesting parts from the test case---->
tbl = document.getElementById("mytable");
tbl.insertAdjacentHTML("beforeEnd",
"<tr><td><b>newCellone</b></td><td><i>newCelltwo</i></td></tr>");
<------------------------
I know I could use DOM functions like insertRow() to circumvent that
problem but I want to make use of prototype's functions as much as
possible. I would appreciate any kind of help as to how to maybe change
the prototype code without breaking other browsers or another way of
working around this apparent bug.
[1] TEST CASE - http://buzzinhornetz.ath.cx/tmp/adjacent.html
Thanks in advance,
schdewwn
as I couldn't figure out how to post to the Ruby Spinoffs forum
directly, I am starting a new post here and hope some kind admin can
move it over to the appropriate forum.
I am trying to insert a new row to a table using prototype's "new
Insertion.Bottom" which works fine in all popular browsers except for
Opera. Digging into the code of prototype 1.5.0_rc0 I discovered that
insertAdjacentHTML() is used for Opera:
---- lines 1147-1154 --->
if (this.adjacency && this.element.insertAdjacentHTML) {
try {
this.element.insertAdjacentHTML(this.adjacency, this.content);
} catch (e) {
var tagName = this.element.tagName.toLowerCase();
if (tagName == 'tbody' || tagName == 'tr') {
this.insertContent(this.contentFromAnonymousTable());
} else {
<------------------------
If I insert a simple "throw('bla')" in the first try-block, so that the
catch-part is run, it works in opera.
I boiled down the lengthy code and put up a test case [1] which uses
insertAdjacentHTML() to add a new table row and you can see (when the
updated innerHTML of the table is displayed) how opera seems to
completely ignore the TR and TD tags yet handling B and I correctly.
---- interesting parts from the test case---->
tbl = document.getElementById("mytable");
tbl.insertAdjacentHTML("beforeEnd",
"<tr><td><b>newCellone</b></td><td><i>newCelltwo</i></td></tr>");
<------------------------
I know I could use DOM functions like insertRow() to circumvent that
problem but I want to make use of prototype's functions as much as
possible. I would appreciate any kind of help as to how to maybe change
the prototype code without breaking other browsers or another way of
working around this apparent bug.
[1] TEST CASE - http://buzzinhornetz.ath.cx/tmp/adjacent.html
Thanks in advance,
schdewwn