I am trying to wrap a HTMLElement to create a Ext.Element but this mysteriously overrides the Ext.id function with some ID and makes ExtJs unusable after that point
I have tried to make this simple example illustrating the problem though I had to dig thru lot of code in original app to find this subtle bug e.g. try this code online http://jsfiddle.net/rdudW/1/ or use this
<html>
<head>
<script type="text/javascript" src="adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext-all.js"></script>
<script>
Ext.onReady(function(){
alert(Ext.id)
var elem = Ext.Element(document.getElementsByTagName('table')[0])
alert(Ext.id)
});
</script>
</head>
<body>
<table><table>
</body>
</html>
Before calling Ext.Element alert show function definition but after that a id ‘ext-gen2’
Note: I know i should be using new Ext.Element but that is not the question, question is why this happens with this simple probable mistake?
I’ve skimmed over the source, and there are a few functons, that if called in wrong scope would override
Ext.id. The omission ofnewis probably doing just that. One of these functions is called in context ofExtobject instad ofElementbeing created.See this:
If you call this with
newthenthisrefers to newly created object. If you call this directly,thisrefers toExt