I was fooling around with Firefox 3 Beta 2 and noticed some code I'd
written previously didn't work.
Here's an example (abbreviated to show the relevant snippets):
HTML:
<div id="foo"></div>
JS:
document.observe('dom:loaded', function() {
try {
$('foo').insert(new Element('p').insert('hello, world'));
} catch (e) {
alert(e.message);
}
});
In all the current "A-grade" browsers, this works fine. In FF3b2,
however, the following message is alerted:
"The container of an boundary-point of a range is being set to either
a node of an invalid type or a node with an ancestor of an invalid
type."
I've discovered some workarounds to this:
1. Split the two inserts into two different lines of code, that is:
var p = $('foo').insert(new Element('p'));
p.insert('hello, world');
2. Use update instead of insert, that is:
$('foo').insert(new Element('p').update('hello, world'));
3. Insert the explicit HTML, even though I'd prefer not to; that is:
$('foo').insert('<p>hello, world</p>');
So, my question(s): Is this some sort of Firefox bug that needs to be
reported, or have I just been using insert() incorrectly and I've just
happened to luck out in the past? I've tended to favor insert() over
update() when creating elements just 'cause the element wasn't really
being updated per se. If anybody's got an explanation for what's going
on here, I'd love to hear it!
:Dan Dorman
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
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
-~----------~----~----~----~------~----~------~--~---