I’ve been upgrading an RIA from dojo 1.1.1 to dojo 1.6.1, and spent a lot of time trying to find the cause of this error message:
t.apply is not a function
After many hours, I found it was related to the way the data-dojo-props event handlers were coded.
In the example below, onClick is specified as a function which calls another function.
XML:
<?xml version="1.0" encoding="utf-8" ?> | |
<!DOCTYPE html | |
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
<head> | |
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dijit/themes/claro/claro.css" /> | |
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.6.1/dojo/dojo.xd.js" type="text/javascript" | |
data-dojo-config="isDebug:true, parseOnLoad: true"></script> | |
<script type="text/javascript"> | |
function go(s) | |
{ | |
alert('go('+s+')'); | |
} | |
</script> | |
<script type="text/javascript"> | |
dojo.require('dojo.parser'); | |
dojo.require("dijit.form.Form"); | |
dojo.require("dijit.form.Button"); | |
</script> | |
</head> | |
<body class="claro"> | |
<h1>dojo dijit Button test</h1> | |
<button data-dojo-type="dijit.form.Button" | |
data-dojo-props="label:'Button',onClick:function(){go('4')}"></button> | |
</body> | |
</html> |