-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Konstantin,
On 8/8/15 8:54 AM, Konstantin Preißer wrote: > Hi Christopher, > >> -----Original Message----- From: Christopher Schultz >> [mailto:ch...@christopherschultz.net] Sent: Saturday, August 8, >> 2015 2:32 PM >> >> This is a common problem, and the reason for it is that <script> >> for some reason, in every browser I've ever seen, completely >> fails to parse correctly if it's a self-terminating tag like >> <script />. When you use .jspx, the input and output are assumed >> to be both well-formed XML where <script /> is perfectly >> acceptable. >> >> IMO this is a problem with browsers. Even in >> standards-compliance mode, they seem to demand that <script> be a >> paired tag. Thus, all of our script tags that reference external >> files are written like this: >> >> <script src="(script)" type="text/javascript"><!-- --></script> >> >> This will force the XML serializer to retain the comment and >> force a paired tag. > > Can you elaborate why you think this is a problem with browsers? > > The W3 HTML5 specification says at section 4.11.1 [1] for the > <script> element: > > Tag omission in text/html: Neither tag is omissible > > I read it so that when using HTML syntax (text/html), you cannot > omit the end element of a <script> tag. Section 8.1.2 (Elements) > [2] also doesn't seem to allow a self-closing tag for <script> > elements. Agreed. My experience is that even when using application/xhtml+xml, the browser still demands that both parts of the tag appear. It's been a while since I've bothered re-investigating the situation, since it's just easier to standardize on <script><!-- --></script> and have it work everywhere. > However, you can use the XML syntax instead the HTML syntax for > serializing HTML5, which means using a Content-Type of > "application/xhtml+xml". When using this content type, a browser > supporting HTML5 (including IE 9+) will use an XML parser, so a > syntax like <script /> will work on such documents. True, but older browsers are usually not compliant. Our application needs to support some stinky older browsers, so we unfortunately have to support the lowest common denominator (like usual with the web). > (The problem with XML syntax however is that there are some > JavaScript libraries that don't seem to be aware that there's an > XML syntax of HTML5 and will not work correctly, e.g. jQuery Mobile > up to version 1.4.5.) I wasn't aware of that; I was under the impression that jQuery operated on the DOM tree which has already been parsed by the browser. - -chris -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org iQIcBAEBCAAGBQJVx2SYAAoJEBzwKT+lPKRYEEIP/R8dH5jT/UY8nVI5o8nqpuLO 6MLYcKtZGqI2LZMuUKfQfR6ZnTuxqkbwhfxj8C/7KXddmA7FaPO6uonV7X92no7C qbkd+EPjiXP6AEC3xOoTc/WS5LR9oAnO/OJ0tuyAFd7zzd2M7JX1m2OxssANwlaQ a3VU4aNiuuulPyZqa9LZXEpjH3c5cI8/aHK/lJYjnl9z1MPuzXe1f1dt9XQw36nx W6u6mUROvHTqN4G3/3QBMaZJFTabRqSciPviFdfA5Hh6g0YuLgKDG2pmlBOJwd9P 5w/DAigfAe9b+8qPBayLRXftdx9szQcRfUv0VEALv58doJcU668vIXVm4OlA+/jt 6cRWupfiRiwIsFeiFoAeTY6KWqIIRBgdlNzs8jDf6Nr3HTxkhgBUo67dzCt8ZTUS 0wX5ZCnuadWBVOEZbCo+FV4MiQ0SA6XFwL4IO3Opb+anuG0+Gk00kSs2kwyx2QBK 3baqQ+jVqoARHTgsW+lwvwfLSn3EQY7J8MmRGWuzHD4+MFfQuqQ6IUYZKfhsb8k7 4pVzarAORYykbByNPt0VHZoh57qBoxHTt7Gt60InCXJDlkG0nCxXKkKjcwcsCJZQ Mi5vFKdbUASEmlU6incZomIsR1bO7enaVfvFyC44QS3iyM52vHgVU9LEXIIwm98K 8Da//e5mPmMtqVX5eQcB =vdED -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org