-
-
Notifications
You must be signed in to change notification settings - Fork 426
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
Error when using splide in a iframe in chrome #931
Comments
How do I reproduce the issue? It's working in my chrome: To be honest, I don't want to mock |
In neos the middle is a canvas (iframe) (WYSIWYG editor) in which i have my splide track list and such and it all works fine in firefox because it gives the exact same things to the isHTMLElement and returns true. another thing to know is i run my js outside of the iframe and attache to splide thingies in the iframe it was also once discussed here #611 |
Then, Splide works in an iframe, but doesn't in neos CMS. |
it must be some sort of bug in chrome when checking |
This behaviour is due to the different "contexts" of the main window and the iframe (conceptually considered as a different window) see So it's not a bug in Chrome, it's a "feature" of Javascript. |
Of course |
I don't know about neos. I experienced the issue on some other HTML editor (grapesjs). My understanding is that |
Sorry i dont know the inner workings of neos i just know my splide elements are inside the iframe and my js code is executed outside of the iframe and when it has the element and tries to check it with |
If that's the case, I know the solution. I'll create a new branch so that you can test it. |
Done in this branch: If you are using npm, you can install the branch by: npm i Splidejs/splide#iframe |
Thank you for your proposal, but everything is clear now. Well, I think initializing Splide from the different window is not a good idea, since it's problematic and probably unsecure. But anyways, the issue has been solved. I will merge the branch to the master after double check. |
Alright thank you but for your security concerns: It will only work if the iframe is created and runs on the same website else you will get in touch with CORS errors when trying to access the contents of an iframe. Anyways i will close this ticket up then |
@Gizmo2109 @NaotoshiFujita @beezital on both chrome and edge , while everything works fine on firefox . |
Checks
Version
v4.1.2
Description
When using splide in an iframe and while using chrome an uncaught Error appears: "[splide] A track/list element is missing." even though all track and list elements are present. I debugged and found that in splide.esm.js:66 (uncompiled: type.ts:75) the function isHTMLElemnt returns false when given the 'splide__list' element because it is a HTMLUListElement and only inherits HTMLElement. I have already found a fix by @beezital (GrapesJS/grapesjs#4062) but it was never pulled. I already have an open pull request (#932) so it would be nice if you pulled it.
Reproduction Link
No response
Steps to Reproduce
Expected Behaviour
It is expected to work in an iframe in chrome
The text was updated successfully, but these errors were encountered: