From 89e9b4104f8138e330c071534c29a223e86805e5 Mon Sep 17 00:00:00 2001 From: "Olli.Pettay%helsinki.fi" Date: Mon, 12 Nov 2007 12:45:40 +0000 Subject: [PATCH] Bug 402680, document.activeElement returns wrong node, r+sr=bz, a=mtschrep git-svn-id: svn://10.0.0.236/trunk@239201 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/base/src/nsDocument.cpp | 4 +- .../content/html/document/test/Makefile.in | 1 + .../html/document/test/test_bug402680.html | 51 +++++++++++++++++++ 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 mozilla/content/html/document/test/test_bug402680.html diff --git a/mozilla/content/base/src/nsDocument.cpp b/mozilla/content/base/src/nsDocument.cpp index d0f911f9412..673b6cd3d45 100644 --- a/mozilla/content/base/src/nsDocument.cpp +++ b/mozilla/content/base/src/nsDocument.cpp @@ -1644,8 +1644,10 @@ nsDocument::GetActiveElement(nsIDOMElement **aElement) if (bodyElement) { *aElement = bodyElement; NS_ADDREF(*aElement); - return NS_OK; } + // Because of IE compatibility, return null when html document doesn't have + // a body. + return NS_OK; } // If we couldn't get a BODY, return the root element. diff --git a/mozilla/content/html/document/test/Makefile.in b/mozilla/content/html/document/test/Makefile.in index ddf99433910..5e238e54567 100644 --- a/mozilla/content/html/document/test/Makefile.in +++ b/mozilla/content/html/document/test/Makefile.in @@ -62,6 +62,7 @@ _TEST_FILES = test_bug1682.html \ test_bug380383.html \ test_bug386495.html \ test_bug391777.html \ + test_bug402680.html \ test_form-parsing.html \ $(NULL) diff --git a/mozilla/content/html/document/test/test_bug402680.html b/mozilla/content/html/document/test/test_bug402680.html new file mode 100644 index 00000000000..1b561dd4c8f --- /dev/null +++ b/mozilla/content/html/document/test/test_bug402680.html @@ -0,0 +1,51 @@ + + + + + Test for Bug 402680 + + + + + + +Mozilla Bug 402680 +

+
+ + +
+
+
+
+ + +