Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

generated markup invalid for xhtml #450

Closed
andreasplesch opened this issue Sep 3, 2016 · 10 comments
Closed

generated markup invalid for xhtml #450

andreasplesch opened this issue Sep 3, 2016 · 10 comments
Labels

Comments

@andreasplesch
Copy link
Contributor

andreasplesch commented Sep 3, 2016

The radio type (and perhaps others) generate invalid markup for a xhtml document. This results in a fatal exception. "<input />" would be compatible with both html and xhtml encoding.

Here is input menu demo as html:
https://andreasplesch.github.io/cobweb_dom/jQuery-ContextMenu/input.html

and as xhtml:
https://andreasplesch.github.io/cobweb_dom/jQuery-ContextMenu/input.xhtml

There is this console message:

Uncaught SyntaxError: Failed to set the 'innerHTML' property on 'Element': The provided markup is invalid XML, and therefore cannot be inserted into an XML document.

@andreasplesch
Copy link
Contributor Author

andreasplesch commented Sep 4, 2016

I patched jquery.contextMenu.js to use <input /> and it does have the desired effect:

https://andreasplesch.github.io/cobweb_dom/jQuery-ContextMenu/input_fixed.xhtml

In the process, it turned out that the <select> tag did not have an end tag as it should. So I added the end tag as well.

The patched js works with the html encoding as well. I tested on Chrome 52.02, FF 47 and IE11 on Windows 7. Also on Android Chrome 52.02 and FF 48.

I could prepare a PR; the changes are rather trivial.

@bbrala
Copy link
Member

bbrala commented Sep 5, 2016

Thanks for putting in the effort to create a patch. I'm on vacation right now, but will have a look at your pr when it arrived.

@andreasplesch
Copy link
Contributor Author

andreasplesch commented Sep 5, 2016

PR #451 submitted.

@bbrala bbrala added the Feature label Sep 16, 2016
@bbrala
Copy link
Member

bbrala commented Sep 16, 2016

Thanks, from what i read it is valid in HTML5 also, but not in HTML4. But will have a look soon.

@andreasplesch
Copy link
Contributor Author

My understanding is that <input /> is not valid in HTML4 but that the w3c validation service at

https://validator.w3.org/

still recognizes it as strictly valid.

There are not many jquery based web pages which use HTML4 left but there may be only a few more which use XHTML.

The only browsers which may complain are perhaps IE6 or IE7 ?

@andreasplesch
Copy link
Contributor Author

andreasplesch commented Sep 17, 2016

I created a simplistic html4 page to test:

http://rawgit.com/andreasplesch/cobweb_dom/93be0ba5f9c4904cf71be2755d308deea110651a/jQuery-ContextMenu/Inputv4.html

or better

https://andreasplesch.github.io/cobweb_dom/jQuery-ContextMenu/Inputv4.html

IE6 on Netrenderer.com is happy with it.

https://developer.microsoft.com/en-us/microsoft-edge/tools/screenshots/

is another option. It works with the gh page and all tested browser (IE8 to edge, latest FF and Chrome, Safari, Android) are rendering correctly, eg. do not complain about <input /> in html4.

Screenshots for all tested browsers are successfully generated.

@andreasplesch
Copy link
Contributor Author

andreasplesch commented Sep 21, 2016

Any plans or questions about this PR ? If it is lower priority as a new feature, we would start to maintain and use a fork downstream.

@bbrala
Copy link
Member

bbrala commented Sep 22, 2016

I will look at it soon, and talk with some colleagues if they think this might be problematic, if not, it'll be merged :)

@andreasplesch
Copy link
Contributor Author

ok, thanks. I can understand that this is perhaps seen as risky given that xhtml is not used much. But I could not find a scenario where <input /> would not work as expected.

@andreasplesch
Copy link
Contributor Author

PR merged

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants