machty / emblem.js

Emblem.js - Ember-friendly, indented syntax alternative for Handlebars.js
http://emblemjs.com
MIT License
1.04k stars 81 forks source link

Problems parsing link-to with class names #282

Closed kandebonfim closed 5 years ago

kandebonfim commented 8 years ago

Seems like adding an underscore in class name causes some misunderstanding in emblem's link parser.

this:

link-to .navtest 'dashboard' | Click me

gives me:

<a id="ember699" href="/dashboard" class="navtest">Click me</a>

but:

link-to .nav__item 'dashboard' | Gerenciar Cardápio

generates:

<a id="ember699" href="#" class="nav">Gerenciar Cardápio</a>

It sucks when writing BEM markup... 😁

thec0keman commented 8 years ago

Interesting! I'm honestly surprised a helper / component is working with the dot notation. I've always operated under the assumption that the . and # helpers are for dom elements, and any Ember helpers / components should use classNames or class.

What is interesting is that underscores work just fine in both of those situations:

div.some__class
= link-to classNames='some__class'

However, since this functionality does exist we should definitely take a look at why on helpers / components the dot notation gets confused.

kandebonfim commented 8 years ago

@thec0keman I had the idea of doing this way looking at the parser.

I though it was on purpose.