[whatwg] Microdata - Handling the case where a string is upgraded to an object

Philip Jägenstedt philipj at opera.com
Tue Jul 19 09:00:07 PDT 2011


On Mon, 18 Jul 2011 22:01:37 +0200, Tab Atkins Jr. <jackalmage at gmail.com>  
wrote:

> On Mon, Jul 18, 2011 at 4:20 AM, Philip Jägenstedt <philipj at opera.com>

>> As for the solution, are you suggesting that .itemValue return a special
>> object which is like HTMLElement in all regards except for how it
>> toString()s?
>
> Yes.

Currently, it's spec'd as returning the element itself. This isn't  
terribly useful, at least I've just checked e.itemScope and then accessed  
e.properties directly rather than going through e.itemValue.properties.  
Given this, a simpler fix would be to let .itemValue act like .textContent  
when an itemscope attribute is present.

Still, I'm not sure if it's a good idea. It makes the Microdata model kind  
of odd if a property is both an item and has a fallback text  
representation. It will also mask the fact that a text property has been  
upgraded to an item, somewhat decreasing the chance that the consuming  
code will be updated.

-- 
Philip Jägenstedt
Core Developer
Opera Software



More information about the whatwg mailing list