flatiron / plates

Light-weight, logic-less, DSL-free, templates for all javascript environments!
MIT License
831 stars 69 forks source link

Improve IE 8/7 compatibility #57

Closed robertothais closed 12 years ago

robertothais commented 12 years ago

If plates.js is minified and variable names rewritten, IE 8 and below run into issues when instantiating a Mapper. It seems that if the variable that holds the constructor (re-written) and the constructor name itself differ, the methods in the prototype don't get copied into the instance. Solved by not using the function declaration style.

Using string.charAt(i) instead of string[i] seems to help quite a bit in improving compatibility with IE 7. The semantics of the bracket notation and charAt should be identical in browsers that support brackets. The performance of both is comparable, except for Firefox 9+ where charAt is substantially faster.

http://jsperf.com/string-charat-vs-bracket-notation

No9 commented 12 years ago

This works for me Internet Explorer 8.0.7601.17514 and Firefox 12.0 windows

No9 commented 12 years ago

After further testing
map.class('name').to('username'); Fails in IE as class is seen as a reserved word. This is a separate issue but maybe it should be discussed as part of this IE8 Patch?