Re: "active" CSS

Hi, Justin,

"...leave "Behavior" to scripting, leave Markup to HTML/xhtml and leave
Style to CSS ;-)... "

Ideally it should be just XML and CSS. DTD combined with correspondent CSS
should be enough to define
XHTML1, XHTML2, XUL, etc. Sounds little bit extrimistic but...

Try to think about "Behavior" as just about "behaviorial style". Some
elements in HTML definitely have such
styles. E.g. <a>, <img>, <nl> <input type="submit">, etc.

Example: any element in XHTML2 can have 'href' attribute defined therefore
will behave as a hyperlink.

So I am defining in Stock(default) CSS for XHTML2
them as:
*[href]:on-click { navigate-to(href) }

For Stock(default) CSS for HTML4.01 I will define
a[href]:on-click { navigate-to(href) }

Someone in his private CSS for some page will define it as
a[href]:on-click { navigate-to(href,"_new") }
-or will override new window popup-
a[target="_new"]:on-click { navigate-to(href) }

The idea is simple: pure HTML has and will have its own built-in behavior
styles.
Number of such behaviors is pretty limited so could be defined as a
"standard" set of  behavioral style "functors".

One more example:  img[title]:on-hover { show-hint(title) }

These builtin functions do not conflict with use of ECMAScript.
But why http://www.w3.org/TR/1999/WD-becss-19990804 is "forever draft"?
Probably because of forcing use of script which is so far from CSS concept?

Andrew Fedoniouk.
http://terrainformatica.com


From: "Justin Wood (Callek)":
|
| Andrew Fedoniouk wrote:
|
| >
| > I've got a task: to emulate behaviour of XHTML2 <nl> element
| > (collapsible list/"tree") using CSS solely.
| >
| > After some experiments I came up with the following solution. I've
| > implemented
| >
| >    :on-click
| >
| > pseudo class and function
| >
| >   set-parent-attribute(  <attribute-name> , <attribute-value> )
| >
| > This function sets attribute <attribute-name> of element's parent to
| > <attribute-value>
| >
| > Having this I defined following statements in my stock style sheet for
| > nl>li
| > and nl>label:
| >
| > nl>li  {  display:list-item;  }
| > nl[state="close"]>li { display:none; }
| >
| > nl>label:on-click {  set-parent-attribute ( state, "close"); }
| > nl[state="close"]>label:on-click                   {
| > set-parent-attribute ( state, "open");  }
| >
| > Following HTML with the style applied defines such
| > collapsible list (tree):
| >
| > <nl>
| >   <label>Contents</label>
| >   <li href="#introduction">Introduction</li>
| >   <li>
| >      <nl>
| >          <label>Terms</label>
| >          <li href="#may">May</li>
| >          <li href="#must">Must</li>
| >          <li href="#should">Should</li>
| >      </nl>
| >   </li>
| >   <li href="#conformance">Conformance</li>
| > </nl>
| >
| > In fact I was using initially full set of on-mouse, on-focus, on-key,
| > etc. "CSS event
| > connectors".  Instead of the 'set' function I was using names of
| > functions
| > implemented in script  (my c-smile language:
| > http://c-smile.sourceforge.net )
| > Script functions reside in associated <script> block.
| >
| > During this experiments I have discovered that surprisingly many current
| > typical HTML/JavaScript use cases seen on the web
| > could be implemented by the "on-click" and couple of simple
| > "state-switch"
| > functions like 'set' I mentioned before.
| > I mean that many dynamic effects (e.g. <nl>, popup menus, etc.) could
| > be defined without any
| > script at all - just in "pure" CSS.
| >
| > This message is not a proposal in any sense.
| > It is just my thoughts aloud about "CSS and active elements" and "CSS
and
| > scripting".
| >
| > I would appreciate any creative comments on the subject...
| > E.g. "set-parent-attribute" is not universal enough.
| > Some other function, with additional parameter defining
| > "relative path" of target element, should be designed.
| > And of course: does all of this make any sense?
| >
| > Thanks.
| >
| > Andrew Fedoniouk.
| > http://terrainformatica.com
| >
| >
| >
| In my opinion, do not try to cross-contaminate the uses of each area,
| leave "Behavior" to scripting, leave Markup to HTML/xhtml and leave
| Style to CSS ;-)
|
| those ideas you had with the nl element would have been much better used
| with ECMAScript/DOM than CSS, much more understandable and use-able...
|
| ~Justin Wood
|

Received on Monday, 11 October 2004 02:13:53 UTC