зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1253591. HTMLAllCollection should be rooted at the document, not the root element, so it can find the root element. r=peterv
This commit is contained in:
Родитель
3c61c287f2
Коммит
d29c2409f0
|
@ -114,14 +114,9 @@ HTMLAllCollection::GetDocumentAllList(const nsAString& aID)
|
|||
return docAllList;
|
||||
}
|
||||
|
||||
Element* root = mDocument->GetRootElement();
|
||||
if (!root) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAtom> id = do_GetAtom(aID);
|
||||
RefPtr<nsContentList> docAllList =
|
||||
new nsContentList(root, DocAllResultMatch, nullptr, nullptr, true, id);
|
||||
new nsContentList(mDocument, DocAllResultMatch, nullptr, nullptr, true, id);
|
||||
mNamedMap.Put(aID, docAllList);
|
||||
return docAllList;
|
||||
}
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
[htmlallcollection.html]
|
||||
type: testharness
|
||||
[Test for multiple occurence 3 <script> found]
|
||||
expected: FAIL
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<html id="root">
|
||||
<head>
|
||||
<title>HTMLAllCollection Tests</title>
|
||||
<link rel="author" title="Dan Druta" href="mailto:dan.druta@att.com"/>
|
||||
|
@ -11,8 +11,10 @@
|
|||
</head>
|
||||
<body id="tags">
|
||||
<img src="../../../../images/green.png" name="picture">
|
||||
<a name="foo"></a>
|
||||
<a name="foo"></a>
|
||||
<script>
|
||||
test(function(){ assert_equals(document.all.length,12)}, "Test for HTMLAllCollection size");
|
||||
test(function(){ assert_equals(document.all.length,14)}, "Test for HTMLAllCollection size");
|
||||
|
||||
test(function(){ assert_equals(document.all.item(0).tagName,"HTML")}, "Test lookup by index using ()");
|
||||
|
||||
|
@ -29,6 +31,16 @@ test(function(){ assert_equals(document.all["picture"].nodeName,"IMG")}, "Test l
|
|||
test(function(){ assert_equals(document.all.picture.nodeName,"IMG")}, "Test lookup IMG in collection using .");
|
||||
|
||||
test(function(){ assert_equals(document.all.tags.id,"tags")}, "Test lookup tags in collection using .");
|
||||
|
||||
test(function() {
|
||||
assert_equals(document.all["root"], document.documentElement);
|
||||
}, "Should find root element too");
|
||||
|
||||
test(function() {
|
||||
assert_equals(document.all["foo"].length, 2);
|
||||
}, "Should find both anchors and produce a list");
|
||||
|
||||
test
|
||||
</script>
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
|
|
Загрузка…
Ссылка в новой задаче