W3C home > Mailing lists > Public > www-style@w3.org > May 2008

Re: [Bulk] Re: [BECS] CSSS! - CSS script

From: Andrew Fedoniouk <news@terrainformatica.com>
Date: Thu, 08 May 2008 18:08:01 -0700
Message-ID: <4823A3F1.7070406@terrainformatica.com>
To: Francois Remy <fremycompany_pub@yahoo.fr>
CC: www-style <www-style@w3.org>

Francois Remy wrote:
> Should we not use the already IE-implemented expression( /* some js 
> here */) instead of your CSS Script Module ?
> The role of W3C is to standardise already implemented properties, and 
> not make some others if a cool way to do this already exists.
>  
> ---------------------------------------------------------
> The way it would work seems to be better :
>     selector:hover {
>         on-selector-enter: 
> expression(void(this.parentNode.className+=' childIsHovered'));
>  
>         /* Fail on IE, because it's considerated as on-selector-enter 
> (as a simple CSS Property, in fact */
>         on-selector-leave: 
> expression(void(this.parentNode.className.replace(/ childIsHovered/g,'');
>     }
>  
> The value of on-selector-enter should be ignored, as the value of 
> on-selector-leave, except if it's one of :
> - start-animation (start a "fade" animation, such as defined in the 
> Apple transform property)
> - no-animation (default, as no value was provided)
>  
> ---------------------------------------------------------
> Naturally, you can "make" another new script language (a CSS-Script 
> language that will be active without any need of JavaScript) and 
> contains only a few functions, and a script( /* CSS Script */) 
> function that can provide support for them.
Speaking about functions. set-focus() for example can be useful for 
implementing <label for> functionality but for any type of element.
Following, as a bonus, also highlights target input element that 
improves usability a bit:

<style>
    [for]
    {
      when-hover-on: $1(#< self.for >).highlight = true;
      when-hover-off: $1(#< self.for >).highlight = null;
      when-active-on: $1(#< self.for >).set-focus();
      cursor:pointer;
    }
    input[highlight]
    {
      outline: 4px glow blue 1px;
    }
</style>

  <table border="1" width="100%">
    <tr>
      <td><label for="first">Label #1</label></td>
      <td><input type="text" id="first" /></td></tr>
    <tr>
      <td for="second">Cell as a label</td>
      <td><input type="text" id="second" /></td></tr>
    <tr for="third">
      <td>Whole row as a label</td>
      <td><input type="text" id="third" /></td></tr>
  </table>

-- 
Andrew Fedoniouk.
http://terrainfromatica.com

>  
> But $p is a bad idea because you can change the style of all the 
> document on a simple :hover or :focus. This is possible in JavaScript 
> but what's in JavaScript is always supposed to be possibly slow. CSS 
> should always be a quick language.
>  
>  
> Fremy
>
>     *From:* David Hyatt <mailto:hyatt@apple.com>
>     *Sent:* Thursday, May 08, 2008 2:36 AM
>     *To:* Andrew Fedoniouk <mailto:news@terrainformatica.com>
>     *Cc:* www-style <mailto:www-style@w3.org>
>     *Subject:* [Bulk] Re: [BECS] CSSS! - CSS script
>
>     http://www.w3.org/TR/xbl/
>
>     dave
>
>     On May 7, 2008, at 7:26 PM, Andrew Fedoniouk wrote:
>>     Idea is to add ability to define simple event handlers in CSS.
>>
.....
Received on Friday, 9 May 2008 01:19:31 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:55:06 GMT