Re: [w3c/uievents] "UI Actions" or Event Responses for Simplified UI Scripting (#295)

I agree. I believe CSS is the best shorthand approach to this. CSS directly manipulates DOM properties and has the shortest method of referencing them. It currently has :hover, which is an event of sorts. It can easily be extended to add other event methods to those objects. The syntax just needs extending a little bit to be useful.

JavaScript is too far removed from the browser for any radical syntax changes to make things quicker for the developer. The current API approach is perfectly fine and probably the best JavaScript can do, without making some shorthand commands for things like getElementById, which seems to be the most common solution to the problem when you look at popular JavaScript wrapper frameworks.

To open CSS up to properly handling UI, the basics that are needed to add this functionality are:

1) All access to all the other browser events. So like :hover we then get :click, :mouseover, :popstate, etc. This on an event declaration means that events can be differentiated from "static" display property declarations when parsing the CSS file so that these don't have to touch the rendering engine.

2) Add a "target" selector underneath the new "event" selector so that the rest of the DOM can be affected by actions in the event.

3) Add useful new commands to CSS, like add-class, remove-class, etc.

4) There's a bunch of other stuff too which would be useful, but those are the main ones which would be useful to every developer.

Eg.

```
#myButton:click {
    #myDiv {
        add-class: .something;
    }
}
```

Every UI action taken in the browser is a cause and effect type of activity. Everything that happens on a web page is prompted by an event of some kind, and actions then take place. I believe CSS has the perfect _basic_ syntax structure for this.

I've actually been working and evolving on this concept for a few years, and have a cross-browser prototype which is a work-in-progress.

https://activecss.org

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/uievents/issues/295#issuecomment-795359068

Received on Wednesday, 10 March 2021 12:41:43 UTC