Skip to content

Commit d9a0288

Browse files
committed
Merge pull request #59 from badosu/master
Support webkitSlice if slice is not available
2 parents 461469c + b5a4ece commit d9a0288

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

jquery.parse.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,15 @@
196196
{
197197
if (start < file.size)
198198
{
199-
reader.readAsText(file.slice(start, Math.min(start + settings.chunkSize, file.size)), settings.config.encoding);
199+
var end = Math.min(start + settings.chunkSize, file.size);
200+
201+
if (file.slice) {
202+
reader.readAsText(file.slice(start, end), settings.config.encoding);
203+
}
204+
else if (file.webkitSlice) {
205+
reader.readAsText(file.webkitSlice(start, end), settings.config.encoding);
206+
}
207+
200208
start += settings.chunkSize;
201209
}
202210
};

0 commit comments

Comments
 (0)