Re: [csswg-drafts] [css-variables] Relative URL resolution in var() references

Looks like we are going to discuss this on the call tomorrow so here 
is the summary of my thoughts:

- Currently relative url() do not work in Edge and Chrome at all, 
because at the time we do the replacement we do not know how to 
resolve the url. In both our browsers this will require a fix, and it 
seems worth fixing this properly instead of fixing this the wrong way.
 It doesn't seem very difficult to me to keep track of url tokens and 
url functions and resolve based on their origin instead of where they 
are used

- Second, I think not resolving uri properly is a major issue has this
 prevents inline styles to work, generic wordpress themes, as well as 
componentized css like the sort of which we want web components to do.
 Variables moving from outside the component to inside it will not 
work as expected.

- Third, I think Tab's solution is not going to work. (3.1) You cannot
 define a property like "background" using the proposed level 1 of the
 Houdini spec, and that seems by design. Even worse, even if you 
could, that means that if a component did it to make things work, it 
would not be able to support new syntax for background that are not 
compatible with its micro-syntax. That seems terrible. (3.2) The kind 
of replacement Tab suggests would only work if you replace the 
computed value of property in, since urls are resolved at computation.
 I argue this is impossible, because length properties for instance 
would resolve "em" based on their current element and not based on 
where they would be used. Worse, what if you do "--custom-length: 1em;
 font: var(--custom-length);". If you argue only url-typed properties 
should resolve at computation time because they won't cause such 
conflict, then this doesn't solve complex properties like background 
either, so that doesn't get you anywhere. In addition to being super 
confusing, that is.

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

Received on Wednesday, 14 December 2016 01:08:15 UTC