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

Fix for calling removeAttr with number type (on lists) #801

Closed
wants to merge 1 commit into from

Conversation

janza
Copy link
Contributor

@janza janza commented Mar 19, 2014

Made sure attr is string when calling indexOf
Added test for can.list removeAttr method with number argument.

@@ -641,7 +641,7 @@ steal('can/util', 'can/util/bind', 'can/construct', 'can/util/batch', function (
if (parts.length && current) {
return current.removeAttr(parts);
} else {
if (!!~attr.indexOf('.')) {
if (typeof attr === 'string' && !!~attr.indexOf('.')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we maybe just do if( ('' + attr).indexOf('.') ) {?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would have a different effect than his code. A number like 1.2 would then pass (which may be ok).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh good point, I forgot about floating point numbers. I think this works then.

@daffl daffl added this to the 2.1.0 milestone Mar 19, 2014
@daffl daffl added the Bug label Mar 19, 2014
@ccummings
Copy link
Contributor

Thanks for the fix @janza. It will be going out in 2.1 so I had to create a new PR against minor instead of master.

@ccummings ccummings closed this May 2, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants