microformats / tests

Microformats test suite

Home Page:http://microformats.org/wiki/microformats2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Should implied properties be used for parent of nested h-x?

willnorris opened this issue · comments

The microformats-v2/h-card/impliedname test includes the following case:

<div class="h-card"><span class="h-card"><img src="john.html" alt="John Doe"/>Name</span></div>

The expected value is listed as:

{
  "type": ["h-card"],
  "properties": {
    "name": ["Name"]
  },
  "children": [{
    "value": "Name",
    "type": ["h-card"],
    "properties": {
      "name": ["John Doe"],
      "photo": ["http://example.com/john.html"]
    }
  }]
}

According to the test suite, the <img> in this example gets applied as a photo for the inner h-card, but
not for the outer h-card. This does seem totally reasonable. However, the parsing spec contains the case for implied photos that reads:

else if .h-x>:only-child>img[src]:only-of-type:not[.h-*] then use that img src for photo

which would actually apply to the outer h-card in this case. Should this line of the spec (and similar selectors) read the following?

else if .h-x>:only-child**:not[.h-]**>img[src]:only-of-type:not[.h-] then use that img src for photo

(note the addition of :not[.h-*] to the :only-child selector)

For comparison, most of the common libraries are interpreting the spec as written and applying the implied photo to both the outer and inner h-card. The node library is behaving as I think the spec intended: http://willnorris.net/mf2compare/?url=https://willnorris.com/tmp/uf/impliedname-11.html

Accepted 2016-06-05 at IndieWeb Summit. Spec updated 2016-06-11.

reopening. Looks like this got applied to name and photo, but not URL. Was that intentional?

looks like that may have been a problem with the proposed selectors in #50, since those don't include :not[.h-*] on the :only-child selector. I'm pretty sure it should have been there, especially since they're not there for name and photo.

I just updated http://microformats.org/wiki/microformats2-parsing#parsing_for_implied_properties again. I think it has all the :not[.h-*] required now.

Closing as fixed.