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

filter and getElementById not working as expected #45

Open
florianeichin opened this issue Nov 24, 2022 · 0 comments
Open

filter and getElementById not working as expected #45

florianeichin opened this issue Nov 24, 2022 · 0 comments

Comments

@florianeichin
Copy link

the parse options and methods filter and getElementByID are somehow not working as I understand them.
Is there some bug or maybe lacking docs?

I expect the same result for a and b and furthermore for c and d, right?

const a = txml.parse(rawXML, {
  filter: (dom) => dom.attributes.webdavID == id,
});
const b = txml.parse(rawXML).filter((dom) => dom.attributes.webdavID == id)
// expect a==b
// result: a is node with id and b == []

const c = txml.parse(rawXML, { searchId: 'N10005' });
const d = txml.getElementById(rawXML, 'N10005');
// expect c==d
// result: c is whole xml and d is the node with id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant