0

onload event no longer works for images

Sometime during the last month, it seems, the onload event stopped working for images. Will it be back, or was its removal intentional?

CODE
stdin:stdin:1018: 			<img src="..." onload="...">
^^^^^^
WARNING: stdin:stdin:1018+55 - 61: removing unknown attribute onload on img

This is actually how we were using it in our app before, with success:

CODE
  if (el.addEventListener) {
el.addEventListener("load", fn, false);
} else if (el.attachEvent) {
el.attachEvent("load", fn);
}

by
2 Replies
  • As far as I know there was, and should be, no reason for the removal of that functionality since this is a standard event tag for images as well. I'll take a look at it in the morning to verify and then file a bug with a few others I have to file in the morning.

    Thanks for reporting this,
    Jon

    QUOTE (Jared @ Sep 2 2009, 10:51 AM) <{POST_SNAPBACK}>
    Sometime during the last month, it seems, the onload event stopped working for images. Will it be back, or was its removal intentional?

    CODE
    stdin:stdin:1018: 			<img src="..." onload="...">
    ^^^^^^
    WARNING: stdin:stdin:1018+55 - 61: removing unknown attribute onload on img

    This is actually how we were using it in our app before, with success:

    CODE
      if (el.addEventListener) {
    el.addEventListener("load", fn, false);
    } else if (el.attachEvent) {
    el.attachEvent("load", fn);
    }
    0
  • Alright here's what I've found out after researching. I've verified that this message comes up when attaching it to an image - I'm not sure why it was removed if it was working before. Now the question is whether it is a bug or an enhancement request.

    I took a look at the HTML 4.01 W3C standards for the img tag and it looks like onload is HTML5 supported, but not HTML 4.01: http://www.w3.org/TR/REC-html40/struct/objects.html#edef-IMG

    After seeing a few forum posts about similar issues, it appears that onload is a body supported tag in HTML 4: http://lists.w3.org/Archives/Public/www-va...08Sep/0071.html

    Now, this doesn't mean that we won't support it. I'm going to file an enhancement request for the inclusion of onload for images and then follow up with the caja engineering team to see what our plans are for HTML 5 support.

    - Jon
    0
  • QUOTE (Jon @ Sep 2 2009, 07:21 PM) <{POST_SNAPBACK}>
    As far as I know there was, and should be, no reason for the removal of that functionality since this is a standard event tag for images as well. I'll take a look at it in the morning to verify and then file a bug with a few others I have to file in the morning.

    Thanks for reporting this,
    Jon

    Jared thank you for reporting this because I was looking for that link and could not find it. Jon do you know when the link will be fixed? If so please reply to tell me what link I should consider using. Thank You

    -Savon White
    0
  • Hi Savon,

    The bug I added to the system has been repaired by the caja folks so support for onload in images will roll out in the next platform release. I don't have a hard date on that but as soon as it happens there will be a post to the forum here to announce it.

    - Jon
    0
  • Thanks Jon!

    You're right, "onload" was not defined for images in the official HTML 4.01 spec, but all major browsers have supported it for years. Glad it will soon be back in YAP.
    0
  • If there are any other HTML 5 implementations that you come across which are not supported just let me know and I'll file an enhancement request for them. I spoke with the caja team and they are fully on board for supporting the new spec.

    - Jon
    0

Recent Posts

in YAP