(#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.
this can be simplified as

```js
if (begin < 0) {
    begin = Math.max(begin, 0);
} else {
     begin = Math.min(arrayBuffer.byteLength, begin);
}
```

same for end, this gets rid of the need for lines 40 and 41