-
Notifications
You must be signed in to change notification settings - Fork 111
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
issue finding href of <a> tag #242
Comments
a
tag
Hi, const root = parse(html);
const links = root.querySelectorAll("a");
for (const a of links) {
console.log(a.rawAttrs);
console.log(a.getAttribute("href"));
} |
I have same issue.
test code
result
|
@excelsior091224 I'm afraid this is another issue. in you case ,you should just add an options to parse const root = parse(html, {
blockTextElements: {
script: true,
noscript: true,
style: true,
}
}); |
@taoqf , this commit (release v6.1.7 onwards) breaks the earlier functionality of ignoring text content of specific tags by setting them as
This matches the behavior explained in the README as well.
Could you please check ? |
@devansh-sharma-tw Sorry for that. You can try v6.1.0 now. const html = `<pre>
<code>test</code>
</pre>`;
const root = parse(html, {
blockTextElements: {
}
});
const list = root.getElementsByTagName("code");
const [code] = list;
code.text.should.eql('test'); |
@taoqf Thanks for the fix! |
Here is the code:
a.rawAttrs
returns'href="/" rel="home"'
buta.getAttribute("href')
returnsundefined
.Also
a.attrs
always returns an empty object{}
.The text was updated successfully, but these errors were encountered: