Bug description
discovered this when my forms were set to target an inner element, but instead the first matching element on the page was selected (this is a page with a list of forms)
<div>
<div class="auto-submit d-flex"></div>
<form
{% if id %}id="{{id}}"{% else %}id="form_{{name}}"{% endif %}
up-transition="cross-fade"
up-target=".auto-submit"
up-method="{{up-method|default:PATCH}}"
up-autosubmit
up-delay="{{up-delay|default:1000}}"
enctype="multipart/form-data"
up-history="false"
action="{{action}}">
{% block component %}{% endblock %}
<div class="auto-submit d-flex"> </div>
</form>
</div>
response
<div class="auto-submit d-flex">
<img src="/assets/Font-Awesome/svgs/solid/check-circle.svg">
<p>Profile Upadted !</p>
</div>
my workaround/fix
var selector_closest_fixed = false;
(function fix_selector_closest(){
if(!selector_closest_fixed){
selector_closest_fixed = true
up.Selector.prototype.closest = function(element) {
var parentElement;
let child_target = element.querySelector(this.unionSelector);
if (child_target){
return child_target
}
else if (this.matches(element)) {
return element;
} else if ((parentElement = element.parentElement)) {
return this.closest(parentElement);
}
};
}
})();
Bug description
discovered this when my forms were set to target an inner element, but instead the first matching element on the page was selected (this is a page with a list of forms)
response
my workaround/fix