473,396 Members | 1,852 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

direct javascript deprecated?

At http://www.quirksmode.org/js/placejs.html
I found a discussion on how & where to place your javascript.

Toward the bottom of the page, PPK has a section titled Deprecated:
Direct JavaScripts, with a small blurb that says "Do not use direct
JavaScripts. This section is only maintained for historical reasons."

For clarity, he is referring to a practice like:

<script type="text/javascript">
// Some javascript here
</script>

So - this is deprecated? This is something that shouldn't be done?

I can think of many instances where this would be the only way to
accomplish some things, and at least a few where it is a preferable
solution to loading & executing a script from an external file.

So - is this really deprecated? Or is the information presented
innacurate? Or perhaps something in between?
Apr 12 '06 #1
3 2804
VK

Tony wrote:
At http://www.quirksmode.org/js/placejs.html
I found a discussion on how & where to place your javascript.

Toward the bottom of the page, PPK has a section titled Deprecated:
Direct JavaScripts, with a small blurb that says "Do not use direct
JavaScripts. This section is only maintained for historical reasons."


That is a la W3C text (by style, not by origin). I mean it is not
enough to read it: you need also decrypt the intended sense out of bad
wording and typos.

Of course <script> is not deprecated.

The relevant section is called "Deprecated: Direct JavaScripts", and
the note referes to the section's title. Must read:
"Do not use "Direct JavaScripts" recommendations for <script> tag
syntax. This section is only maintained for historical reasons."

In this form it is correct, because this legacy part refers to the
"language" attribute and the "hide the script" comment trick.

P.S. Overall <http://www.quirksmode.org> is good source of info; it
suffers a bit of standards' maximalism and "Micro$oft must die!" stuff,
but the overall quality of materials is high.

Apr 12 '06 #2
On 12/04/2006 19:21, Tony wrote:
At http://www.quirksmode.org/js/placejs.html
[snip]
<script type="text/javascript">
// Some javascript here
</script>

So - this is deprecated? This is something that shouldn't be done?
The exact code that's demonstrated is deprecated; it features the
language attribute and SGML comments. However, I agree that that doesn't
appear to be the focus of the term 'deprecated'.

No, embedded scripts are not deprecated, however I do support the
sentiment of using external files where practical, especially for large
or reusable code.

[snip]
Or is the information presented innacurate? Or perhaps something in
between?


It's certainly inaccurate in some respects, but it seems to suffer more
from age than anything else. The information in the FAQ Notes[1] is most
definitely better.

Mike
[1] <http://www.jibbering.com/faq/faq_notes/script_tags.html>

--
Michael Winter
Prefix subject with [News] before replying by e-mail.
Apr 12 '06 #3
VK wrote:

That is a la W3C text (by style, not by origin). I mean it is not
enough to read it: you need also decrypt the intended sense out of bad
wording and typos.

Of course <script> is not deprecated.

The relevant section is called "Deprecated: Direct JavaScripts", and
the note referes to the section's title. Must read:
"Do not use "Direct JavaScripts" recommendations for <script> tag
syntax. This section is only maintained for historical reasons."

In this form it is correct, because this legacy part refers to the
"language" attribute and the "hide the script" comment trick.
Ah - that makes more sense, then :) It didn't come across quite that
clearly, and I'm used to getting good info from PPK
P.S. Overall <http://www.quirksmode.org> is good source of info; it
suffers a bit of standards' maximalism and "Micro$oft must die!" stuff,
but the overall quality of materials is high.


I have found it to be a very useful resource
Apr 12 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: annon | last post by:
I've noticed that some problems come up frequently that are of importance in writing web pages, because they're pretty fundamental points. For general reference, here are some collected...
6
by: Mark Pappert | last post by:
I've got a linked 'common.js' file that contains one function, on IE and Firefox everything works as expected. However, Opera generates the following error: ...
2
by: Cy | last post by:
Hi, I have a menu that toggles correctly in IE but is failing in FireFox V.1 and Netscape 7.1. The FireFox JavaScript Console is returning the following error; Error:...
7
by: JSNewbie | last post by:
I am new to javascript. I used the code below in Netscape 7.0 and in IE 6.0. The Javascript portion does not render in Netscape , but it does show in IE. Can someone explain why? Any helpful...
1
by: jarit | last post by:
Hi, Found these coding guidelines for C#, HTML, Javascript, Java, HTML, PL/SQL, T-SQL, VB and VBScript. Well written and free to download. www.demachina.com/products/swat Jeroen
3
by: mbasil7 | last post by:
Hi at all! I want to use a javascript variable in php. The reason is that i want to know the client's screen resolution. Keep in mind that i am not a javascript programmer but php. Here is...
5
by: Nadav | last post by:
Hi, I am trying to get a direct pointer to the address of the screen ( something like 0x0b00 in the happy DOS days ), how can I do that? Should this be done in the kernel or it can also be done...
7
by: Jean Pierre Daviau | last post by:
I tried this in iexplorer, mozilla, opera. var in = 1; switch( in ){ case 1: in = "-1-"; break; case 2:
78
by: Jeremy J Starcher | last post by:
(Request for Discussion) I've put together a guide that I hope will help novice coders avoid the same hair pulling that I went through. I'm open for comments about it. Have I missed the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.