Re: [css-houdini-drafts] TypedOM returning an array of strings isn't a helpful behavior

> For example, ```box-shadow: red 2px 2px var(--foo) 0px;``` looks 
like the --foo var is just setting the blur radius, and so the last 
length is the spread distance. But it could be ```--foo: , blue 
3px;```, so that last length is actually the vertical offset on a 
second shadow.

Of course, but why do you always bring up this? I fail to understand 
how this affects my proposal... My proposal literally would have 
returned an unparsed ```{cssText,cssTextSlices,content}``` value whose
 content is an array of 5 values (a bare one of "red", a 
```{cssText,value,type}``` one for the "2px"/"0px" and a 
```{cssText,variableName,fallback}``` one for "var(...)". 

If me, author, knows that I will set the variable to a length, I can 
go ahead and update the next numeric component by setting its value to
 something else, then reassign the whole thing to the style. I will 
have to formally make that assumption, no "pre-parsing as a list of 
box-shadow" will be made for me, but I am still free to write code 
based on that assumption and the raw data.

Now, I hear you are not a huge fan of this, I'm just telling you this 
is a behavior that users of your API are likely to find useful because
 it enables them to not ship their own parser. I cannot take the 
computed value where variables have been replaced and set it as the 
specified value, because I would loose the variables references in the
 process.

Again, this is probably fine as a v2 addition, but I believe this is 
something you will find limiting when trying to use the api in the 
wild.

> If we have typing information for all the variables in a property, 
we should be able to go ahead and do a full grammar 
match/decomposition, and then present you with the full normal Typed 
OM value you'd get without variables; some of the leaf values would 
just be vars rather than the expected type, is all.

This would provide a solution to my first use case, but it looks more 
difficult to me than you seem to think it is. I might be wrong, 
though...

-- 
GitHub Notification of comment by FremyCompany
Please view or discuss this issue at 
https://github.com/w3c/css-houdini-drafts/issues/208#issuecomment-221431441
 using your GitHub account

Received on Tuesday, 24 May 2016 23:23:53 UTC