Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Anyone else noticed this issue?
- Justin E. Miller
March 7, 2008, 7:57 am
rate this thread
right? Running the validator on my page, I got it being correct as
src="script2.13.js"></script>. I would figure one would want to use the
former considering it uses less bytes of data, though largely irrelevant
on most connections.
I'm using Firefox 3.0 B3 and have noticed that the page is blank,
despite it passing validation by the W3 validator. The same page works
in Opera and Firefox 126.96.36.199 though. Not unsurprisingly, it doesn't
work in IE 6. I'm running Linux, so I can't run IE7 currently to test it
in there. It seems to be a bug with the programs not handling the
XHTML+XML declaration, so I submitted a bug report to Mozilla. I just
wanted to see if it was just my computer screwing things up.
Transitional and these are just scripts from that book. I changed the
code to be Strict because I prefer to use it.
They are online at:
I don't need any feedback on it other than whether or not it works in
the browser you're using.
Thanks for your time.
Re: Anyone else noticed this issue?
What makes you think so, and specifically that it is _the_ correct
declaration? Which part of the XHTML 1.0 specification made you draw
Does that surprise you? Why?
The following is valid, too, though not correct:
<script type="I made this up!" src="And this too!">Nothing to be seen
Why are you using XHTML in the first place?
The "self-closing tag" idea, often advertized as fundamental to XHTML,
is generally misunderstood and it wasn't a great idea from the
beginning. An element with EMPTY declared content is generally something
tricky and a symptom of retrofitting a simple quick-and-dirty tagging
system into the formal framework of "generalized markup" (first SGML,
later XML); see
On the technical side, both XML and XHML specifications say clearly that
"for compatibility", the self-closing tag construct should be used for
elements with EMPTY declared content (i.e., for elements that can never
have any content, by the syntax rules), and for them only. So although
<div /> is valid, it should not be used; ditto for <script ... />.
In practice, legacy browsers (especially when in text/html parsing mode)
may well ignore the slash and treat <script ... /> as <script ... >, and
there goes the rest of the document. By HTML _specifications_ up to and
including HTML 4.01, the slash has a special meaning, but completely
different from XHTML rules.
HTML is best learned from books on HTML. There are many books on HTML.
Unfortunately, most of them are between sloppy and miserable, and the
best one (coauthored by me) is available in Finnish only; sorry. But I'm
sure some of the HTML books often mentioned in this group are good.
That's the shrewd way of getting feedback on Usenet. :-)
The very first script is this:
are _so_ outdated. You often see document.write() in legacy code, but
it's _not_ the modern way, especially if playing with XHTML. You're
supposed to manipulate the document tree, using a W3C-approved Document
Object Model, instead of throwing in strings to be parsed as (X)HTML at
Jukka K. Korpela ("Yucca")
Re: Anyone else noticed this issue?
Technically, yes. But the behaviour of may current browsers is to
interpret XHTML pages as if they were plain old HTML unless they are
served with an XHTML or XML Content-Type header. Thus your <script>
element may be parsed according to HTML rules, and interpreted as if it
That is, no closing tag -- so the remainder of the page is seen as being
*part* of the script!
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 188.8.131.52-mm-desktop-9mdvsmp, up 37 days, 17:22.]
[Now Playing: Ray Charles - Funny but I Still Love You]