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
TypeError: elem.getAttribute is not a function #100
Comments
|
I need more details. here is an example of id selector, and the tests passed. |
I've got the same issue let root = parse(data);
let test = root.querySelectorAll('.observed');
console.log(test[0].querySelector('.search'))
//Returns:
TypeError: elem.getAttribute is not a function |
Just tried, |
For me this error happens when there's no match for the selector. |
Most likely the same for me. I'm checking for the existence of an element that I expect to be absent most of the time. |
I got around by using |
May I know what is the html you parsed? I should do some tests and try to fix that.
It will be easier for me to have the html. I did some tests like that: const root = parse('<div class="a b"></div>');
root.querySelectorAll('a').length.should.eql(0);
should.equal(root.querySelector('a'), null);
root.querySelectorAll('.a').length.should.eql(1);
root.querySelectorAll('.b').length.should.eql(1);
should.notEqual(root.querySelector('.a'), null);
const nodelist = root.querySelectorAll('.a,.b');
nodelist.length.should.eql(1);
const div = nodelist[0];
root.querySelector('.a,.b').should.eql(div); |
I tried to fix the issue. If you guys won't give me any clue, I will publish 3.0.2 several hours later. |
I think I fixed the issue. 3.0.3 published. |
Thank all of you. |
Yeeep, can confirm, now |
Thanks @taoqf! 🙌🏼 |
Version
3.0.0
(or3.0.1
) seems to intro an error:The text was updated successfully, but these errors were encountered: