Incorrect results for some elements missing attributes
aaronpk opened this issue · 0 comments
aaronpk commented
There are a few cases where the parser is returning incorrect results because of the way it tests for the presence of attributes.
http://pin13.net/mf2/?id=20170524175046008
<article class="h-entry">
<a class="u-url">link</a>
</article>
currently parses as
{
"type": [
"h-entry"
],
"properties": {
"url": [
"http://example.com/"
],
"name": [
"link"
]
}
}
The correct result should have the url property set to link
.
This is caused by this incorrect conditional check: $u->getAttribute('href') !== null
The getAttribute
method will never return null according to the PHP docs: http://php.net/manual/en/domelement.getattribute.php
The code should instead be testing for the presence of the attribute with hasAttribute