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

Remove trailing slash from jPath for self-closing tags #595

Merged
merged 1 commit into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 6 additions & 0 deletions spec/updateTag_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ describe("XMLParser updateTag ", function() {
<img width="500" height="500">
</content>
<script></script>
<lorem/>
<ipsum/>
</body>
</html>`;
const expected = {
Expand Down Expand Up @@ -167,6 +169,10 @@ describe("XMLParser updateTag ", function() {
if(attrs.width > 200 || attrs.height > 200) return false;
}else if(tagname === "content"){
return "div"
}else if(tagname === "lorem") {
return false;
}else if(jPath === "html.body.ipsum") {
return false;
}
return tagname;
},
Expand Down
1 change: 1 addition & 0 deletions src/xmlparser/OrderedObjParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ const parseXml = function(xmlData) {
if(tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1){
if(tagName[tagName.length - 1] === "/"){ //remove trailing '/'
tagName = tagName.substr(0, tagName.length - 1);
jPath = jPath.substr(0, jPath.length - 1);
tagExp = tagName;
}else{
tagExp = tagExp.substr(0, tagExp.length - 1);
Expand Down
Loading