-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Fancybox fails when page is rendered as XML/XHTML #623
Comments
I do not see why the file extension should impact JavaScript. |
Citation: https://developer.mozilla.org/en-US/docs/Writing_JavaScript_for_XHTML There are numerous reasons why this is the case, the most common of which is document.write() which should be replaced with node creation for the most part. |
As a test case -- you can use the provided demo file, and change the first three lines to the following: then save the file as "index.xht" and open it in the browser. You'll see FancyBox fails. |
You should then make changes to the file as noted in the page you posted. |
The changes in the link posted are for the javascript -- there is no change to be made to the source code. As I mentioned, doing nothing more than changing the opening lines of the provided demo to:
Will break the implementation (I'd upload the file if I could). Or, to quote the Mozilla dev document:
On my own page, for the pages I need FancyBox, I'll probably change the way some things are served and do further debugging, but for broad compatibility, this is a change that's need in FancyBox, and a legitimate bug for a legitimate use case (serving a document as xhtml, thus using the faster xml parser in a browser and strictly enforcing correct code syntax). To once again quote Mozilla:
I like what I see here, and I'd love to see it properly compatible! |
Why is this closed? Fancybox is still not xhtml-compatible. |
Because it's 2017. Stop using XHTML, get on with HTML5. Else go back to Fancybox 2 if that's the era you want to work in. |
@mjcampagna HTML5 fully supports XML-serialized HTML, or XHTML. It is a current standard and used by many templating systems. It is an active part of the HTML5 standard: https://www.w3.org/TR/html5/the-xhtml-syntax.html And especially when dealing with a commercial product like Fancybox (yes, I would be a commercial user), "stop using XHTML" is hardly helpful or appropriate. |
@Spetnik Sorry, I have no idea what do you mean by "not xhtml-compatible" and you have not given any clue. I do not see any issue with fancyBox - it creates valid html code that you can customize, if needed. Yes, the script uses HTML5 data attributes, but you can write your own click handler that opens fancyBox manually (using |
@fancyapps Thanks for the response. When clicking on a fancybox element in a page served as "application/xhtml+xml" (the content-type for XHTML), Chrome gives the error: I'll create a pull request to fix the issues. |
Title says it all. Doesn't do a thing. By changing the file extension, for example, from .html to .xht (or by changing the way the server delivers the file) it breaks FancyBox.
The text was updated successfully, but these errors were encountered: