ericelliott / h5Validate

An HTML5 form validation plugin for jQuery. Works on all major browsers, both new and old. Implements inline, realtime validation best practices (based on surveys and usability studies). Developed for production use in e-commerce. Currently in production with millions of users.
576 stars 125 forks source link

XHTML / SyntaxError: An invalid or illegal string was specified #70

Open vinkl opened 11 years ago

vinkl commented 11 years ago

Line 257 should be as follows to work with XTHML:

$checkRequired = $('<input required="required"/>'),

instead of

$checkRequired = $('<input required="required">'),

Otherwise, when used with JQuery, it will cause:

SyntaxError: An invalid or illegal string was specified tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2];

ericelliott commented 11 years ago

Thanks for the report.

ericelliott commented 11 years ago

If you'd like to create a pull request and make sure all the tests still pass, that would be useful.

ericelliott commented 11 years ago

Just a warning about XHTML or XHTML5 -- IE has never properly handled XML mime-types until IE9 -- so if you need legacy IE support, I strongly recommend that you do not use XHTML unless you have a good content negotiation strategy in place on the server so you can serve HTML5 to old IE.

ericelliott commented 11 years ago

See How to Use XHTML5 and Why You Shouldn't