Forum Moderators: open
I have some php session and query code at the top but echo "test" gets printed everywhere, so i dont think the problem is in the php code.
On FF3 Beta Mac source view, color coding in the source stops after this line. "test" also doesnt get printed out anymore after this line in IE PC but plcaed higher up in the head section it does.
<script src="js/jquery-1.2.2.pack.js" type="text/javascript" /> W3C shows a few trivial non validation issues but nothing related to that line. Firebug shows no errors at all and im in standards compliance mode.
the issue is def to do with the line above, but thats about as far as i get. Anyone?
[edited by: tedster at 4:18 pm (utc) on Mar. 30, 2008]
Obviously the self closing tag created a problem that both IE7 and Notepad++ recognised, but what is that problem? Afaik, using a closing tag on a simple JS link is not required if it self closes?
Problem is solved but I'd love to find out the reasoning behind this.
By the way, I don't personally use XHTML right now, although many of my clients do. Here's a very important thread on that topic:
Why most of us should NOT use XHTML [webmasterworld.com]
afaik using self closing tags does pass W3C xhtml validation
Yes, it's perfectly valid XHTML... however it's invalid HTML (where
script requires a closing tag [htmlhelp.com]). The unexpected result is a combination of two myths: the first myth is that XHTML syntax is compatible with HTML syntax, which is not the case as you have demonstrated. The second myth is that IE supports XHTML syntax. You were serving the page as HTML (mime type
text/html) so the syntax you used validates as XHTML, but is broken HTML. IE only supports XHTML to the extent that only HTML-compatible markup is possible. Trailing slashes are simply discarded by the browser as unknown (erroneous) attributes, and as such the script element in your first example is seen by the browser as being unclosed. The fact that the page doesn't display with your example markup is "correct" handling when dealing with HTML and not XHTML.