Skip to content

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

Closed

Description

Image for: Description

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

Metadata

Image for: Metadata

Metadata

Image for: Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Image for: Issue actions