summaryrefslogtreecommitdiff
path: root/Source/WebCore/dom/Range.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/dom/Range.cpp')
-rw-r--r--Source/WebCore/dom/Range.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/Source/WebCore/dom/Range.cpp b/Source/WebCore/dom/Range.cpp
index 298220e4a..9b569b3e0 100644
--- a/Source/WebCore/dom/Range.cpp
+++ b/Source/WebCore/dom/Range.cpp
@@ -589,14 +589,17 @@ bool Range::intersectsNode(Node* refNode, ExceptionCode& ec)
// http://developer.mozilla.org/en/docs/DOM:range.intersectsNode
// Returns a bool if the node intersects the range.
+ // Throw exception if the range is already detached.
+ if (!m_start.container()) {
+ ec = INVALID_STATE_ERR;
+ return false;
+ }
if (!refNode) {
ec = NOT_FOUND_ERR;
return false;
}
-
- if ((!m_start.container() && refNode->attached())
- || (m_start.container() && !refNode->attached())
- || refNode->document() != m_ownerDocument) {
+
+ if (!refNode->attached() || refNode->document() != m_ownerDocument) {
// Firefox doesn't throw an exception for these cases; it returns false.
return false;
}