I have to improve some really old and historic grown scripts with new
functions.
Some of them require to read out, store and remove the hard-coded
attribute "onChange" of some input elements to be able to prevent the
execution in some cases.
so far...
Example:
There is an element like this:
<input type="text" value="blubb" name="myElement" id="myElement"
onChange="someThingsToDoOnChange()" />
<script>
alert($('myElement').getProperty('onChange'));
</script>
If I read the attribute onChange in FF it works like I expect.
But in IE7 the value of my attribute onChange is grabbed by a function
called anonymus:
function anonymus()
{
someThingsToDoOnChange()
}
My workaround looks like this:
onchange = $('myElement').getProperty('onChange');
if(Browser.Engine.trident){
var stripfunction = /^function anonymous\(\)\n{\n(.*)\n}/m;
onchange = stripfunction.exec(onchange.toString())[1];
}
In IE8 this workaround throws an error: "'exec(...).1' is null or not
an object"
I can't verify this because on my PC is still IE7 installed.
Do you have an idea how to fix this?
Is there a chance that a future release of MT could remove this
function anonymus by itself?
Greetings from germany, Quest