- From: <bugzilla@jessica.w3.org>
- Date: Sat, 26 Apr 2014 10:10:40 +0000
- To: public-css-bugzilla@w3.org
https://www.w3.org/Bugs/Public/show_bug.cgi?id=25475
Bug ID: 25475
Summary: pad example has width instead of pad
Product: CSS
Version: unspecified
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P2
Component: Counter Styles
Assignee: jackalmage@gmail.com
Reporter: jmichae3@yahoo.com
QA Contact: public-css-bugzilla@w3.org
http://www.w3.org/TR/css-counter-styles-3/#at-counter-style
example 9's code in the pad example has an error or maybe old code in it, has
width: 3 "0"; when it should probably have pad: 3 "0";
please document in this section also what happens if you use pad:0 "0"; or
pad:0 " "; I should hope this zero or space-pads the digits to fit the largest
amount of digits in the column (column width). perhaps the function below could
assist in this.
also, regarding pad and anything that has to do with numbers and width, I
cwould like to contribute an algorithm based on an equation I got from my
professor years and years ago.
could this function also somehow be made available as a css function like
calc()? for people doing line numbers, the width of the field is important, and
it would be nice to auto-size it according to the amount of code. there are a
lot of color syntax highlighters out there (and more in use too). should I make
a separate feature request for this? it could simply be called numdigits. I
would like to see it used with calc and attr().
/* js - this function works with integers, positive, negative, and 0, and tells
you the number of digits required. */
function NumberOfDigits(n, base, countMinusSign) {
//type checking
if ('number'!=typeof(number)) {
alert("NumberOfDigits() was fed type "+typeof(n)+" for n, should be
Number");
return 0;//failure
}
if ('number'!=typeof(base)) {
alert("NumberOfDigits() was fed type "+typeof(base)+" for base, should
be Number");
return 0;//failure
}
if ('boolean'!=typeof(countMinusSign)) {
alert("NumberOfDigits() was fed type "+typeof(countMinusSign)+" for
countMinusSign, should be Boolean");
return 0;//failure
}
//zero special case
if (0 == number) {
return 1;
}
//equation
return Math.ceil(Math.log(Math.abs(number) + 1) / Math.log(base)) +
((countMinusSign && (number < 0))?1:0);
}
this will determine the integer number of digits for a number, maybe it will be
useful for speeding up calculation of number of digits in a number (without
having to count all the digits and doing string conversion). from my web page
at
http://jesusnjim.com/programming/number-of-digits-in-a-number-for-any-given-base.html#floatingpoint
--
You are receiving this mail because:
You are the QA Contact for the bug.
Received on Saturday, 26 April 2014 10:10:42 UTC