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

Projects
None yet
4 participants
@janza
Contributor

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('.')) {

This comment has been minimized.

@daffl

daffl Mar 19, 2014

Contributor

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

@daffl

daffl Mar 19, 2014

Contributor

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

This comment has been minimized.

@matthewp

matthewp Mar 19, 2014

Contributor

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

@matthewp

matthewp Mar 19, 2014

Contributor

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

This comment has been minimized.

@daffl

daffl Mar 19, 2014

Contributor

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

@daffl

daffl Mar 19, 2014

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@ccummings

ccummings May 2, 2014

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.

Contributor

ccummings commented May 2, 2014

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