-
Notifications
You must be signed in to change notification settings - Fork 80
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
document.querySelector()
doesn't return specific class
#184
Comments
meta is not registered as special tag IIRC and I have no plan to register all elements as special tags ... after reading all other issues you are having, I might suggest you are better off with JSDOM if you expect everything in the HTML standard to be implemented in here. This maybe will save you time for future issues: it's not a goal of this project to have the whole HTML standard working ... it actually tries to care the minimal amount of time to render SSR, not to replace JSDOM or a real browser and the read path is not super interesting in here as you always have regular workaround via |
I'm porting my Chrome extension to Manifest V3 which requires the use of a service worker. But in the service worker, the I find a bug on the I have a workaround: import * as linkedom from "./lib/linkedom.js";
if (!("DOMParser" in globalThis)) {
globalThis.DOMParser = linkedom.DOMParser;
Object.defineProperty(linkedom.HTMLScriptElement.prototype, "text", {
get() {
return this.textContent;
},
});
} But for Object.defineProperty(linkedom.HTMLElement.prototype, "content", {
get() {
return this.getAttribute("content") ?? "";
},
}); |
it's a web extension though, you can do whatever you want and nothing else should be affected? to have classes exposed and elements upgraded (it's like builtin extends in LinkeDOM even for native classes) you need to register the class to the parser, then you cna polyfill by your own. these attributes are for today, every other for tomorrow ... you can likely overcome all of them through getAttribute after knowing what you are selecting, or use |
P.S. a way to export |
I'm not blocked by all the issues I have opened. I can modify my code to use By fixing directly in LinkeDOM, if other users have the same problems as me: they will benefit from the fixes. I understand that you don't want to add an infinite of properties. You can close the issues I opened if you want. |
the option one had a very valid use case because in SSR you want to write option.value = 'thing' and see that reflected, as much as selected, if |
P.S. if nothing, it's very possible I should think about a way to export pluggable in features/accessors/classes to recognize when querySelector is used so that patching these on demand is possible |
Hi,
For some elements, the
document.querySelector()
method doesn't return the specific class, but aHTMLElement
. For example with the<meta>
element whose object returned isn't anHTMLMetaElement
.Maybe the problem happens only on the class that doesn't call
registerHTMLClass()
.The text was updated successfully, but these errors were encountered: