You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
const dom: Domhandler.Document = htmlparser2.parseDocument(wxmlText, {
xmlMode: true,
});
In I use domUtils. GetElementsByTagName (' tagName, dom), I can pass in the dom, and get the expected element
In domUtils.getElementsById('eleId',dom), the ts type allows me to pass in the dom, but it doesn't get the correct result (null).
Found in the getElementsByTagName source code first made an 'isTag' judgment on the passed parameter (dom), which caused the dom to not enter the subsequent logic, because the dom tag is' root '.
This is obviously confusing, and hopefully ts will be more rigorous about the types of parameters passed in.
I now use domUtils.getElementsById('eleId',dom.children) as such.
The text was updated successfully, but these errors were encountered:
const dom: Domhandler.Document = htmlparser2.parseDocument(wxmlText, {
xmlMode: true,
});
In I use domUtils. GetElementsByTagName (' tagName, dom), I can pass in the dom, and get the expected element
In domUtils.getElementsById('eleId',dom), the ts type allows me to pass in the dom, but it doesn't get the correct result (null).
Found in the getElementsByTagName source code first made an 'isTag' judgment on the passed parameter (dom), which caused the dom to not enter the subsequent logic, because the dom tag is' root '.
This is obviously confusing, and hopefully ts will be more rigorous about the types of parameters passed in.
I now use domUtils.getElementsById('eleId',dom.children) as such.
The text was updated successfully, but these errors were encountered: