--- a/editcommands.html Sun Jun 19 15:39:27 2011 -0600
+++ b/editcommands.html Sun Jun 19 15:49:44 2011 -0600
@@ -441,9 +441,10 @@
<p class=XXX>Is this a good definition at all? I mean things like
<p>foo<br></p>, or the second one in <p>foo<br><br></p>.
The way I test it is by adding a text node after it containing a zwsp; if that
-changes the offsetHeight, I deem it collapsed. But what if it happens to be
-display: none right now, for instance? Would it be better to use some
-DOM-based definition?
+changes the offsetHeight of its nearest non-inline ancestor, I deem it
+collapsed. But what if it happens to be display: none right now, for instance?
+Or its ancestor has a fixed height? Would it be better to use some DOM-based
+definition?
<p>Each <code class=external data-anolis-spec=html><a href=http://www.whatwg.org/html/#htmldocument>HTMLDocument</a></code> has a boolean <dfn id=css-styling-flag>CSS styling flag</dfn> associated
with it, which must initially be false. (<a href=#the-stylewithcss-command>The <code title="">styleWithCSS</code> command</a> can be used to modify or query it, by
--- a/implementation.js Sun Jun 19 15:39:27 2011 -0600
+++ b/implementation.js Sun Jun 19 15:49:44 2011 -0600
@@ -667,11 +667,17 @@
return false;
}
- // Add a zwsp after it and see if that changes the height.
+ // Add a zwsp after it and see if that changes the height of the nearest
+ // non-inline parent. Note: this is not actually reliable, because the
+ // parent might have a fixed height or something.
+ var ref = br.parentNode;
+ while (getComputedStyle(ref).display == "inline") {
+ ref = ref.parentNode;
+ }
var space = document.createTextNode("\u200b");
- var origHeight = br.parentNode.offsetHeight;
+ var origHeight = ref.offsetHeight;
br.parentNode.insertBefore(space, br.nextSibling);
- var finalHeight = br.parentNode.offsetHeight;
+ var finalHeight = ref.offsetHeight;
space.parentNode.removeChild(space);
return origHeight != finalHeight;
--- a/source.html Sun Jun 19 15:39:27 2011 -0600
+++ b/source.html Sun Jun 19 15:49:44 2011 -0600
@@ -383,9 +383,10 @@
<p class=XXX>Is this a good definition at all? I mean things like
<p>foo<br></p>, or the second one in <p>foo<br><br></p>.
The way I test it is by adding a text node after it containing a zwsp; if that
-changes the offsetHeight, I deem it collapsed. But what if it happens to be
-display: none right now, for instance? Would it be better to use some
-DOM-based definition?
+changes the offsetHeight of its nearest non-inline ancestor, I deem it
+collapsed. But what if it happens to be display: none right now, for instance?
+Or its ancestor has a fixed height? Would it be better to use some DOM-based
+definition?
<p>Each [[htmldocument]] has a boolean <dfn>CSS styling flag</dfn> associated
with it, which must initially be false. (<span>The <code