зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1354211 - Consider <optgroup> when finding container element. r=automatedtester
It is a bug in element.getContainer that <optgroup> is not considered when locating the containing context element, <select>. <optgroup> is also a child element of <select> on the same level as <option>. MozReview-Commit-ID: 2GJJrRuY5Th --HG-- extra : rebase_source : 2bfabe6f79bc0d6d473657ef34cded04c51857a3
This commit is contained in:
Родитель
26be8043ca
Коммит
27edd882b6
|
@ -847,10 +847,9 @@ element.inViewport = function(el, x = undefined, y = undefined) {
|
||||||
* Element to get the container of.
|
* Element to get the container of.
|
||||||
*
|
*
|
||||||
* @return {Element}
|
* @return {Element}
|
||||||
* Container element of |el|.
|
* Container element of <var>el</var>.
|
||||||
*/
|
*/
|
||||||
element.getContainer = function(el) {
|
element.getContainer = function(el) {
|
||||||
|
|
||||||
function findAncestralElement(startNode, validAncestors) {
|
function findAncestralElement(startNode, validAncestors) {
|
||||||
let node = startNode;
|
let node = startNode;
|
||||||
while (node.parentNode) {
|
while (node.parentNode) {
|
||||||
|
@ -859,13 +858,12 @@ element.getContainer = function(el) {
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return startNode;
|
return startNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Does <option> have a valid context,
|
// Does <option> or <optgroup> have a valid context,
|
||||||
// meaning is it a child of <datalist> or <select>?
|
// meaning is it a child of <datalist> or <select>?
|
||||||
if (el.localName === "option") {
|
if (["option", "optgroup"].includes(el.localName)) {
|
||||||
return findAncestralElement(el, ["datalist", "select"]);
|
return findAncestralElement(el, ["datalist", "select"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче