Opened 12 years ago
Closed 12 years ago
#11872 closed New Feature (fixed)
Allow chaining the after calling addClass
| Reported by: | Alfonso Martínez de Lizarrondo | Owned by: | |
|---|---|---|---|
| Priority: | Normal | Milestone: | CKEditor 4.4.1 |
| Component: | General | Version: | |
| Keywords: | Cc: |
Description
The http://docs.ckeditor.com/#!/api/CKEDITOR.dom.element-method-addClass should include a
return this;
for symmetry with removeClass and to follow the same pattern that other frameworks like jQuery that allows chaining calls to the element.
Change History (2)
comment:1 Changed 12 years ago by
| Status: | new → confirmed |
|---|
comment:2 Changed 12 years ago by
| Milestone: | → CKEditor 4.4.1 |
|---|---|
| Resolution: | → fixed |
| Status: | confirmed → closed |
Fixed on master with git:06bdff1b4.
However, I'm not a huge fan of chaining. It's a nice pattern and in some cases it helps a lot, but not much in ours. It reduces readability a bit, it reserves return values so one must be very careful when making new methods chainable, it requires additional code (return statements), etc. And there's no much profit from it. So, I don't think we'll start making most of our methods chainable.

There is nothing more to say :). I fully agree with this one.