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

Commit

Permalink
Merge pull request #308 from arv/range-wrapper
Browse files Browse the repository at this point in the history
Fix issue with WebIDL attributes on Range
  • Loading branch information
dfreedm committed Nov 13, 2013
2 parents 049f71a + 57cb343 commit 532abac
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion shadowdom.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@
'src/wrappers/HTMLUnknownElement.js',
'src/wrappers/CanvasRenderingContext2D.js',
'src/wrappers/WebGLRenderingContext.js',
'src/wrappers/Range.js',
'src/wrappers/generic.js',
'src/wrappers/ShadowRoot.js',
'src/ShadowRenderer.js',
'src/wrappers/elements-with-form-property.js',
'src/wrappers/Document.js',
'src/wrappers/Window.js',
'src/wrappers/Range.js',
'src/wrappers/override-constructors.js'
].forEach(function(src) {
document.write('<script src="' + base + src + '"></script>');
Expand Down
2 changes: 1 addition & 1 deletion src/wrappers/Range.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
};
}

registerWrapper(window.Range, Range);
registerWrapper(window.Range, Range, document.createRange());

scope.wrappers.Range = Range;

Expand Down
22 changes: 22 additions & 0 deletions test/js/Range.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,26 @@ suite('Range', function() {
assert.equal(fragment.childNodes.length, 1);
});

test('WebIDL attributes', function() {
var range = document.createRange();

assert.isTrue('collapsed' in range);
assert.isFalse(range.hasOwnProperty('collapsed'));

assert.isTrue('commonAncestorContainer' in range);
assert.isFalse(range.hasOwnProperty('commonAncestorContainer'));

assert.isTrue('endContainer' in range);
assert.isFalse(range.hasOwnProperty('endContainer'));

assert.isTrue('endOffset' in range);
assert.isFalse(range.hasOwnProperty('endOffset'));

assert.isTrue('startContainer' in range);
assert.isFalse(range.hasOwnProperty('startContainer'));

assert.isTrue('startOffset' in range);
assert.isFalse(range.hasOwnProperty('startOffset'));
});

});

0 comments on commit 532abac

Please sign in to comment.