browser cleanup

utils should not be leaked
This commit is contained in:
SheetJS 2013-11-09 13:14:57 -08:00
parent 0b642080bf
commit 2cdd09f801
2 changed files with 7 additions and 5 deletions

@ -1 +1,3 @@
test_files/
tests/files/
index.html

10
xlsx.js

@ -672,7 +672,7 @@ function parseCT(data) {
if(!data) return data;
var ct = { workbooks: [], sheets: [], calcchains: [], themes: [], styles: [],
coreprops: [], extprops: [], strs:[], xmlns: "" };
data.match(/<[^>]*>/g).forEach(function(x) {
(data.match(/<[^>]*>/g)||[]).forEach(function(x) {
var y = parsexmltag(x);
switch(y[0]) {
case '<?xml': break;
@ -1043,11 +1043,11 @@ function sheet_to_csv(sheet) {
};
var out = "";
if(sheet["!ref"]) {
var r = utils.decode_range(sheet["!ref"]);
var r = XLSX.utils.decode_range(sheet["!ref"]);
for(var R = r.s.r; R <= r.e.r; ++R) {
var row = [];
for(var C = r.s.c; C <= r.e.c; ++C) {
var val = sheet[utils.encode_cell({c:C,r:R})];
var val = sheet[XLSX.utils.encode_cell({c:C,r:R})];
row.push(val ? stringify(val).replace(/\\r\\n/g,"\n").replace(/\\t/g,"\t").replace(/\\\\/g,"\\").replace("\\\"","\"\"") : "");
}
out += row.join(",") + "\n";
@ -1070,7 +1070,7 @@ function get_formulae(ws) {
return cmds;
}
var utils = {
XLSX.utils = {
encode_col: encode_col,
encode_row: encode_row,
encode_cell: encode_cell,
@ -1089,7 +1089,7 @@ var utils = {
if(typeof require !== 'undefined' && typeof exports !== 'undefined') {
exports.read = XLSX.read;
exports.readFile = XLSX.readFile;
exports.utils = utils;
exports.utils = XLSX.utils;
exports.main = function(args) {
var zip = XLSX.read(args[0], {type:'file'});
console.log(zip.Sheets);