graphquery icon indicating copy to clipboard operation
graphquery copied to clipboard

Self-closing tags

Open xferra opened this issue 4 years ago • 0 comments

Hi, I enjoyed the library till I found an issue with self-closing tags. Here is an example:

Doc

<html>
<body>
<div>
     <a href="01.html" />
     <a href="02.html" />
     <a href="03.html" />
</div>
</body>
</html>

Query

anchor `css("a")` [{
    url `attr("href")`
    node `string()`
}]

Result

[
    {
        "node": "<a href=\"01.html\">\n                            \t</a>",
        "url": "01.html"
    },
    {
        "node": "<a href=\"02.html\">\n                            \t</a>",
        "url": "02.html"
    },
    {
        "node": "<a href=\"03.html\">\n\t\t\t\t\t\t\t</a>",
        "url": "03.html"
    },
    {
        "node": "<a href=\"03.html\">\n                        \n                    </a>",
        "url": "03.html"
    }
]

Expected: 3 items in the array.

Do you have any ideas how to fix it?

xferra avatar Apr 21 '21 11:04 xferra