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

Valid anchor changed when href has port #102

Open
tmmiller6 opened this issue Oct 20, 2020 · 0 comments
Open

Valid anchor changed when href has port #102

tmmiller6 opened this issue Oct 20, 2020 · 0 comments

Comments

@tmmiller6
Copy link

When running anchorme.default, if an anchor has an href with a port and the text for the anchor has the URL without the port, a new anchor is created inside the original anchor, but the port is not in the nested anchor.

See http://jsfiddle.net/tmmiller/cr4a6kqe/4/

document.getElementById("input").value = <div><a href="https://mywebsite.com:7743" target="_blank">https://mywebsite.com</a></div>;

function process() {
document.getElementById("output").value = anchorme({
input: document.getElementById("input").value,
options: {
attributes: function(string) {
const attributes = {
target: "_blank",
rel: 'noopener noreferrer nofollow'
};
return attributes;
}
},
});
}

process();

Expected result: The target and rel attributes added to the anchor

Actual result: Notice the new anchor created without the port

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

No branches or pull requests

1 participant