safari – Browser deletes leading tab characters on each line when writing to child document

I am using Javascript to write data in the form of nested arrays to another text document or browser window.

function makeOutput() {
    var out = ();
    out.push('<pre>');
    for (var chapCt = 0; chapCt < changedChaps.length; chapCt++) {
        var chapNum = changedChaps(chapCt);
        out.push('var chapter');
        out.push(chapNum);
        out.push(' =n');
        // here is where the nested arrays are added to out
        out.push(makeSxnOutput(allRules(chapNum - 1), 0, out));
        if (chapCt < changedChaps.length - 1) {
            out.push('nnn');
        }
    } // for each chapter
    out.push(';nn</pre>');
    var childWindow = window.open();
    childWindow.document.write(out.join(''));
    childWindow.focus();
} // makeOutput()

I want the output to look something like this:

(   'Text level 1',
    (   'Text level 2',
        (   'Text level 3'
        ),
        (   'More text level 3',
        )
    )
)

What it appears as is this:

(   'Text level 1',
(   'Text level 2',
(   'Text level 3'
),
(   'More text level 3',
)
)
)

which is much less readable! All the leading tab characters are deleted, although tab characters that follow non-whitespace characters are not deleted. (I should mention, I output

 and 

at the beginning and the end of the child document.) I tried outputting the tab characters as t and , but I did not see any difference. I’m using the latest version of Safari for Mac.

Any suggestions? Is the problem browser-specific? Is there a Javascript method that would tell the browser to output the leading tab characters?