From f829595fdd9e62b91251fc1cc2726367e558e1d4 Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Thu, 29 Aug 2013 12:01:01 -0700 Subject: [PATCH] better cross-browser onload handlers, fixes #24783 --- httemplate/elements/onload.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/httemplate/elements/onload.js b/httemplate/elements/onload.js index bfa7eef94..c7bbbb283 100644 --- a/httemplate/elements/onload.js +++ b/httemplate/elements/onload.js @@ -12,11 +12,12 @@ Usage: (function() { - var tmp = window.onload; - window.onload = function() { - if (typeof(tmp)== 'function') { - tmp(); - } + var myonload = function() { <% $m->content %> - }; + } + if ( window.addEventListener ) { + window.addEventListener('load', myonload); + } else if ( window.attachEvent ) { + window.attachEvent('onload', myonload); + } })(); -- 2.11.0