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

Document accessing attributes with dot in the name #1101

Closed
wclr opened this issue Jun 19, 2014 · 2 comments · Fixed by #1136
Closed

Document accessing attributes with dot in the name #1101

wclr opened this issue Jun 19, 2014 · 2 comments · Fixed by #1136
Milestone

Comments

@wclr
Copy link
Contributor

wclr commented Jun 19, 2014

I actually can create a can.Map attribute without restrictions on characters in the name, like

var map = new can.Map({"some-very'strange.name": 1}) // name contains dot symbol
map["some-very'strange.name"] // -> 1, can access it
map.attr("some-very'strange.name") // can't access it, will throw

but I can not access such attribute with attr function because it treats dot symbol as separation between attributes. Such behaviour is not compatible with javascript objects restrictions (as I'm aware there is no restrictions on object property names)

So what do you think about this issue?

@daffl
Copy link
Contributor

daffl commented Jun 26, 2014

You should be able to access the property using \ before the .:

map.attr("some-very'strange\.name") // can't access it, will throw

Here is a Fiddle: http://jsfiddle.net/s7cq8/
We'll definitely have to add this to the documentation. I thought it was but I couldn't find it anywhere.

@wclr
Copy link
Contributor Author

wclr commented Jun 26, 2014

Ok, good, thanks.

@daffl daffl added this to the 2.1.4 milestone Jun 26, 2014
@daffl daffl changed the title Attributes with dot in the name Document accessing attributes with dot in the name Jun 26, 2014
@daffl daffl modified the milestones: 2.1.3, 2.1.4 Jul 23, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants