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

Multiple self-closing tags are incorrectly parsed #5

Open
bigmeow opened this issue Apr 27, 2020 · 0 comments
Open

Multiple self-closing tags are incorrectly parsed #5

bigmeow opened this issue Apr 27, 2020 · 0 comments

Comments

@bigmeow
Copy link

bigmeow commented Apr 27, 2020

Examples of errors

const Soup = require("soup");
soup = new Soup(`
<image src="123" />
<image src="abc" />
`);
soup.setAttribute("image[src]", "src", (url) => {
    return url + "?test";
});

console.log(soup.toString());

Expected output:

<image src="123?test" />
<image src="abc?test" />

Current output:

<image src="123?test" />
<image src="abc?testabcabc?test" />

Correct example

const Soup = require("soup");
soup = new Soup(`
<image src="123"></image>
<image src="abc"></image>
`);
soup.setAttribute("image[src]", "src", (url) => {
    return url + "?test";
});

console.log(soup.toString());

/*
<image src="123?test"></image>
<image src="abc?test"></image>
*/
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