Chrome not recognizing function arguments correctly

I have wrote some cross browser code for adding event listeners, then chrome started being funky, anyone know why this is happening?

Add Event listener code:

function addEventListener(Elm,Type,Func)
{
    if(Elm.attachEvent)
        Elm.attachEvent((Type.substr(0,2) == 'on' ? Type : 'on'+Type),Func);
    else
        Elm.addEventListener(Type,Func);
}

Code calling the method:

addEventListener(window,'load',SetSize);
addEventListener(window,'resize',SetSize);

Error:

Uncaught TypeError: Object load has no method 'addEventListener' 

You can very clearly see that I have passed the arguments in the correct order yet they are not interpreted in said order..

Answers


You have overwritten window.addEventListener.

The native signature is: event_name, callback but yours is: object, event_name, callback.

Change the name of your function addEventListener or namespace it, like my_framework.addEventListener


Need Your Help

how to plot markers for same addresses but different suites in google map

jquery google-maps marker

I know it doesn't make a lot of sense, but I have a map that plots all the addresses but there are places that share addresses like there is a Doctor's office in the suite 13 and a medical lab in s...

Adding clients to a list in Erlang

functional-programming erlang tuples

so I am writing a basic server that clients can connect to. I'm testing it with telnet, but my issue is how I store my clients in a list, so I could then print out who is connected to the server. I...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.