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

Select with no options causes TypeError: Cannot read property 'text' of undefined #244

Closed
darkadept opened this issue Sep 24, 2014 · 1 comment
Assignees
Milestone

Comments

@darkadept
Copy link

When you initiate Dropkick on an empty select element it throws the error:

TypeError: Cannot read property 'text' of undefined.

<select id="emptysel"></select>

I traced it to line 826 and found that Dropkick doesn't check if sel.selectedIndex == -1.

The reason it's empty when I'm initializing Dropkick is because I'm using the reactivity of Meteor to populate the select.

@darkadept
Copy link
Author

I fixed it with this:

"innerHTML": (sel.selectedIndex === -1) ? '' : sel.options[ sel.selectedIndex ].text,

But there might be a better way to do it.

@Robdel12 Robdel12 modified the milestone: 2.1 Dec 8, 2014
@wwilsman wwilsman self-assigned this Dec 18, 2014
wwilsman added a commit that referenced this issue Dec 19, 2014
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