Skip to content

Commit

Permalink
capricorn86#519@patch: Fix stuck bugs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mas0nShi committed Feb 24, 2023
1 parent 8db7f0a commit 44e9a9f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/happy-dom/src/xml-parser/XMLParser.ts
Expand Up @@ -68,10 +68,10 @@ export default class XMLParser {
isStartTag &&
(condCommMatch = condCommRegexp.exec(text)) &&
condCommMatch[0] &&
(condCommEndMatch = condCommEndRegexp.exec(data)) &&
(condCommEndMatch = condCommEndRegexp.exec(data.substring(markupRegexp.lastIndex))) &&
condCommEndMatch[0]
) {
markupRegexp.lastIndex = condCommEndRegexp.lastIndex;
markupRegexp.lastIndex += condCommEndRegexp.lastIndex;
continue;
} else {
this.appendTextAndCommentNodes(document, parent, text);
Expand Down
23 changes: 22 additions & 1 deletion packages/happy-dom/test/xml-parser/XMLParser.test.ts
Expand Up @@ -434,7 +434,28 @@ describe('XMLParser', () => {

'<!--[if lt Contoso 2]>\n' +
'<p>Your version of the Contoso control is out of date; Please update to the latest.</p>\n' +
'<![endif]-->'
'<![endif]-->',

'<!DOCTYPE html><html lang="en">\n' +
'<head>\n' +
' <meta charset="UTF-8">\n' +
' <title>Title</title>\n' +
'</head>\n' +
'<body>\n' +
'<!--[if lt IE 9]>\n' +
'<script>window.location = \'browser.htm\';</script>\n' +
'<![endif]-->\n' +
'\n' +
'\n' +
'<script>\n' +
' const node = document.createElement(\'a\');\n' +
' node.href = \'http://www.google.com\';\n' +
' node.target = \'_blank\';\n' +
' node.innerHTML = \'google\';\n' +
' window.document.body.appendChild(node);\n' +
'</script>\n' +
'</body>\n' +
'</html>\n'
];

for (const html of testHTML) {
Expand Down

0 comments on commit 44e9a9f

Please sign in to comment.