The DOM is not always fully loaded when the onload event occurs! That is why I want to change this to an onresize event. By then the page width should be in the DOM.
But, I’m confused!
I’ve read in a few places that onresize is not actually supported as part of the body tag even though most browsers do allow it. On the w3c site, on the DOM Body page is only shows onload as a legal body event, but it also states that “The body object also supports the standard properties, methods, and events.” One of which is onresize.
The window object does not even mention onresize.
When working with Komodo and TopStyle, onresize does not appear as a legal attribute of body.
The code that I have written is kicked off by <body onload=…>. On some pages this works fine, on other pages it fails to realize the correct page width because the page has not finished displaying and the DOM is not updated. My code also tests for window.onresize == null and then sets it to call the same script as body onload. That causes the script to re-run when the DOM is updated and all is OK.
So, why does onresize work as a window attribute when it isn’t even mentioned?
Is it truly supported by the body tag, then why doesn’t an editor like Komodo reference it?
Not following the specs might make it work on some browsers and not on others!
I love standards — there are so many to choose from !