#1588 native function name "elem" in combi with javascript causes problem

jessevdam Tue 26 Jul 2011

I have this definition in a class, which is sub classed from Pane

native Elem? elem(Str id)

with the corresponding js function

fan.svg.SvgPanePeer.prototype.getElem = function(self, id)
{
  var elem = this.rootElem.getElementById(id);
  if (elem == null) 
  	  return null;
  return fan.dom.ElemPeer.make(elem);
}  

But trying to run this something weird happens, renaming the function to getElem solves my problems. For some weird reason is no problem for dom::Doc but for my class it is, so I do not exactly what is going on here, but it seems that the function name elem is somehow reserved in javascript.

andy Tue 26 Jul 2011

Make sure you aren't using any other properties called elem in fan.svg.SvgPanePeer - otherwise you will overwrite the function with a variable for example.

Login or Signup to reply.