This actually makes sense. insertCell returns a reference to a newly inserted element. IE obviously has none of the methods on a returned element. Have you tried "wrapping" this into a helper method?
Element.addMethods('tr', { insertCell: function(element, index) { return $($(element).insertCell(index)); } }); // then the following should work $('someRowElement').insertCell(-1).writeAttribute({ ... }); - kangax On Jun 16, 6:19 pm, icfantv <[EMAIL PROTECTED]> wrote: > Hi- > > First post, so please forgive if this is the wrong place - it's where > the mailing list link from the Prototype library homepage sent me. > > The following code gives a script error in IE 6/7 (assume the > attribute variables exist): > > var row = $('customOaTable').insertRow(-1); > var foo = row.insertCell(-1); > foo.writeAttribute(cellOpts); // will error here > foo.update(new Element('input', inputOpts)); // will also error > row.insertCell(-1).update(new Element('input', inputOpts)); // same > here > row.insertCell(-1).update(new Element('img', imgOpts)); // same > here > > I found that the $ function in IE 6/7 isn't returning an Element > object as the API states (and apparently does in Firefox), I actually > have to do the following to get it to work: > > var row = $('customOaTable').insertRow(-1); > > Element.extend(row.insertCell(-1)).writeAttribute(cellOpts).update(new > Element('input', inputOpts)); > Element.extend(row.insertCell(-1)).update(new Element('input', > inputOpts)); > Element.extend(row.insertCell(-1)).update(new Element('img', > imgOpts)); > > I don't mind doing this, but it seems excessive. Am I just doing > something wrong, or is this the "right" behavior? Any guidance would > be most appreciated. Thanks. > > --adam --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---