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

Chrome: Uncaught TypeError: Cannot set property 'src' of undefined #190

Open
rsardak opened this issue Jun 15, 2016 · 4 comments · May be fixed by #233
Open

Chrome: Uncaught TypeError: Cannot set property 'src' of undefined #190

rsardak opened this issue Jun 15, 2016 · 4 comments · May be fixed by #233

Comments

@rsardak
Copy link

rsardak commented Jun 15, 2016

It seems the issue is related to this one #177
But in the current version I don't see that fix ( if(star)... )
_setIcon: function(star, icon) {
star[this.opt.starType === 'img' ? 'src' : 'className'] = this.opt.path + icon;
},
Thanks in advance

@YeskaNova
Copy link

YeskaNova commented Jan 19, 2017

@wbotelhos This issue comes from this line :
star = this.stars[Math.ceil(score) - 1];

When the option 'half' is true and the cursor is before the first star it looks for a negative index in the array. It can be easly fixed with :
star = this.stars[Math.max( Math.ceil(score) - 1,0)];

@ghost
Copy link

ghost commented Feb 16, 2018

The problem exist and without cancel enabled. What I need to change with this line star = this.stars[Math.max( Math.ceil(score) - 1,0)]; ? This was the solution for me: https://github.com/mbrainiac/raty/commit/958b92dcabcbc342a041e4073f6c0e216f36ac45

@YeskaNova
Copy link

YeskaNova commented Feb 25, 2018

It can be reproduced very easly :
Go to : https://wbotelhos.com/raty
Go to the example for "Half" and try to select 0 star ( put the cursor before any star ) in the console you will see errors adding up.

@hevyfly
Copy link

hevyfly commented Dec 11, 2018

The problem exist and without cancel enabled. What I need to change with this line star = this.stars[Math.max( Math.ceil(score) - 1,0)]; ? This was the solution for me: https://github.com/mbrainiac/raty/commit/958b92dcabcbc342a041e4073f6c0e216f36ac45

it should also in this section _setTitle:function() change the line star = this.stars[Math.max( integer - 1,0)]

markvantilburg added a commit to markvantilburg/raty that referenced this issue Oct 1, 2021
@markvantilburg markvantilburg linked a pull request Oct 1, 2021 that will close this issue
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

Successfully merging a pull request may close this issue.

3 participants