Re: visible attribute

"Arnold, Curt" wrote:
> 
> Chris Lilley [mailto:chris@w3.org] wrote:
> 
> >Its not clear what you mean by "display fragment" but I assume that you
> >mean to alter the value of the disply property to a value of "none" which
> >is correct.
> 
> By display fragment, I meant a substring of the style that contained display:xxxx.
> Sorry, I'm a newbie with CSS terminology.

Ah. You were assuming that the style attribute was where all this
information lived, and that one could look at that attibute as the way to
find the value of a given property. This is not the case.

Other sources of style information include stylesheets in the style
element, externally linked stylesheets, the UA default stylesheet and user
stylesheets. These are all combined together using a process called
cascading (hence the name, CSS).

If you want to find out the value of a particular property on a given
element,, then the DOM 2 CSS Object Model does that. If you want to alter
the value of a property permanantly, then using the DOM 2 CSS OM to write
to the run-time stylesheet does that. If you want to adjust the value
temporarily, for example as part of an animation, then SMIL Animation lets
you do that.

If you rewrite or alter the style attribute on a given element, that alters
*one* of the inputs to the final value. Which is fine if you want to change
one of the inputs; but it sounds as if you want to change the output. You
can do that, and you don't need to go slicing apart and puttingback
together any style attributes (which may not even be present). A well
designbed SVG image will only use style atttributes for occasional
overrides.

> >Since there already is a property called "visible", its not clear how what
> >you are asking fro is significantly different (or less error prone) than
> >the present situation.
> 
> I didn't dig into the DOM description sufficiently and was thinking
> that you would have to parse the style attribute and replace or append
> the "display:xxx" fragment by substring'ing and appending in Javascript.

I can see how tu would have thought that. When you consider that the style
attribute uisn't there on most elements anyway, and read up about the CSS
cascade, it becomes clear thatthat method is both inefficient and also
doesn't necessarily get what you want as a result. There could be a more
specific rule elsewhere that overrides any style attribute.
 
> However, it appears that you could do something like:
> 
> group.style.setProperty("display","none","important");

Right.

> which would be satisfactory.  Thanks for your clarification on the difference between display and visible.

Yes, it looks as if they do the same, but that achieve similar results by
different means. Sometimes, that difference is significant.

--
Chris

Received on Monday, 13 March 2000 19:27:07 UTC