Rob Smith wrote:
> Hi,
> 
> I was hoping to use the :empty CSS3 selector in XXE to emulate the
> behaviour of the Docbook 5 stylesheets when formatting empty "link"
> elements. If the element contains text content, this should be displayed
> as the link text. If the element is empty, the link URL should be
> displayed instead.
> 
> I tried using
> 
>   @namespace xlink "http://www.w3.org/1999/xlink";;
> 
>   link[xlink|href]:empty {
>     content: attr(xlink|href);
>     color: gray;
>   }
> 
> With links in the form
> 
>   <link xlink:href="http://MySite.com"; />
>   <link xlink:href="http://MySite.com";>My Site</link>
> 
> neither link is matched, and I just get the default XXE styling with an
> empty text node. If I remove the :empty selector then both links are
> matched, and the content is replaced by the URL.
> 
> The CSS3 spec says that "In terms of the DOM, only element nodes and
> text nodes (including CDATA nodes and entity references) whose data has
> a non-zero length must be considered as affecting emptiness", so empty
> text content should allow a match.
> 
> Am I right in thinking that XXE doesn't support the :empty selector on
> elements where the content model includes text?


For XXE,
<link xlink:href="http://MySite.com"; />
means:
<link xlink:href="http://MySite.com";>EMPTY TEXT NODE HERE</link>

But there is a bug in the implementation of ":empty" because, for XXE,
an element containing an empty text node is *not* considered to be empty.

Thanks for having found and reported this bug. It is fixed now, but
you'll get the fix in next release.



---
PS: Adding or removing the *text* contained to/from the link element
will *not* cause the styled view of the link element to be automatically
refreshed. This is not a bug but just a limitation. That is, you need to
use Ctrl-L.

Note that adding or removing child *elements* to/from the link element
cause the the styled view of the link element to be automatically
refreshed. That is, in this case, you *don't* need to use Ctrl-L.





Reply via email to