Opened 12 years ago
Last modified 12 years ago
#10536 confirmed Bug
API imporevements
| Reported by: | Piotrek Koszuliński | Owned by: | |
|---|---|---|---|
| Priority: | Normal | Milestone: | |
| Component: | General | Version: | |
| Keywords: | Cc: |
Description (last modified by )
I'd like to gather in this ticket some API improvements we could make. Of course most of them are not obvious, so they can be controversial. Also, in every case backward compatibility should be ensured.
CKEDITOR.htmlParser->CKEDITOR.parserhtmlParser.fragment.fromHtml->htmlParser.parse- this method creates fragments, but also elements (depending on arguments).editable.attachListener- Firstly, its name isn't clear and I don't see a chance to make it clear. Therefore I'd rename it to equally unclear
editable.on2. Similarly tobookmarksandbookmarks2. - Secondly, it is always used with
contentDomevent. Therefore we can introduceeditor.on2being a combination of both. This should simplify our code, but also would make it simpler to explain that to others. This method would executed listener immediately if editor already has initialized editable and would always registercontentDomlistener that adds this event again.
- Firstly, its name isn't clear and I don't see a chance to make it clear. Therefore I'd rename it to equally unclear
- We can change some
get*andset*methods to their simpler versions (*). E.g.:getParent, getFirst, getLast, getPrevious, getNext, getName, getChild, getSelection, getDocument, getRanges, getAttributes, setAttributes, etc. It's for making code easier to write and shorter (in terms of lines length). It won't save a significant number of kbytes (I've made a static analysis and saved ~1% in gzipped package after making even more changes). Editor#instanceReadyto#ready(#9911).listener#removeListenerto#remove.- ?
Change History (2)
comment:1 Changed 12 years ago by
| Description: | modified (diff) |
|---|---|
| Status: | new → confirmed |

For me names like on2 or bookmark2 are very bad idea. They have no meaning at all and it is quite easy to create a bug when you forget to put "2" somewhere.
In my opinion for bookmarks it would be better to call them: weakBookmark and strongBookmark (or bookmarkWeak and bookmarkStrong), because, as I understand, one of them live longer then other, so it is somehow similar to weak and strong pointers in cpp.
1, 2, 5 - I'm totally argree.