javascript - IE8 Object doesn't support property or method 'on' - object.listenTo - (Backbone.js) -
having issues ie8 compatibility javascript code cannot seem run down. code works fine in ie9+, chrome , ff. have backbone.js collection listening series of other backbone collections changes in models. ie 8 giving error when applying event listeners. code is;
for(var k in this.referencetables){ this.listento(this.referencetables[k], 'change', this.fetch); } and ie8 (note: ie10 in ie8 browser mode, document mode ie8 standards) returning in console error object doesn't support property or method 'on' @ line 2 of above code.
the above code block in initialize function of backbone collection.extend.
this.referencetables assigned in initialize function
this.referencetables = options.referencetables // options.referencetables array of backbone collections i bit stumped ideas appreciated!
for...in iterating on enumerable properties of object, if want iterate on values in array, referencetables is, should use normal for loop.
for(var k = 0; k < this.referencetables.length; k++){ the problem for...in loop picking other things array object not array items, , aren't models.
if stick console.log(k) in there, see isn't 0...n.
Comments
Post a Comment