Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The part of the system I was talking about would be a static component beneath the level of scripting and events. At that level the document can be considered a static snapshot of the state. The evaluation of each of the property values would be single expressions that could draw upon the state as input and produce style properties as a result. There should be no lifetime of the execution beyond that single evaluation. As an implementation detail, this would be extremely amenable to parralelism and memoization. to make things perform well.

Even though you have things like :hover and transitions in a document that can dramatically change what you see onscreen, the Document itself is unchanging. Think of it as a many-dimentional thing. Nothing changes when you hover over an element, but your rendered viewpoint is now drawing the space in which :hover is true.

Scripts are things that can potentially change the Document itself.

Events are things that happen related to the viewpoint renderer. it would be entirely possible to define something at a lower level to indicate that an event is capable of occurring via the styling mechanism, but what actually happens would be up to the viewpoint renderer.

Consider the case of an event occurring on the end of a transition. The triggering mechanism is the viewpoint finishing the transition, and it is up to the engine driving the viewpoint to trigger the event.

The styling behaviour would merely indicate that a transition would be requested on certain elements.



Looks like we are almost in agreement, except that I see no reason to separate event handling from the overall style description. Of course, modifying the document is out of the scope of styling rules, events handlers on that level must change only styling, nothing else.

What events bring (besides generalizing the :hover-like pseudo-selectors into something more powerfull) is better separation of concerns. Instead of your Javascript touching several elements styles, it generates an event, and you describe how to handle it at the styling sheet.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: