Skip to content

Commit 2f2f787

Browse files
Remove trailing slash from jPath for self-closing tags (#595)
1 parent 643816d commit 2f2f787

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

spec/updateTag_spec.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ describe("XMLParser updateTag ", function() {
121121
<img width="500" height="500">
122122
</content>
123123
<script></script>
124+
<lorem/>
125+
<ipsum/>
124126
</body>
125127
</html>`;
126128
const expected = {
@@ -167,6 +169,10 @@ describe("XMLParser updateTag ", function() {
167169
if(attrs.width > 200 || attrs.height > 200) return false;
168170
}else if(tagname === "content"){
169171
return "div"
172+
}else if(tagname === "lorem") {
173+
return false;
174+
}else if(jPath === "html.body.ipsum") {
175+
return false;
170176
}
171177
return tagname;
172178
},

src/xmlparser/OrderedObjParser.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ const parseXml = function(xmlData) {
341341
if(tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1){
342342
if(tagName[tagName.length - 1] === "/"){ //remove trailing '/'
343343
tagName = tagName.substr(0, tagName.length - 1);
344+
jPath = jPath.substr(0, jPath.length - 1);
344345
tagExp = tagName;
345346
}else{
346347
tagExp = tagExp.substr(0, tagExp.length - 1);

0 commit comments

Comments
 (0)