I am currently utilizing Crystal Reports within ASP.NET webforms to display some report files. The framework produces javascript for the UI functionality.
If I modify the array prototype in any way, the script mentioned above throws 2 errors. These errors are displayed in Firebug and seem like this:
TypeError: E[D].getHTML is not a function
...conWidget("iconMenu_icon_"+C,B,IconMenuWidget_iconClickCB,K,F,J,G,P,L,A,N,false)...
TypeError: A.layer is null
...conWidget("iconMenu_icon_"+C,B,IconMenuWidget_iconClickCB,K,F,J,G,P,L,A,N,false)...
An example of how these errors can appear is by adding:
if(!Array.prototype.somethingVeryUnique) {
Array.prototype.somethingVeryUnique = function () {
return this.length;
};
}
Why does modifying the array prototype interfere with the auto-generated file?
Update:
Object.defineProperty(Array.prototype, "somethingUnique", {
enumerable: false,
writable: true,
value: function () {
}
});
Making it non-enumerable resolves the issue. However, since object.defineProperty
doesn't work in IE7, which requires support, is there another method to create a non-enumerable property?