Bug 1250401 - HTMLOptionElement::GetSelect should not return an element if we have nested OptGroup elements, r=bz
This commit is contained in:
@@ -354,19 +354,17 @@ HTMLOptionElement::IntrinsicState() const
|
||||
HTMLSelectElement*
|
||||
HTMLOptionElement::GetSelect()
|
||||
{
|
||||
nsIContent* parent = this;
|
||||
while ((parent = parent->GetParent()) &&
|
||||
parent->IsHTMLElement()) {
|
||||
HTMLSelectElement* select = HTMLSelectElement::FromContent(parent);
|
||||
if (select) {
|
||||
return select;
|
||||
}
|
||||
if (!parent->IsHTMLElement(nsGkAtoms::optgroup)) {
|
||||
break;
|
||||
}
|
||||
nsIContent* parent = GetParent();
|
||||
HTMLSelectElement* select = HTMLSelectElement::FromContentOrNull(parent);
|
||||
if (select) {
|
||||
return select;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
if (!parent->IsHTMLElement(nsGkAtoms::optgroup)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return HTMLSelectElement::FromContentOrNull(parent->GetParent());
|
||||
}
|
||||
|
||||
already_AddRefed<HTMLOptionElement>
|
||||
|
||||
Reference in New Issue
Block a user