[facets] Correctly look for inputs of type "hidden" (closes #4502768)
authorRémi Cardona <remi.cardona@logilab.fr>
Mon, 20 Oct 2014 12:23:13 +0200
changeset 10029 832a2a0b7bd2
parent 10028 326fbc5c92b0
child 10030 e19c322ede4b
[facets] Correctly look for inputs of type "hidden" (closes #4502768) jQuery ':hidden' selector looks at CSS visual properties (eg, 'display', 'visibility'). The intent here was probably to look for inputs of type "hidden", which many facets use to store user selection data (eg, FacetRangeWidget). The problem is that regular text inputs (eg the "has_text" facet which has a '<input type="text"/>') will be picked up by this selector if they are inside a folded facet. Chaos and destruction ensue.
web/data/cubicweb.facets.js
--- a/web/data/cubicweb.facets.js	Wed Oct 15 18:23:54 2014 +0200
+++ b/web/data/cubicweb.facets.js	Mon Oct 20 12:23:13 2014 +0200
@@ -35,7 +35,7 @@
     });
     // pick up hidden inputs (required metadata inputs such as 'facets'
     // but also RangeWidgets)
-    $form.find('input:hidden').each(function() {
+    $form.find('input[type="hidden"]').each(function() {
         names.push(this.name);
         values.push(this.value);
     });