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

Filter plugin select2 Uncaught TypeError: element.getAttribute is not a function #924

Closed
rickdubiel opened this issue Sep 4, 2021 · 1 comment

Comments

@rickdubiel
Copy link
Contributor

rickdubiel commented Sep 4, 2021

I've recently upgraded from v2.5.2 to v2.6.0 and ran across a tiny issue with the $.parseHTML update when using the select2 plugin. I believe this issue addresses that update:

#905

I narrowed it down to the ruleValueSelect template leaving a single space at the beginning of the template and then $.parseHtml parses that out as an individual array item. When select2 tries to an apply an id to that item by using getAttribute the error occurs. See below:

image

The jQuery docs recommended using jQuery.trim in order to prevent trailing/leading whitespace from being converted to text nodes. That indeed did resolve the issue. Here's a PR with the change:

#923

Here's a fiddle with the issue:

https://jsfiddle.net/6qyLvhpb/1/

Just need to make a selection and watch the console to see the error.

Thanks!

@mistic100
Copy link
Owner

Thank you for your super complete analysis.

I just released a patch

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

2 participants