Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/html-to-ast.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ export function parse(html) {
node.range = range;
node.raw = html.slice(range[0], range[1]);
}
// map `url` to Link node
if (node.type === "Link" && node.properties.href !== "undefined") {
Copy link
Member

@azu azu Nov 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

node.properties.href !== "undefined"

typeof node.properties.href !== "undefined" ?

Can you add a test-case for <a>text</a> pattern?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review. I'll fix it.

node.url = node.properties.href;
}
}
removeUnusedProperties(node);
});
Expand Down
1 change: 1 addition & 0 deletions test/ast-test-case/element-attributes/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
{
"type": "Link",
"tagName": "a",
"url": "http://alpha.com",
"properties": {
"href": "http://alpha.com",
"className": [
Expand Down