From 5b3b7c5c58e1dfdfdfde38f8c3441114f2f0878c Mon Sep 17 00:00:00 2001 From: Alexander Schlemmer <alexander.schlemmer@ds.mpg.de> Date: Mon, 22 Feb 2021 10:59:19 +0100 Subject: [PATCH] FIX: Problems with retrieving heading attributes with active preview. --- src/core/js/caosdb.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/js/caosdb.js b/src/core/js/caosdb.js index 010a0476..d673c919 100644 --- a/src/core/js/caosdb.js +++ b/src/core/js/caosdb.js @@ -404,12 +404,13 @@ function getIDfromHREF(el) { /** * Return an entity heading attribute from an element. + * * @param element The element holding the entity. * @return The value of the entity heading attribute or undefined if it is not present. */ function getEntityHeadingAttribute(element, attribute_name) { - var res = element.getElementsByClassName("caosdb-entity-heading-attr"); - + var res = findElementByConditions(element, x => x.classList.contains("caosdb-entity-heading-attr"), + x => x.classList.contains("caosdb-preview-container")); for (var i = 0; i < res.length; i++) { var subres = res[i].getElementsByClassName("caosdb-entity-heading-attr-name"); if (subres.length != 1) { @@ -444,7 +445,6 @@ function getEntityDescription(element) { * @return A list of objects with name and id of the parents. */ function getParents(element) { - // var res = element.getElementsByClassName("caosdb-parent-name"); var res = findElementByConditions(element, x => x.classList.contains("caosdb-parent-name"), x => x.classList.contains("caosdb-preview-container")); var list = []; -- GitLab