rendrjs / rendr

Render your Backbone.js apps on the client and the server, using Node.js.
MIT License
4.09k stars 312 forks source link

issue on IE browser rendr app : Undefined modelName for model #415

Open a10101992 opened 9 years ago

a10101992 commented 9 years ago

I have used rendr app . But it is not working IE browser as i include

<!--[if lte IE 9]>

 <script src="http://code.jquery.com/jquery-1.9.0.js"></script>
  <script src="http://code.jquery.com/jquery-migrate-1.2.1.js"></script>

<![endif]-->

<!--[if !IE]> -->

<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>

as well as this one also https://github.com/es-shims/es5-shim

And I am facing following issue IE browser : Undefined modelName for model

here is code for issue is coming up .

ModelStore.prototype = Object.create(Super.prototype); ModelStore.prototype.constructor = ModelStore;

ModelStore.prototype.set = function(model) { var existingAttrs, id, key, modelName, newAttrs;

id = model.get(model.idAttribute); modelName = this.modelUtils.modelName(model.constructor); if (modelName == null) { throw new Error('Undefined modelName for model'); }

mikepuerto commented 9 years ago

the issue here is that when modelName is returned as an empty string, IE doesn't see it as a string, it is undefined. We monkey patched it so that f (modelName == null) { used a strict check, f (modelName === null) {

Eiryyy commented 8 years ago

modelUtils.modelName is below.

ModelUtils.prototype.modelName = function(modelOrCollectionClass) {
  return this.underscorize(modelOrCollectionClass.id || modelOrCollectionClass.name);
};

But Function.prototype.name is unsupported by IE. (ES2015 standard), should be fixed.