473,320 Members | 1,845 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,320 software developers and data experts.

css clas names allowed to have - but not _ ?

I was reading some old groups.google.com posts about css class names not
being allowed underscores, but hyphens are?

Why exactly did the writers/drafters of the spec think this was better
then allowing underscores? Most any programming languages alow _'s in
identifiers and NOT -'s, like Java, C, C++, Perl, ASP, PHP, JavaScript,
hell even Pascal.

Why did the turn around something most developers were/are customed to
when thye drafted the css specs? Almsot seems liek this was put in there
to purposely piss us off. (I just spent a good hour changing names in
our css code that has _'s to -'s because NN4 and some Mozzilla versions
choked on them.)

Thanks.
Jul 20 '05 #1
6 2180
Damian wrote:
(I just spent a good hour changing names in
our css code that has _'s to -'s because NN4 and some Mozzilla versions
choked on them.)


Find & Replace could have done that for you in no time at all.

--

Barbara

http://home.wanadoo.nl/b.de.zoete/html/weblog.html
http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html

Jul 20 '05 #2
in post: <news:bv************@ID-196529.news.uni-berlin.de>
"Damian" <no********@adress.getting.too.much.spam.org> said:
I was reading some old groups.google.com posts about css class names not
being allowed underscores


corrected in the errata but not part of the spec
http://www.w3.org/Style/css2-updates...12-errata.html

--
brucie - i usenet nude
Jul 20 '05 #3
On Wed, 28 Jan 2004, brucie wrote:
in post: <news:bv************@ID-196529.news.uni-berlin.de>
"Damian" <no********@adress.getting.too.much.spam.org> said:
I was reading some old groups.google.com posts about css class names not
being allowed underscores
corrected in the errata but not part of the spec


Substantively changed in the errata, or purported to be (errata aren't
supposed to do that, but they didn't seem to care); as you say, the
change isn't officially part of the spec, but see draft CSS2.1.
http://www.w3.org/Style/css2-updates...12-errata.html


I think the hon Usenaut might also have been interested in why it was
so. Originally the idea was that names in HTML would be SGML name
tokens, and they're defined to start with a letter and then use
letters, digits and hyphen-minus. Nothing else.

Since CSS class and id names are referencing name attributes in an
SGML-based markup such as HTML, they were originally happy with a set
of rules for CSS that matched the rules for HTML...

However, both HTML and CSS subsequently got much more lenient about
what characters could be used in names. But most of the extra
characters have to be escaped if you want to use them in CSS.

For a latin-based language it's much easier to stick with the simplest
subset, if the choice is yours. I think W3C were worried that authors
writing Japanese or whatever would complain that they weren't allowed
to write their name attributes in their own language, and would then
accuse the W3C of being too English-centric.

Jul 20 '05 #4
Barbara de Zoete wrote:
Damian wrote:
(I just spent a good hour changing names in
our css code that has _'s to -'s because NN4 and some Mozzilla
versions choked on them.)


Find & Replace could have done that for you in no time at all.


Yes, but it was quite cumbersome having to keep "Find Next"ing whne
fishing through Perl code that prints soem html to a shtml page (sorta
liek a PHP or ASP script.) ;p
Jul 20 '05 #5
It seems "Alan J. Flavell" wrote in
comp.infosystems.www.authoring.html:
I think the hon Usenaut might also have been interested in why it was
so. Originally the idea was that names in HTML would be SGML name
tokens, and they're defined to start with a letter and then use
letters, digits and hyphen-minus. Nothing else.


You knew someone would ask a follow-up question, so let it be me:

Why were SGML names defined in that fashion, allowing minus but
disallowing underscore?

--
Stan Brown, Oak Road Systems, Cortland County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2 spec: http://www.w3.org/TR/REC-CSS2/
2.1 changes: http://www.w3.org/TR/CSS21/changes.html
validator: http://jigsaw.w3.org/css-validator/
Jul 20 '05 #6
Stan Brown <th************@fastmail.fm> wrote:
It seems "Alan J. Flavell" wrote in
comp.infosystems.www.authoring.html:
I think the hon Usenaut might also have been interested in why it was
so. Originally the idea was that names in HTML would be SGML name
tokens, and they're defined to start with a letter and then use
letters, digits and hyphen-minus. Nothing else.

Actually SGML allows the period (full stop, ".") character in names
as well by default, i.e. in the reference concrete syntax (Ref.:
ISO 8879, clause 9.2.1), and HTML has done so from the beginning, see
http://www.w3.org/MarkUp/html-spec/h....html#SEC3.2.3

In a class name, a period is a particularly poor choice in practice,
however. It is true that it can be used in a class name in CSS too, but
then it needs to be escaped somehow (e.g. as \.) to avoid
interpretation as being part of selector syntax.
You knew someone would ask a follow-up question, so let it be me:

Why were SGML names defined in that fashion, allowing minus but
disallowing underscore?


I cannot find any quick direct answer to that in the SGML Handbook, but
then again who has ever found a quick direct answer there? :-) But my
half-educated guess is that "-" was regarded as a character that is
surely available in all circumstances and more natural-looking than the
underscore. After all, the underscore (underline, "_") character was
originally taken into Ascii to be used for underlining (together with
the control character for backspace or carriage return), though it - as
well as other special characters - were later taken into use as a
special name character in programming languages and other notations.
(To be exact, it originally had a dual purpose, including a control
function in teleprinters as the other usage, see
http://www.cs.tut.fi/~jkorpela/latin...i-hist.html#5F )

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 20 '05 #7

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

Similar topics

1
by: Jens Riedel | last post by:
Hello, we are planning to port an application from one database to different others, including DB2. While reading the GettingStarted document for DB2 Personal Edition I got a little confused...
3
by: Chris Sharman | last post by:
Are spaces allowed in names ? Eg <input name="my field" type="text" value="my data"> The html4 dtd seems to say this is cdata, which allows embedded single spaces, but say agents may trim...
2
by: Sound | last post by:
Enter space bar for field names and save the field.The field shoud not get saved and an alert should be there as"Space bars are not allowed" Add a field without giving any name and save the...
31
by: rbhlgjwbvi | last post by:
I have a header whose filename contains an embedded newline and I can't seem to #include it successfully. I've tried #include "my file.h" and #include "my\nfile.h"
4
by: | last post by:
Given an XML file (dataset.writexml), here is my output (simplified for this posting): <?xml version="1.0" standalone="yes"?> <NewDataSet> <Category> <CategoryId>80</CategoryId>...
3
by: =?Utf-8?B?YWJheWVy?= | last post by:
In short: I have an application using the CommittableTransaction class that works fine when run locally, but does not escalate to MSDTC when deployed to a Windows 2003 R2 server. More...
4
by: Victor Lagerkvist | last post by:
Hello, I have the need to parse variable names from a string and save them somewhere safe for future usage. Here's my first attempt (I don't have any rules for valid names yet) - but I have a...
4
by: softwaredoug | last post by:
Here is some test code I've been attempting to compile (Visual Studio 2003) test.h: class Base { protected: Base() {} public:
2
by: myemail.an | last post by:
Hi all, I need to export a table from Ms Sql to Access. However, dts import/ export gives me an error because the field names are too long. Is there a quick way to trim the names of all fields...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.