- From: <david_richmond@nl.compuware.com>
- Date: Mon, 30 Mar 1998 03:45:39 -0500 (EST)
- To: www-html@w3.org
Name : David Richmond Contact : david_richmond@nl.compuware.com Home Phone : +31 20 690 1217 Home Address: S. de Beauvoirstraat 20, 1102 AR Amsterdam, The Netherlands Date : 30 March 1998 This is a complete replacement version of my previous submission, please delete the previous submission. Data-Type Definition & Formatting ================================= I would like to see a formal HTML way of defining the type of simple data-types, and CSS options to format those types. The data-types should at least include Date, Time, Currency and numbers (with and without fractions). Others will certainly have suggestions on how to do this but I would prefer a 'datatype' HTML tag attribute which could be used on many HTML tags. Prime targets for its use would be the SPAN and INPUT tags. So, for example: <SPAN datatype=Number>1000</SPAN> <SPAN datatype=DateTime>1998.03.30T09:30+0100</SPAN> <INPUT type=text size=10 datatype=number> The CSS definitions would then be used to define formatting: SPAN[datatype="Number"] { number-format: default } Standard and specific CSS formats would need to be defined, some of which (the default?) should format based on the User Agent's default Locale. Using Microsoft Excel like format strings (e.g. "#,##0.00" for english language numbers) would be one option for specifying specific fixed locale format descriptions. Another important item is the sign (-ve or +ve) of the number. In typical english financial spreadsheet applications -ve numbers are formatted in parenthesis (e.g. "-1000" is formatted as "(1,000)"), and/or formatted in a highlighting colour such as red. This means a CSS selector needs to be defined that can check for the sign of the value, for example: *[content < 0] { color: red } This also means that the tag 'content' (sorry, I am (ab)using the CSS2 usage of the term) can be modified in the CSS definition (CSS2 only allows addition via the :before & :after & 'content' definition). This would be required to convert "-1000" to "(1000)" (i.e. remove the "-"), unless an extra HTML attribute was added for sign definition, for example. <SPAN datatype=Number sign=negative>1000</SPAN> which would change the selector syntax for the associated CSS definition to *[sign="negative"] { color: red } and which would, admittedly, make the 'datatype' attribute an increasingly ugly solution (maybe a <DATA type=date|...> tag would be better). Of course there are related issues for other data-types, such as 'is a date before XXX'. More HTML markup could then be formatted on the client via CSS based on its content (e.g. all overdue order dates highlighted in red). Within the DOM associated native Script data-types would be used to manipulate the datatyped values. INPUT Validation ================ Within <INPUT> elements the above "datatype" could be used for simple input validation, where the user can type in a value in their native language format but it is sent to the server in some standard format (i.e. in an unformatted, raw, form). My company makes development tools, and one of our biggest problems with HTML is input validation. We would love to do it on the client, but insisting on downloading Java class files is verging on overkill - and is not even an option if the user agent has it's Java VM switched off. Checking for Browser X, Y or Z supporting A, B or C is already causing enough headaches without adding more. CSS Aliases =========== This suggestion applies to those of us who write CSS by hand, as opposed to via CSS editors. It would be useful to be able to define an alias which can be used throughout the style-sheet, removing the need to duplicate definitions. This could be done via a @alias definition, for example: @alias MyClr { #FF00FF } H1 { color: MyClr ) P { background-color: MyClr } Now changing the single MyClr value changes all styles, instead of having to manually modify all the styles individually. However, there are a few potential 'gotchas' in this, for example: @alias hidden { visible } H1 { visibility: hidden } As a C/C++ programmer used to '#define' definitions I would expect H1 tags to be visible, but of course not everyone is a C++ programmer and it might be better to ignore such definitions (i.e. keywords take priority over aliases). I understand that aliases can open a 'can of worms', but for writing CSS sheets by hand not having the faciity is very, very frustrating. I would not mind if the above was offered in a very restricted form, i.e. only single values may be defined within {} brackets.
Received on Monday, 30 March 1998 13:19:07 UTC