Skip to content
This repository was archived by the owner on Mar 13, 2018. It is now read-only.

Commit 061ea8b

Browse files
author
Steve Orvell
committed
Merge pull request #334 from sorvell/master
Fix insertBefore on IE and minor test issue with new Option; merge based on previous LGTM.
2 parents 4734f19 + 22440b2 commit 061ea8b

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

src/wrappers/Node.js

+1
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@
306306
}
307307
} else {
308308
refWrapper = null;
309+
refNode = null;
309310
}
310311

311312
refWrapper && assert(refWrapper.parentNode === this);

test/js/HTMLOptionElement.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ suite('HTMLOptionElement', function() {
3838

3939
var option = new Option(' more text ');
4040
assert.equal(option.text, 'more text');
41-
assert.equal(option.value, 'more text');
41+
// on IE10, the value includes the surrounding spaces; trim to workaround
42+
assert.equal(option.value.trim(), 'more text');
4243
assert.isFalse(option.defaultSelected);
4344
assert.isFalse(option.selected);
4445

test/js/Node.js

+14
Original file line numberDiff line numberDiff line change
@@ -290,4 +290,18 @@ suite('Node', function() {
290290
assert.equal(unwrap(clone).innerHTML, '<a></a>');
291291
});
292292

293+
test('insertBefore', function() {
294+
var parent = document.createElement('div');
295+
var c1 = document.createElement('div');
296+
var c2 = document.createElement('div');
297+
var c3 = document.createElement('div');
298+
parent.insertBefore(c3);
299+
parent.insertBefore(c2, c3);
300+
parent.insertBefore(c1, c2);
301+
302+
assert.equal(parent.firstChild, c1);
303+
assert.equal(c1.nextElementSibling, c2);
304+
assert.equal(c2.nextElementSibling, c3);
305+
});
306+
293307
});

0 commit comments

Comments
 (0)