[Webkit-unassigned] [Bug 80490] [Microdata] Implement cache mechanism for HTMLPropertiesCollection.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Mar 12 00:22:50 PDT 2012


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





--- Comment #5 from Arko Saha <nghq36 at motorola.com>  2012-03-12 00:22:50 PST ---
(In reply to comment #4)
> Wait... the spec says it's in the tree order :(
> 
> http://dev.w3.org/html5/md/#htmlpropertiescollection
> collection(index)
> Returns the element with index index from the collection. The items are sorted in tree order.
> 
> We shouldn't need to do any of these sorting. DOM is in the tree order by default!

Let me try to explain the situation with below example:

<div id="id1">
<p itemprop="foo" id="a"></p>
</div>

<section itemscope itemref="id1 id2">
<p itemprop="foo" id="b"></p>
</section>

<div id="id2">
<p itemprop="foo" id="c"></p>
</div>

Here <section> has itemscope attribute, its an microdata item.

if we do item = document.getItems()[0], it will return the <section> element. first item in the document. 

item.properties.namedItem(foo) must return a NodeList object containing three <p> elements with id- a, b, c respectively. it should be in the tree order. 

With itemref attribute we can specify the additional properties of an item. Those properties will not be children of the item as they are added through itmref attribute.

Now to find the properties of an item we do the below steps as per spec :
1. Find all children of the item with itemprop attribute.
2. Find the properties which are added through the itemref attribute. In the example: find element with id 'id1', 'id2'. Then find the properties of id1, id2
3. Sort the result in the tree order.

Please note that the traversal is started from base element i.e <section> in this case and not from the document root so the node list we get will not be in tree order(without step 3). It will be b, a, c.

So without sorting how to get the properties in tree order (a, b, c)??

-- 
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