Closed domchristie closed 10 years ago
I'm all for cleaning up the naming and making it more consistent. A few thoughts:
Initial selector class name: expanding__textarea
- I'm not sure about this one, since this is the class that people will add on their in HTML elements, and it seems less guessable / 'rememberable' than either expanding
or expandingTextarea
.
jQuery method name: expanding()
: It is less specific (though I'm not seeing any existing plugins using that name), but it does match the file name which is a good convention to follow. Alternatively, we could rename the file to expandingTextarea.js
to match the $.fn
name. I think expanding is a little less ugly FWIW, especially as we move forward into the CSS selectors used (which should be consistent with the method name).
Other CSS names - I think unifying all of these under the plugin name is a good idea. If I was to come up with names based on conventions from other plugins I've done I would use:
Container class name: expanding-container
Initial selector class name: expanding
Init class name: expanding-init
Clone class name: expanding-clone
Either your suggestions or these would be better than what is in use now, since they are at least more consistent. Anyway, these are just some thoughts, what do you think?
Re: class names: I like those. Whilst the BEM style is nice, it’s probably overkill and harder to understand.
Re: jQuery method name: yes, the name expanding
is quite broad, but given that the plugin has used it for its event namespace (for couple years, without any conflicts AFAIK), it’s probably safe to go ahead.
It does read pretty nicely:
$('textarea').expanding();
Minor point, what about .expanding-wrapper
?
I tend to think of containers having some kind of constraints (like height or width), whereas wrappers just enclose their contents.
Closed with #38
There are currently a few different ways to name various parts of the plugin:
May I suggest the following to improve consistency?:
(CSS class names based on BEM)
Thoughts?