(#2497) - fix attachments in Chrome and IE

Yes, this is really what we have to do to get it to pass in IE. I'm sorry.
actually I was wrong

```js
if (begin < 0) {
    begin = Math.max(begin + len, 0);
} else {
     begin = Math.min(len, begin);
}
```