blob: 4dd3e9cb176d80391d478d5054d52e7e937c029a [file] [log] [blame]
This test checks the behavior of the intersectsNode() method on the Range object.
It covers all configurations of the node/Range relationship and some exception conditions.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
1.1 Node starts before the range and ends before the range
PASS intersects is false
1.2 Node starts before the range, and range ends on a 1
PASS intersects is true
1.3 Node starts before the range and ends within the range
PASS intersects is true
1.4 Range starts on 0, and node starts before range and ends in range
PASS intersects is true
1.5 Node starts and ends in range
PASS intersects is true
1.6 Node starts in the range, and the range ends on 1
PASS intersects is true
1.7 Node starts in the range, and ends after the range
PASS intersects is true
1.8 Range start on 1, node starts in range and ends after
PASS intersects is true
1.9 Node starts on range start and ends on range end
PASS intersects is true
1.10 Node starts after range end and ends after range end
PASS intersects is false
1.11 Node starts before range start and ends after range end
PASS intersects is true
1.12 Node starts before range start and range begins and ends on 1
PASS intersects is true
1.13 Range starts at 0 and ends at 1
PASS intersects is true
2.1 Detached Range, attached node
PASS detachedRange.intersectsNode(document.getElementById('a1')) is false
2.2 attached range, detached node
PASS intersects is false
2.3 Node has no parent
PASS intersects is true
2.4 Range has no parent
PASS range.selectNode(document) threw exception InvalidNodeTypeError: Failed to execute 'selectNode' on 'Range': the given Node has no parent..
2.5 Wrong documents
PASS intersects is false
2.6 Node deleted
PASS range.intersectsNode(node) threw exception TypeError: Failed to execute 'intersectsNode' on 'Range': parameter 1 is not of type 'Node'..
PASS successfullyParsed is true
TEST COMPLETE