Skip to content

Commit e7592e1

Browse files
committed
Merge pull request #10 from jsdevel/adding-opts
fixing-text-appending-for-old-browsers
2 parents c8a2155 + 318ead6 commit e7592e1

2 files changed

Lines changed: 2 additions & 4 deletions

File tree

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module.exports = function load (src, opts, cb) {
2121
}
2222

2323
if (opts.text) {
24-
script.appendChild(document.createTextNode(opts.text))
24+
script.text = '' + opts.text
2525
}
2626

2727
var onend = 'onload' in script ? stdOnEnd : ieOnEnd

test/index.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,8 @@ test('opts.charset', function(done) {
4040
});
4141

4242
test('opts.text', function(done) {
43-
load('test/hello.js', {text: 'foo'}, function(err, script) {
43+
load('test/hello.js', {text: 'foo=5;'}, function(err, script) {
4444
assert.ifError(err);
45-
assert.equal(script.childNodes.length, 1);
46-
assert.equal(script.childNodes[0].nodeValue, 'foo');
4745
done();
4846
})
4947
});

0 commit comments

Comments
 (0)