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

> 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?

CSS doesn't have any special indicator between the two in the string syntax, so I don't think Typed OM particularly needs to do anything special here.

> 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, but it would be nice to have a more universal model to build on.

The only behavioral change I'm suggesting here is that relative URLs get absolutized when you reify them, so we don't have to depend on the (unspecified) absolutization time in CSS.  Absolute and fragment-only URLs will remain absolute or fragment-only, and so won't change behavior at all.

You can't extract a value from an element inside a `use`, so I don't think that will matter here.  We're not changing the underlying CSS value.

> 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.

The `url()` syntax will always reify as a CSSURLValue, no matter whether it's resolved or not, whether it's used as an `<image>` or something else.  And at this level, that's all that will happen.

In L2 I *expect* that we'll have a `.asImage()` method on the class that returns a CSSURLImageValue (currently doesn't exist, will be added in L2), which is specialized to be a url to an *image*, and thus can expose things like width/height.  (And more for any other specialized subclasses like CSSMaskReference or something.)

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

Received on Wednesday, 28 February 2018 22:26:45 UTC