WebReflection / linkedom

A triple-linked lists based DOM implementation.
https://webreflection.medium.com/linkedom-a-jsdom-alternative-53dd8f699311
ISC License
1.62k stars 78 forks source link

CSSStyleSheet.insertRule returning undefined if index argument not provided #257

Open paul-go opened 6 months ago

paul-go commented 6 months ago

Suggested fix:

CSSStyleSheet.js:39

CSSOM.CSSStyleSheet.prototype.insertRule = function(rule, index = this.cssRules.length) {
WebReflection commented 6 months ago

PR? code is in the esm folder, thanks!

paul-go commented 6 months ago

Looks like I was a little too quick on the report. CSSStyleSheet.js is a file in cssom, which is unmaintained. I could submit a PR over there, but I doubt that will be fruitful. How does your project deal with these situations? Are you willing to run off a forked version of the dependency? Or should I monkey-patch CSSOM.CSSStyleSheet.prototype from within LinkeDOM? (ugh)

WebReflection commented 6 months ago

To be honest I don't personally have use cases around CSS API ... for SSR that's not common (but for SSR only I am also moving to uhtml/dom) but time-wise I have no idea and I haven't asked myself that question. If there is a CSSOM alternative (usually when one is dead another one comes up?) I would rather consider that alternative and call it a day ... otherwise monkey patching always worked in the JS world.