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
Doesn't work cross-document #199
Comments
Might be able to get |
Try to set the |
I didn't notice this at first & tried playing around with it last night. Could you explain it a little further? Is jQuery needed within the frame? What's needed within the frame? Does this work if the target iframe is not within the document? I've a setup like:
|
oh. sorry that i didn't get what you had said.
It doesn't need any js or css in that iframe context. And atwho's view, the dropdown menu, have to work in current so, I think, you are right, it doesn't work with sibling document. I'm so curious about why you do this?! It is so strange, at least, i think. |
I'm building something that involves third-party JS. So someone puts a snippet on their page, this snippet injects a "main" (hidden) iframe, which controls everything, including the injecting other firames into the parent webpage, it has a view model which the other iframes' html is bound to (two-way data-binding), etc. Think Disqus / Facebook's like button / etc. but with multiple iframes. So, all the JS is in this main iframe and the other have HTML & CSS. I really don't mind having HTML & CSS for atwho in the other iframes (there could be many of them), but I'd like the JS in the main one. So the main one could inject the iframe and set up everything like atwho within the iframe. I was suprised that you put the HTML & CSS in the document calling atwho and overlay it over the iframe anyway, seems strange. Like, it makes sense to me that it would belong to the inner document. Where you do things like https://github.com/ichord/At.js/blob/master/dist/js/jquery.atwho.js#L789, I think it should inject the container into the target iframe. I'm not sure how you'd handle CSS though, whether you just tell users that they need the CSS in the iframe or you'd inject the CSS into the iframe in your plugin. |
And these is base on embed iframe editor in current document. Because this are the use cases that i know so long. But, i agree with you and thanks your explanation. |
What if in I'm not if that will fix it completely, I'm not 100% sure why it doesn't work as is, there may be more problems than just that. |
By the way, I agree about customizing CSS, etc. |
call I have to make it compatible by adding a flag such as |
And Have to use the specified |
Thank you 👍 |
check out the example in |
Thanks so much for doing this! Seems like it does what I need (assuming that it'll work if I use a Did you notice that |
Ok, to use it with a textarea I had to do:
It seems to work except for the positioning and displaying of the |
I have had a try, and it still work in the example. |
I'll create an example repository when i get a chance. |
Ok, I've created adam-lynch/atwho-cross-document-test which shows the problem. Atwho is auto-ran but you won't see it because the positioning is off. You could just open dev tools and inspect the |
You are using the wrong version of |
What? It's using the |
yes. The |
I have to change |
Yep, that seems to fix it (adam-lynch/atwho-cross-document-test@820fcf4) 👍 |
cool. I will merge and release it later. |
Let's say I have an iframe A with jQuery, atwho, etc. and an iframe B with just HTML & CSS (incl. the atwho CSS).
In my first iframe I can do stuff like
$(selector, iframeB.contentDocument)
which will use the other iframe's document as context. Works perfectly.This doesn't work:
$(selector, iframeB.contentDocument).atwho()
.But this does:
iframeB.contentWindow.$(selector, iframeB.contentDocument).atwho()
(assuming I now have to load jQuery & atwho in the other iframe).I don't know exactly why. It seems to be assuming the window/document is the current window/document. It might be parts like https://github.com/ichord/At.js/blob/master/dist/js/jquery.atwho.js#L789 where maybe it should pass the same context I passed to
$(selector, iframeB.contentDocument)
?I tried looking into it but I can't seem to find out how a plugin can access which context was originally passed.
The text was updated successfully, but these errors were encountered: