John L. Clark wrote:
> On Thu, Apr 22, 2004 at 12:42:06PM +0200, Hussein Shafie wrote:
>
>>The behaviour you describe can be easily reproduced if you forget to
>>mark the div as being collapsible. To do this, you really need to use
>>proprietary CSS property "collapsible: yes;" (which is not inherited).
>
>
> Here's the relevant fragment from my stylesheet (I had been using
> xhtml:div as a test case; this is from my actual configuration):
>
> src\:fragment
> {
> display: block;
> collapsible: yes;
> /*not-collapsible-head: 1;*/
> collapsed-content: paragraph(content(collapser(),
> " Program fragment: " attr(id)),
> font-weight, bold,
> color, navy);
> white-space: pre;
> font-family: monospace;
> background-color: #EEEEEE;
> border: thin solid gray;
> padding: 2px;
> margin: 1.33ex 0;
> }
>
> src\:fragment:before
> {
> display: block;
> content: paragraph(content(collapser(), " Program fragment: "
> attr(id)),
> font-weight, bold,
> color, navy);
> }
>
> The collapser widget appears at the top left of the src:fragment block
> element along with generated text which denotes that element. When I
> click on the collapser widget, it collapses the nearest collapsible
> ancestor of the src:fragment element (as opposed to the src:fragment
> element itself, as expected). As far as I can tell, src:fragment
> elements should be collapsible, but will not collapse. I was concerned
> that there was a bug somewhere that would only allow collapsing to work
> when the collapser widget was placed on a child of the element in
> question.
>
> Take care,
>
> John L. Clark
>
> P.S. To be complete, here's my slightly modified test of the xhtml:div
> case (which displays but will not "collapse" for me). I inserted this
> into the system xhtml.css file at line 65:
>
> div {
> collapsible: yes;
> }
>
> div:before,
> div:after {
> content: collapser();
> display: block;
> margin: 5 auto;
> text-align: center;
> }
>
> div:after {
> content: collapser(collapsed-icon, icon(collapsed-left),
> expanded-icon, icon(expanded-up));
> }
>
>
I have not checked your src:fragment example but just added the div
styles at line 65 of xhtml.css.
That's true: with the above styles, a newly added div is created with
*disabled* (brown/gray, flat, dull, look) collapser buttons.
This is not really a bug but rather a limitation which will be
documented -- but probably not removed -- in next release.
The limitation is: a block cannot be collapsed unless it contains other
blocks.
In the case of a newly created div, the content of the div is just a
text node which is clearly not styled as a CSS block.
If you want to make div collapsible, you need to define an
<elementTemplate> configuration element which forces the newly created
div to contain a p.
If you want to experiment with this quickly, simply select the text node
in the div and replace it by a p, you'll see that the collapser buttons
changes their state from disabled to enabled (light blue with a nice
relief and border).