Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect results for some elements missing attributes #118

Closed
aaronpk opened this issue May 24, 2017 · 0 comments
Closed

Incorrect results for some elements missing attributes #118

aaronpk opened this issue May 24, 2017 · 0 comments

Comments

@aaronpk
Copy link
Member

aaronpk commented May 24, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant