codebrew / backbone-rails

Easily use backbone.js with rails 3.1
MIT License
1.61k stars 255 forks source link

datalink causing security error: 1000 in Firefox #95

Open ehtb opened 12 years ago

ehtb commented 12 years ago

When loading a template with a file input in Firefox, the browser throws a security error 1000 after a file is selected for the first time.

When a file is selected a second time, the error isn't thrown.

The error is thrown because of line 9: return el.val(model.get(name));

– the cause is reading the value of a fileinput field. The easiest fix right now is to catch the error, since it seems to happen only in firefox and only on the first attempt.

try {
    return el.val(model.get(name));
}
catch(e) {}

Not really a fix, but a good workaround.