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

Additional Event Suggestions

From: Perry Smith <pedzsan@gmail.com>
Date: Wed, 5 May 2010 11:28:11 -0500
Message-Id: <A6CC100A-BD63-42E1-8CB4-CE862643907A@gmail.com>
To: www-style list <www-style@w3.org>
I asked this on the html5 list and they pointed me here.  I'm not clear why this is CSS.

It would be nice if there was one or perhaps two pairs of events added.

One pair I'll call "onshown" which is a horrible name and some counter sounding name like "onhide" ?

The onshown event would fire when an element goes from not being visible to being shown due to its display attribute or one of its parent's display attributes changing from "none" to being removed causing the element to be shown on the page.

The use case for this is a current widget I'm working on that is attached to an input element.  It needs to be initialized but if the init routine is called when the element is hidden, the height and width of the element return 0.  I can't temporarily show the element because it is not being hidden directly but is actually being hidden by two of its parents when the page is first drawn.

I could add a hook in the parent's code to call the init code when the element is displayed but it would be cleaner if the parent did not have to know about this extra hook.  It would be nice if I could add a hook so that "onshown" of the element, the init code would be called.

I assume, but don't have a use case, that onhide could be also useful.

The other pair of attributes I don't have even a decent name for them.  It would fire when scrolling brings the element into view and the opposite event would fire when the element is scrolled out of view.

The use case for this is a page returned from database hits that is too long to display in a comfortable amount of time.  It would be nice if "empty" elements could be loaded on to the page that would fire ajax requests for the data as the user scrolled them into view.  There are some ways to do this but to me they are awkward and limited.

These two pairs could be merged into one pair without much loss of functionality.  To me, having them separate would be nicer.

Thank you,
Perry
Received on Wednesday, 5 May 2010 16:28:49 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:27 GMT