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 Piotrek Koszuliński)

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.

  1. CKEDITOR.htmlParser -> CKEDITOR.parser
  2. htmlParser.fragment.fromHtml -> htmlParser.parse - this method creates fragments, but also elements (depending on arguments).
  3. 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 to bookmarks and bookmarks2.
    • Secondly, it is always used with contentDom event. Therefore we can introduce editor.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 register contentDom listener that adds this event again.
  4. We can change some get* and set* 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).
  5. Editor#instanceReady to #ready (#9911).
  6. listener#removeListener to #remove.
  7. ?

Change History (2)

comment:1 Changed 11 years ago by Piotrek Koszuliński

Description: modified (diff)
Status: newconfirmed

comment:2 Changed 11 years ago by Piotr Jasiun

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.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy