knadh / localStorageDB

A simple database layer for localStorage and sessionStorage for creating structured data in the form of databases and tables
http://nadh.in/code/localstoragedb
814 stars 128 forks source link

IE not working properly with the localstoragedb.js #4

Closed stanguturi closed 13 years ago

stanguturi commented 13 years ago

I use this jquery plugin in my web application: http://o.pckg.in/deals-crawler

Every browser properly works with this plugin. But IE doesn't work properly. IE throws few exception while parsing the script. When I checked the error console, I noticed that the following line is the culprit.

    // delete rows
    delete: function(table_name, query) {
        tableExistsWarn(table_name);

        var result_ids = [];
        if(!query) {
            result_ids = getIDs(table_name);
        } else if(typeof query == 'object') {

delete is a keyword. We should not ideally try to overload or expose a method with the name delete. I would prefer using another name like deleteQuery:

The above code should be changed to as follows:

    // delete rows
    deleteQuery: function(table_name, query) {
        tableExistsWarn(table_name);

        var result_ids = [];
        if(!query) {
            result_ids = getIDs(table_name);
        } else if(typeof query == 'object') {

After I made this change, it worked like charm.

-Thanks Sankar.

knadh commented 13 years ago

What version of IE did you have problems with? The lib works fine on IE9+.

Thanks

stanguturi commented 13 years ago

I tested with IE 8.