[Webkit-unassigned] [Bug 20709] Implement HTML 5's HTMLElement.classList property

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jun 16 06:51:28 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=20709





------- Comment #4 from aroben at apple.com  2009-06-16 06:51 PDT -------
(In reply to comment #1)
> How are CSS class names stored internally? For example if the class attribute
> is set to "a b c" is this stored as "a b c" or is it stored as a set with "a",
> "b" and "c"?

It is stored as a Vector with 3 items: "a", "b", "c". The original order is
preserved.

> If the former, is it worth changing it to a set internally in the
> case classList is accessed? The number of class names is usually pretty small
> (less than 10 in most cases) so maybe a vector is enough.

I agree that in the common case a Vector seems fine. We could switch to using a
set if the number of classes crosses some threshold, but maybe that isn't worth
it. If we used a set we'd still need to have a way of preserving the original
ordering of the classes, as this is required for classList.item(n).

Another possibility would be to use ListHashSet
<http://trac.webkit.org/browser/trunk/JavaScriptCore/wtf/ListHashSet.h>.


-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list