IE8: Expected identifier, string or number

internet-explorer, internet-explorer-8, javascript

Solution

It doesn't like `class` since class is a future reserved word as define in ECMAScript2

Put `class` in quotes `"class"`

attributes: function() {
                return {
                    id: this.model.cid
                ,   "class": this.model.get("type")
                };
            }

Problem

I am getting an error `Expected identifier, string or number` in IE8 `referring to line 17 character 21` of the following code: ``` define( [ "underscore" , "Backbone" , "text!assetListingTemplate" ] , function(_, Backbone, template) { "use strict"; var tmpl = _.template(template); var AssetListing = Backbone.View.extend({ tagName: "li" , attributes: function() { return { id: this.model.cid , class: this.model.get("type") }; } , render: function() { this.el.innerHTML = tmpl(this.model.attributes); return this.el; } }); return AssetListing; } ); ``` Which is: ``` , class: this.model.get("type") ``` This error is usually due to a trailing coma in an `Object` or similar minor formatting issues that IE does not handle gracefully. Perhaps I have been staring at code for too long but I can't see any such issues here, I have even JSLinted it and it failed to find any issues except for not agreeing with my style. The error is not `this.model` either as it still occurs if I replace all instances of it for regular strings. Can any eagle eyes spot what is going wrong here?

Original source