Opened 10 years ago

Closed 10 years ago

#10575 closed task (invalid)

_d.getElementsByTagName is not a function

Reported by: Ran Mory Owned by:
Priority: high Milestone: tbd
Component: Dijit Version: 1.3.2
Keywords: Cc:
Blocked By: Blocking:

Description

I have this class Dojo below:

dojo.declare(
        "MaClass",
        [dijit._Widget, dijit._Templated],
        {
        	templateString:'Salut Zineb !',
        	constructor: function (params, node) {
        		console.log('mon objet a ete instancie *');
        		console.log('dom node', node);
        	}
        }
	);

and that's the instantiation of the class :

<script type="text/javascript">
dojo.addOnLoad(function () {
	var monObjet = new MaClass({
        } 
    ,dojo.byId('boite')
    );
	console.log('objet : ',monObjet);
	
});
</script>

the execution show me all the console.log of my constructor,then it gives this error :

Erreur*: _d.getElementsByTagName is not a function
Fichier Source*: <a href="http://localhost/MyWorkspace/Test/dojo/dojo/dojo.js" target="_blank">http://localhost/MyWorkspace/Test/dojo/dojo/dojo.js</a>
Ligne*: 71

so where does this error come from? knowing that if my Class inherit only from dijit._Widget,without using the templateString it doesn't show the error ?

Change History (1)

comment:1 Changed 10 years ago by James Burke

Resolution: invalid
Status: newclosed

All dijit templates must contain a top-level element for them to work, so changing the templateString to:

templateString: '<span>Salut Zineb !</span>'

should fix the problem.

Note: See TracTickets for help on using tickets.