Olaf Bosch schrieb:
> Aaron Ullom schrieb:
>
>> So, my question is, "How do I prevent Opera from bubbling an event up the
>> DOM?"
>
> Use a valid Doc-Type!?
>
Yes, that will fix all of the problems. Not exactly useful.
But indeed, there is some truth in it. It's not about using a Doctype
(which of course I'd too recommend), but its about a proper DOM tree.
I don't know if that will fix the problem, but here's what I assume from
a quick glance at your source code. The inline editing textarea is
wrapped with a div and is appended to <p> (and <h1>) elements on click:
if ($(this).is("div") || $(this).is("p") || $(this).is("h1")){
$(this).append("<div name='editTextArea'><textarea>" + ... +
</textarea></div>");
A <p> element must not contain <div> elements. In HTML (mime type
text/html) the closing tag </p> is not required and the element is
closed implicitly depending on the succeeding element.
That means:
<p>
Some text
<div>
Some more text
</div>
is interpreted by browsers as
<p>
Some text
</p>
<div>
Some more text
</div>
Maybe this is the root of your problem. The text form is not a child of
the <p>, it is a sibling instead. Because after the inline editing stuff
is "appended" to the <p> it will close the <p> implicitly and start a
new element of its own.
Opera may be less forgiving here than IE and Firefox.
You could for example wrap the textarea etc. with <span> instead of
<div>. A <span> may be contained by a <p> and if you need it to display
as a block element, simply style it as one:
.Editable span {
display: block;
}
And by the way, attaching click events like you do via innerHTML may
cause memory leaks in IE, see section "Cross-Page Leaks" here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ietechcol/dnwebgen/ie_leak_patterns.asp
I recommend using jQuery's click() method for that.
-- Klaus
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/