Re: [css-houdini-drafts] [typed-om] Trim CSSResourceValue and subclasses to opaque objects for this level, punt rest to level 2

> This URL will always be either absolute, or a bare hash. 

If fragment-only URLs are going to have different behavior, should the type object have a boolean attribute indicating whether it is an absolute URL or a fragment?

> people rarely, if ever, pull properties between documents anyway, and if they do, they probably don't expect their URLs to change!

SVG `<use>` elements from another file effectively pull in URL references, including absolute and fragment-only references, both of which are expected to remain relative to the original document. (And Chrome has broken things a few times in the past year or so as things switched to shadow DOM model.) Even same-file hash references aren't fully defined for a shadow DOM model.  I tried to summarize intended behavior [in the SVG spec](https://svgwg.org/svg2-draft/struct.html#UseShadowTree), but it would be nice to have a more universal model to build on.

> I also need a CSSURLValue, subclass of CSSStyleValue, representing the url() syntax. All url()s are reified as this, because in some cases we can't tell what type a url() should resolve to until after we fetch it,
> ...
> In the next level we'll add a CSSURLImageValue, subtype of CSSImageValue, which you can obtain from a CSSURLValue (either thru a constructor, or a promise-returning method, or something)

I think the one thing that is missing from your model is a way to distinguish an _unresolved_ URL from a resolved URL that isn't an image type. Maybe that could be indicated by an attribute (`resolved = true`), or maybe the unresolved URL would be its own type (`CSSUnresolvedURLValue`), which has a method or attribute to access the Promise that returns the resolved type object, whether that's a `CSSImageURLValue` or some other type that subclasses `CSSURLValue`.

> CSSURLValue details:
> ...
> - will have a constructor that takes a URL

Does it make sense to have a constructor for the "unresolved" type? Should the constructor accept a class name of the type you're trying to resolve as?  Or, to be able to fully model the behavior of `mask-image` and so on, a list of types in order?



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

Received on Wednesday, 28 February 2018 20:23:51 UTC