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

Maps don't error out on comma-delineated non-parenthesized 'lists' as values #1537

Closed
mknadler opened this issue Sep 5, 2015 · 4 comments
Closed

Comments

@mknadler
Copy link

mknadler commented Sep 5, 2015

A map value that is a comma-delineated 'list' that is not wrapped in parentheses, e.g.:

$map : ( 
  foo: bar, baz,
  foo2: bar2
);

Is being parsed as though the additional items in the list were keys with no paired values:

$map: (
  foo: bar,
  baz: null,
  foo2: bar2
);

test code:

$map: (
  a: 1, two, 3,
  foo: 'bar'
);

test {
  a: map-get($map, a);
  type: type-of(map-get($map, a));
  keys: map-keys($map);
  try: map-get($map, two);
}

ruby sass 3.4.14:

Invalid CSS after "  try: 1, two": expected ":", was ", 3,"

latest master:

test {
  a: 1;
  type: number;
  keys: a, two, 3, foo; }
@mknadler
Copy link
Author

mknadler commented Sep 5, 2015

More generally, it looks like the issue is that maps accept keys without values in libsass but not ruby sass:

$map: (
  foo, 
  bar: baz
);

does not cause an error, but probably should?

@xzyfer
Copy link
Contributor

xzyfer commented Sep 6, 2015

Thanks for the report @mknadler. I can confirm this issue is still present on the latest master.

@xzyfer xzyfer added this to the 3.3.1 milestone Sep 6, 2015
saper added a commit to saper/sass-spec that referenced this issue Sep 23, 2015
@xzyfer xzyfer modified the milestones: 3.3.1, 3.3.2 Oct 26, 2015
@xzyfer xzyfer modified the milestones: 3.3.2, 3.3.3 Nov 4, 2015
@mgreter mgreter modified the milestones: 3.3.4, 3.3.3 Jan 9, 2016
@mgreter
Copy link
Contributor

mgreter commented Jan 17, 2016

@mknadler your findings are pretty much spot on, but actually libsass seems allow lists as keys.

@mgreter
Copy link
Contributor

mgreter commented Jan 17, 2016

I opened an issue with ruby sass, since I think this is inconsistent and libsass does the right thing.

mgreter added a commit to mgreter/libsass that referenced this issue May 2, 2016
@mgreter mgreter modified the milestones: 3.3.7, 3.5 May 2, 2016
@mgreter mgreter self-assigned this May 2, 2016
@xzyfer xzyfer modified the milestones: 3.3.7, 3.4 Oct 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants