Bug 1461321 - input.list should work in shadow DOM, r=peterv

This commit is contained in:
Olli Pettay
2018-05-24 22:46:11 +03:00
parent 87c48987ce
commit 3627dc8f11
5 changed files with 55 additions and 6 deletions

View File

@@ -11,6 +11,7 @@
#include "mozilla/DebugOnly.h"
#include "mozilla/dom/Date.h"
#include "mozilla/dom/Directory.h"
#include "mozilla/dom/DocumentOrShadowRoot.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/dom/HTMLFormSubmission.h"
#include "mozilla/dom/FileSystemUtils.h"
@@ -1717,13 +1718,12 @@ HTMLInputElement::GetList() const
return nullptr;
}
//XXXsmaug How should this all work in case input element is in Shadow DOM.
nsIDocument* doc = GetUncomposedDoc();
if (!doc) {
DocumentOrShadowRoot* docOrShadow = GetUncomposedDocOrConnectedShadowRoot();
if (!docOrShadow) {
return nullptr;
}
Element* element = doc->GetElementById(dataListId);
Element* element = docOrShadow->GetElementById(dataListId);
if (!element || !element->IsHTMLElement(nsGkAtoms::datalist)) {
return nullptr;
}