Skip to content

Crash if select title contain characters other letters #1

@alapiere

Description

@alapiere

Hi there, thanks for this lib, very clean I like it !

Won't work in my environment because my title has brackets in it, and you convert it to a class in your div, you shouldn't : the admissible characters are not the same, especially ~ ! @ $ % ^ & * ( ) + = , . / ' ; : " ? > < [ ] \ { } | ` # (well in theory you could, but needs hacky escaping ..) <select name="my[title]"> hello </select> <div class="my[title]"> good bye </div> <div title="my[title]"> better </div> console.log("brackets in name:"); console.log(document.querySelectorAll('[name="my[title]"').length) console.log("brackets in class:"); console.log(document.querySelectorAll(".my[title]").length) console.log("brackets in title:"); console.log(document.querySelectorAll('[title="my[title]"').length) --> 1 , 0 , 1 so, line 100, if (!event.target.closest('.' + this.name) && !event.target.closest('label[for="' + this.selectElement.id + '"]')) { it will close the select as soon as it opens it. so nothing happens.. you should keep it as a title, or data- attibute, instead of a class

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions