Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
[css-typed-om] What should CSSNumericValue.type() do? #482
Currently the IDL just says
The Working Group just discussed
The full IRC log of that discussion<nainar> Topic: What should CSSNumericValue.type() do?
<nainar> Github: https://github.com//issues/482
<nainar> TabAtkins: before calc stuff type was easy - returned string with unit or generic thing like length
<nainar> TabAtkins: difficult due to calc stuff. Map of type to power.
<nainar> TabAtkins: Q now is what form is type in JS. Simple answer: object literal from type to integer powers.
<nainar> dbaron: omitt things that are 0?
<nainar> TabAtkins: Not always. Type maps keeps track of 0 things. Cant add pixel to s/s
<nainar> TabAtkins: incompatible expression .
<nainar> TabAtkins: one type thaat is pixel. Other one is a mathdivide of s/s
<nainar> dbaron: its unitless?
<nainar> TabAtkins: its unit is still time?
<nainar> dbaron: ...
<nainar> TabAtkins: I remember preserving zero types for a reason...
<nainar> TabAtkins: If I can remember why there may have been zero types at one point.
<nainar> dbaron: will there be a simple way to access abstract dimension of unit?
<nainar> dbaron: eg px diided by em. Remember that px/em but abstractally itss unitless
<nainar> TabAtkins: yes that is what the type map tracks and returns
<nainar> TabAtkins: describes how to produce a type from various things...
<nainar> TabAtkins: maps categories to powers
<nainar> TabAtkins: One limitaation - general caswe - where you are trying to handles % correctly. Hvave to do type inference to see if expression is avllid. There are some compocated div case that shoudl work but are rejected by my expression
<nainar> dbaron: this is becaue you arent converting % to what it si equivalent to
<nainar> TabAtkins: So i nedto checkthat if % wa converted to a valid typed would it be a valid type?
<nainar> TabAtkins: Just returning a map is simple and does job - in simple cases it is more complicated than needed. this addressed general case?
<nainar> fremy: Can we get a helper that gets type and returns whether the map is of that type?
<nainar> TabAtkins: Yes to and to Sum fucntion takes input and throws if it cant convert.
<nainar> RESOLVED: type() will be a map of units to powers