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

Update unchanged attributes, By setAttribute #240

Closed
ykawakamy opened this issue May 3, 2023 · 1 comment
Closed

Update unchanged attributes, By setAttribute #240

ykawakamy opened this issue May 3, 2023 · 1 comment
Labels

Comments

@ykawakamy
Copy link

When calling setAttribute, even unchanged attributes are escaped.
I would like to keep the original strings when editing the HTML source.

Example:

root = HTMLParser.parse("<div unchanged='[\npreserve newline\n]'></div>");
div = root.firstChild
console.log(div.toString())
// output: 
//   <div unchanged='[
//   preserve newline
//   ]'></div>

div.setAttribute("append","newAttribute");
console.log(div.toString())
// output: 
//   <div unchanged="[\\npreserve newline\\n]" append="newAttribute"></div>'
// expected: 
//   <div unchanged='[
//   preserve newline
//   ]' append="newAttribute"></div>'
@taoqf taoqf added the bug label Aug 17, 2023
taoqf added a commit that referenced this issue Aug 17, 2023
@taoqf
Copy link
Owner

taoqf commented Aug 17, 2023

Thank you.

@taoqf taoqf closed this as completed Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants