<!DOCTYPE html>
<html>
    <head>
        <script src="../../resources/js-test-pre.js"></script>
    </head>
    <body>
        <p>
            This tests the behavior of Range::isPointInRange when the point and
            the range are in different documents.
        </p>
        
        <script>
            var docType = document.implementation.createDocumentType ('html', '', '');
            var doc = document.implementation.createDocument('', 'html', docType);
            var body = document.createElement('body');  
            doc.documentElement.appendChild(body);
            var testContainer = document.createElement('span');
            testContainer.appendChild(document.createTextNode('Test container'));
            body.appendChild(testContainer);

            var range = document.createRange();
            range.selectNode(testContainer);
            var testNode = document.createElement('p');
            testNode.appendChild(document.createTextNode('Test node'));
            document.body.appendChild(testNode);

            try {
                shouldBeFalse("range.isPointInRange(testNode, 1)");
            }
            catch (error) {
                testFailed('isPointInRange throw an exception of type ' + error.code + '.');
            }

            document.body.removeChild(testNode);
        </script>
    </body>
</html>
