Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OMException: Failed to execute 'querySelector' on 'Element': '#$i-a5df4c33-a8f3-40f3-80ec-f66d5b59907d-list .dropdown-content' is not a valid selector. #25

Open
mebibou opened this issue Mar 23, 2021 · 4 comments

Comments

@mebibou
Copy link

mebibou commented Mar 23, 2021

Because of minification during build, the this.contructor.name here gets replace by $i sometimes. This causes the error as stated in the issue title.
Could this be replaces by a const? I'm not sure using the constructor thing brings anything really

@mbolli
Copy link

mbolli commented Apr 13, 2021

Same or similar issue here.
In my case, this.constructor.name is an empty string, so this.id will be e.g. -4e008ed8-4a89-4b4f-83b1-e613822ef3a6. This is an invalid value for an html id. The whole component fails because of this.

@mbolli
Copy link

mbolli commented May 3, 2021

Ok it's definitely the same issue, as it happens because of minification:

Also see this warning on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name

Warning: Be careful when using Function.name and source code transformations, such as those carried out by JavaScript compressors (minifiers) or obfuscators. These tools are often used as part of a JavaScript build pipeline to reduce the size of a program prior to deploying it to production. Such transformations often change a function's name at build-time.

So it's apparently not good practise to rely on a function's name.

@dennishendriksen
Copy link

Ran into the same issue. Using @mbolli his findings (thanks!) I updated my project using this workaround:

export default defineConfig({
    plugins: [solid()],
    // workaround for https://github.com/CreativeBulma/bulma-tagsinput/issues/25
    esbuild: {
        keepNames: true
    }
})

@CreativeBulma I noticed that this project has open pull requests: do you have plans for a future bug fix release?

@mbolli
Copy link

mbolli commented Feb 28, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants