[whatwg] onshow event

Perry Smith pedzsan at gmail.com
Tue May 4 19:06:03 PDT 2010

I see in the html5 spec an 'onshow' event but no text describing when the 'show' event is triggered.

I've poked at FF 3.5 and Opera and can not get it to fire.  But I may be completely confused on when it should fire.

It would be wonderful if an element had an event that would fire when that particular element is shown on the page.  This might be due to the display attribute changing or it might be due to it scrolling into view.  "onshow" appeared to be the closest match to this.

The case I'm trying to do is write a dodad which needs to be initialized but if I call the initialization method while it is hidden, the height and width come back 0 and the code doesn't work.  I could add a hook into the parent to call the init when the parent decides to show the element but it would be nicer if I didn't have to do that.  It would be nice if the element "knew" it was time to initialize itself based upon it being shown on the page.

Also, I can't temporarily change the elements display attribute because its display is not the one that is hiding it.  It is actually hidden (initially) but two of its parents.

It seems like this would be a fairly frequent desire.  Perhaps there is already an idiom for this.

Thank you,

More information about the whatwg mailing list