-
Notifications
You must be signed in to change notification settings - Fork 53
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
Stylish does not affect dynamically generated iframes #3
Comments
https://developer.chrome.com/extensions/content_scripts - match_about_blank - available in Chrome 37. |
+1 The new Google Tag Manager debug iframe style is pretty hideous. I'd love to Stylish it up. |
@JasonBarnabe anything else that needs to be done here other than adding |
I'm unsure. Why don't you test it out and if that's all that's needed, send a PR. |
I'll test it. |
Awesome news! 👍 |
I tested this a bit myself. It makes things better, but still not great. -Testing on Tumblr's new post box, it still doesn't work. This is likely because the src is |
For the first case: I think we need to change the patterns. Will experiment with javascript urls, file:// is also missing there. For the second case: Maybe something like a mutation observer is needed to re-apply when iframes get added. But there's probably a cleaner solutions out there. |
Chrome's docs say |
Can you link me to where you read that? Sounds like another Chromium issue is required. |
Same doc you linked to. It lists allowed schemes, and A more likely solution is extending |
Well, I don't see |
No luck with |
@JasonBarnabe I tried your MDN example, but it works as expected on page reloads. Here's the style I was using: @namespace url(http://www.w3.org/1999/xhtml);
@-moz-document domain("developer.mozilla.org") {
.cke_wysiwyg_frame, .cke_wysiwyg_div { margin-left: 50% !important;}
} This is on Chrome 42. Could you verify again that the MDN case works for you? Also, please point me to the iframe you meant on tumblr. I could only identify a few hidden ones in the HMTL. Maybe |
Noticed the page reload issue on another site. I think this is only fixable through JS. |
Tumblr must've changed their editor since I tried last, because yeah, there's no iframe involved any more. |
(1) Tumblr dropped TinyMCE and began using (2) The intermittent failure in MDN's editor occurs when Chrome is able to run the content script before the page writes content to the The only remedy for intermittent failures like this is to monitor the styles with a MutationObserver and replace them. (3) Here are some test cases. Stylish is yes if Chrome ran the content script, styled is yes if the style was applied, src is
[†] // All but cases 5 & 6 set a `src` URL, then write the `contentDocument`
l = document.body.appendChild(document.createElement('iframe'));
l.src = aString; // omitted, if aString is none
d = l.contentDocument; d.open(); d.write(iframeContent); d.close();
// Case 5 sets `srcdoc` to the document content instead of writing `contentDocument`
l = document.body.appendChild(document.createElement('iframe'));
l.srcdoc = iframeContent;
// Case 6 creates a complete `document` de novo, then inserts it into the `iframe`
d=document.implementation.createHTMLDocument('Editor IFRAME')
d.open(); d.write(iframeContent); d.close();
l = document.body.appendChild(document.createElement('iframe'));
d2 = l.contentDocument;
d2.replaceChild(d2.adoptNode(d.documentElement), d2.documentElement); (4) As you can see, |
Just wanted to say thank you @hideheader, awesome work! |
This pull request is a pair of MutationObservers that copy Stylish The PR only adds styles when the Both If you want to experiment, the penultimate commit before the PR can add a MutationObserver on |
Committed a fix to the iframe mutation observer. Evidentally the test page I stole from @hideheader never actually triggered this functionality. More testing is welcome. |
My, that was lucky. If you hadn't refactored the code and broken it we still wouldn't know that there's a blind spot in the test cases. What condition is it that wasn't being triggered? |
The iframe mutation observer never ran; I assume because the iframes were added before the content script ran. So everything appeared to work, whether loading the page with the style on or turning it on after load, but only the page load logic was being exercised. |
Fixed the pushState case for feedly. |
Fixed, evidently, may be closed. |
Still appears not to work with the following URL: https://mail.google.com/tasks/canvas?pli=1 Test case:
|
@SicariusNoctis Google changes element class names with every new page load. Target elements using a nodeName and DOM structure (e.g. |
I don't think that's the issue here: the class names stay consistent, or at the very least, every time I refresh the page. The problem is, they are inside an iframe, and there appears to be no way to target them. |
Can't reproduce on Chrome 53.0.2767.4 dev-m. |
It is not working on Firefox 47.0 (release) running Stylish 2.0.6 (release). EDIT: It does work on Google Chrome, however. |
There's a separate issue #166 as Firefox's Chrome-compatible WebExtensions API is still incomplete. |
Still doesn't work for me with a |
From stylish-userstyles/stylish#103
http://forum.userstyles.org/discussion/15032/how-to-apply-css-to-content-within-an-iframe
https://code.google.com/p/chromium/issues/detail?id=76429
The text was updated successfully, but these errors were encountered: