[Webkit-unassigned] [Bug 30772] [Qt] Review the API of QWebElementCollection
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Mon Oct 26 11:57:23 PDT 2009
https://bugs.webkit.org/show_bug.cgi?id=30772
--- Comment #2 from Benjamin Poulain <benjamin.poulain at nokia.com> 2009-10-26 11:57:23 PDT ---
(In reply to comment #1)
> (In reply to comment #0)
> > 1) Give a coherent API using iterator (related to (1)):
>
> 1?
My bad, I had splitted that in 3 before.
> > -QWebElement QWebElementCollection::first() const
> > +iterator QWebElementCollection::begin()
> > -QWebElement QWebElementCollection::last() const
> > +iterator QWebElementCollection::end()
>
> True, but QVector/QList actually have first() methods.
I do not have anything against first(), I wanted to avoid last(). :)
If we find the QWebElements on the fly when they are needed, first() is ok, but
last() is not.
> > 2) The API could be modified to enable lazy population in the future.
> > The following changes would be required:
> > -changes of (1)
> > -int QWebElementCollection::count() const;
> > -QWebElement QWebElementCollection::at(int i) const;
> > -QWebElement QWebElementCollection::operator[](int i) const
> >
> >
> > If the changes of (2) are made, it could make sense to remove
> > QWebElement::findFirst() because it would be equivalent to
> > QWebElement::findAll().begin().
>
> True, but it might be a bit harder to find and make the resulting code a bit
> more obscure.
The justification I have heard for QWebElement::findFirst() is that findAll()
is slow. So my idea was to get the element one by one and avoid the problem
altogether.
With QWebElement::findFirst(), I expect something different from
QWebElement::nextSibling(). I would expect to be able to write something like
this:
QWebElement element = root.findFirst("p");
while (!element.isNull()) {
// do something
element = element.nextSibling("p");
// or element = element.nextSibling(); ?
}
But maybe I am biased because I have used jQuery.
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list