glennjones / microformat-shiv

A light weight cross browser JavaScript microformats parser
http://microformatshiv.com
MIT License
136 stars 22 forks source link

Incorrect implicit name properties #34

Open sknebel opened 7 years ago

sknebel commented 7 years ago
<span class="h-measure">
<data class="dt-measured" value="2017-06-27T11:06:00Z">
<span class="p-num">83.7</span>
&nbsp;<abbr title="kilograms"><span class="p-unit">kg</span></abbr></data></span>

gets a name property of "kilograms", correct would be "83.7 kilograms". The handling for generic properties is incorrectly implemented in a generic way that does not match the rules for implicit names, in this specific case: .h-x>abbr:only-child[title]:not([title=""]):not[.h-*] (from http://microformats.org/wiki/microformats-2-parsing#parsing_for_implied_properties) is implemented with only-of-type instead of only-child in https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/lib/parser-implied.js#L201, called via https://github.com/glennjones/microformat-shiv/blob/90c5ea5e43ae95fc460aef79f8c19832c6f1dc26/lib/parser-implied.js#L79

This is correct for implied photo and url properties, but not name.

jeremycherfas commented 5 years ago

I think this is the source of an issue I have.

I just recently received a webmention from https://www.zylstra.org/blog/2019/05/7080/ that ended up with an implied name that contains all sorts of information but not the actual reply. You can see what I received at the bottom of this post https://www.jeremycherfas.net/blog/indiewebcamp-utrecht