diff -u b/core/modules/quickedit/js/quickedit.es6.js b/core/modules/quickedit/js/quickedit.es6.js --- b/core/modules/quickedit/js/quickedit.es6.js +++ b/core/modules/quickedit/js/quickedit.es6.js @@ -359,7 +359,10 @@ // [data-quickedit-entity-id] element's data-quickedit-entity-instance-id // attribute. const entityElementSelector = `[data-quickedit-entity-id="${entityID}"]`; - const $entityElement = $(fieldElement).closest(entityElementSelector); + + // const entityElementSelector = `[data-quickedit-entity-id="${entityID}"]`; + // const $entityElement = $(fieldElement).closest(entityElementSelector); + const $entityElement = $(entityElementSelector); // If there are no elements returned from `entityElementSelector` // throw an error. Check the browser console for this message. @@ -373,8 +376,8 @@ // this case, we find the lowest common parent element (deepest in the tree) // and consider that the entity element. if (entityElement.length === 0) { - const $lowestCommonParent = $(entityElementSelector).parents().has(fieldElement).first(); - entityElement = $lowestCommonParent.find(entityElementSelector); + const $lowestCommonParent = $entityElement.parents().has(fieldElement).first(); + entityElement = $lowestCommonParent.find($entityElement); } const entityInstanceID = entityElement .get(0) diff -u b/core/modules/quickedit/js/quickedit.js b/core/modules/quickedit/js/quickedit.js --- b/core/modules/quickedit/js/quickedit.js +++ b/core/modules/quickedit/js/quickedit.js @@ -159,7 +159,8 @@ var entityID = extractEntityID(fieldID); var entityElementSelector = '[data-quickedit-entity-id="' + entityID + '"]'; - var $entityElement = $(fieldElement).closest(entityElementSelector); + + var $entityElement = $(entityElementSelector); if (!$entityElement.length) { throw 'Quick Edit could not associate the rendered entity field markup (with [data-quickedit-field-id="' + fieldID + '"]) with the corresponding rendered entity markup: no parent DOM node found with [data-quickedit-entity-id="' + entityID + '"]. This is typically caused by the theme\'s template for this entity type forgetting to print the attributes.'; @@ -167,8 +168,8 @@ var entityElement = $(fieldElement).closest($entityElement); if (entityElement.length === 0) { - var $lowestCommonParent = $(entityElementSelector).parents().has(fieldElement).first(); - entityElement = $lowestCommonParent.find(entityElementSelector); + var $lowestCommonParent = $entityElement.parents().has(fieldElement).first(); + entityElement = $lowestCommonParent.find($entityElement); } var entityInstanceID = entityElement.get(0).getAttribute('data-quickedit-entity-instance-id');