Opened 11 years ago
Last modified 11 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.parser
htmlParser.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 tobookmarks
andbookmarks2
. - Secondly, it is always used with
contentDom
event. Therefore we can introduceeditor.on2
being 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 registercontentDom
listener 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#instanceReady
to#ready
(#9911).listener#removeListener
to#remove
.- ?
Change History (2)
comment:1 Changed 11 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.