MDL-10249 Created addonload JavaScript function that can be used to add onload handlers, instead of using <body onload> which breaks things.
This commit is contained in:
+3
-2
@@ -78,11 +78,12 @@ function inserttext(text) {
|
||||
if(($pos = strpos($focus, '.')) !== false) {
|
||||
//old style focus using form name - no allowed inXHTML Strict
|
||||
$topelement = substr($focus, 0, $pos);
|
||||
echo "function setfocus() { if(document.$topelement) document.$focus.focus(); }\n";
|
||||
echo "addonload(function() { if(document.$topelement) document.$focus.focus(); });\n";
|
||||
} else {
|
||||
//focus element with given id
|
||||
echo "function setfocus() { if(el = document.getElementById('$focus')) el.focus(); }\n";
|
||||
echo "addonload(function() { if(el = document.getElementById('$focus')) el.focus(); });\n";
|
||||
}
|
||||
$focus=false; // Prevent themes from adding it to body tag which breaks addonload(), MDL-10249
|
||||
} ?>
|
||||
|
||||
//]]>
|
||||
|
||||
Reference in New Issue
Block a user