RE: Text metrics with display:none

As I saw the responses here unfold (talking about the difference between display:none and visibility:hidden) that I already use and abuse often, I realized that the extent of my concern or what one might call the use-notches (since I have no idea of how one might formally define a "use-case," but if one ever did, then a "use-notch" would follow it like a shadow) were left fuzzy. I was thinking of lots of invisible things and not just those.

For example, for some years now, I have on occasion (as the muse of whims beckons) drawn things inside a <def> tag. They are neither visible nor displayed nor hidden nor none-d .  They are just defined. In some browsers (let us call these the "happy browsers")  you can measure things there. Recently I discovered that while you might be able to <use> or clone, use as a clipPath or even translate such a thing, it is not to be measured, at least in some unhappy browsers. 

It was that notion of raw inconsistency that leaves me queasy. There are fewer than 1400 of my experiments with leprechaun nodes though, and so, within a year I might be able to inventory them; meaning that in another 20 years I might be able to move them from one part of the DOM to another and thence to style using some as yet unspecified version of CSS (which I gather will hold all semantics for graphical items now?) , but of all the invisible places that one might place content (<g> that has been placed in an unused clipPath, masks, <g> inside <def>, <defs>, <pattern>  etc.) I can imagine some transfinite number of them that would be invisible not because of styles, but because of SVG and then I can imagine getting a note from someone who tells me that of course it doesn't work in browser X because it was never supposed to all along since 2003 and it was a terrible accident that ever it did.

That is the nature of my fuss, or at least I think it is .

Cheers
David

-----Original Message-----
From: Tab Atkins Jr. [mailto:jackalmage@gmail.com] 
Sent: Monday, December 12, 2011 11:34 AM
To: Charles Pritchard
Cc: Chris Lilley; David Dailey; Cameron McCormack; Brian Birtles; www-svg
Subject: Re: Text metrics with display:none

On Mon, Dec 12, 2011 at 8:04 AM, Charles Pritchard <chuck@jumis.com> wrote:
> On Dec 12, 2011, at 6:27 AM, Chris Lilley <chris@w3.org> wrote:
>> If you want things to be rendered (but invisible) - as opposed to not being in the rendering tree at all, which is what display: none does - then visibility: hidden is what you want.
>
> In HTML it's also position: absolute and top/left offset off screen. It's not an elegant solution but it's been the method for a long time.
>
> It'd be nice to have an elegant solution in the future. These feel like work-arounds for an API that wasn't designed for these use cases.

visibility:hidden is the correct solution for the use-case presented
(measuring things that aren't visible).

HTML/CSS has a further use-case in-between visibility:hidden and
display:none where you want something to not be visible or affect
layout in any way but still generate boxes and run general
house-keeping, like incrementing counters and keeping animations
going.  As far as I can tell this isn't necessary in SVG, as it's
trivial to make the layout algorithm ignore a box, and so just using
visibility:hidden is fine.

~TJ

Received on Tuesday, 13 December 2011 01:50:23 UTC