-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[WIP] hack together stylesheet observer #124
Conversation
Hi @jperl, thank you for working on this. One problem I see with your suggestion is the lack of support of |
@marcospassos Good point I just copied in this code without thinking about it -- that is an easy change to make. Where do you recommend I inject the monkey patch -- for both the initial load and newly created elements? Also how do you recommend testing this? |
@jperl, I'd take another path for solving this problem:
Benefits
// How to monkey-patch the insertRule globally
const insertRule = CSSStyleSheet.prototype.insertRule;
CSSStyleSheet.prototype.insertRule = function (rule: string) {
dispatchEvent(/*...*/);
return insertRule.apply(this, arguments);
} |
@marcospassos That sounds like a much better approach. @Yuyz0112 if you can confirm that you would be willing to merge the approach @marcospassos recommended, I am happy to take a stab at implementing it. |
@marcospassos Thanks for the review! If you want to split this implementation into multiple PRs(which is recommended), I think it can be done with:
|
Sounds good I will split it into multiple PRs. EDIT: tracking in my sprint board here https://github.com/qawolf/qawolf/issues/121 |
@jperl I might take a stab at moving forward with your work unless you were still actively looking into this. Let me know! |
@dcramer Please do! Sorry I have been too busy to tackle this yet. |
I'm working on adapting this patch, and hoping someone can help clarify something. I've disabled the observers and written a test which uses insertRule/deleteRule, however the test passes successfully where I'd expect it to fail. I believe thats because of the existing element mutation observers. How do I actually reproduce the core issue in isolation? |
NEVERMIND |
👍 i just need to figure out how to get things into the replayer but ill work on that next opportunity i get |
We are always passing in fresh objects to this method, so instead of cloning this into a new object, we can just put the `timestamp` on the given object directly and return it, saving a bit of processing cost.
This is my very hacky fix implementing #104