[webkit-qt] New API for comments

Benjamin Poulain benjamin.poulain at nokia.com
Wed Mar 2 03:56:12 PST 2011

On 03/02/2011 10:03 AM, Simon Hausmann wrote:
> However in general I'm not a fan of introducing a Node class. It was a very concious
> decision early on _not_ to repeat the API mistake of DOM to distinguish between Nodes and Elements,
> as it requires constant type-casting.
> Perhaps in our case it's not that bad, given that QWebElement is rather powerful. But I think it's would
> also be worth it to explore a cursor / iterator style API on a web element. At least for a side-by-side comparision.

I think the API could get ugly with Iterator. And that would stop us 
from extending further to other kind of nodes (if cdata or comments 
become popular ;)).

We are trying to solve two main kinds of problems:
1) mix of element and text: <p>Try to put this in italic <b>some 
2) selection and carret position (W3C range)

For (1), let say we want to put all text node as italic:
while (iterator.hasNext()) {
     if (iterator.isText())
         iterator.encloseContentsWith("<i>"); -> isn't that strange to 
enclose the iterator?

For (2), let say we want to put the selection as italic. I can't even 
start to think how to deal with that with iterators.


More information about the webkit-qt mailing list