diff --git a/shadowdom.js b/shadowdom.js index 3808328..e07d7b8 100644 --- a/shadowdom.js +++ b/shadowdom.js @@ -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(''); diff --git a/src/wrappers/Range.js b/src/wrappers/Range.js index 6de7971..bcf1de3 100644 --- a/src/wrappers/Range.js +++ b/src/wrappers/Range.js @@ -85,7 +85,7 @@ }; } - registerWrapper(window.Range, Range); + registerWrapper(window.Range, Range, document.createRange()); scope.wrappers.Range = Range; diff --git a/test/js/Range.js b/test/js/Range.js index 7a2a301..23d0b49 100644 --- a/test/js/Range.js +++ b/test/js/Range.js @@ -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')); + }); + });