- Associate a mask (and similar resources) and its target content without relying on ID references
- For masks only, allow the masking behavior to use either the alpha or the luminance values of the mask content.
- For masks (and possibly clipping paths), allow using content not nested inside a <mask> element to be used as the mask content.
- clip-path → <clipPath>
- cursor → <cursor>
- fill, stroke → <linearGradient>, <radialGradient>, <pattern>
- filter → <filter>
- marker, marker-start, marker-mid, marker-end → <marker>
- mask → <mask>
- <feImage xlink:href> → SVG content
- <font-face-uri xlink:href> → <font>
- <textPath xlink:href> → <path>
Option A: Target points to resource
mask: <funciri> | none | inherit | child
Here 'child' means, "find the first child element that is a <mask> and use that."
Likewise for clip-path, cursor, fill, stroke, filter, marker*
For the xlink:href cases, we could add another attribute. Or, we could say that the lack of an attribute means "look to the child".
- To address the different alpha / luminance mask requirement we'd have to overload the syntax further, e.g.
mask: ([alpha] <funciri>) | none | inherit | ([alpha] child)
- To address the requirement for targetting non-<mask> (and non-<clipPath>) element content, we could either:
- say that only applies to the <funciri> syntax, or
- refine the meaning of 'child' to be something like, "find the first child element that is a <mask> and use that. If there is none, use the first child / make a group and use all the children".
- There is an inconsistency with animation in that an <animate> element without and xlink:href attribute targets its parent. But that's a different case because the <animate> is the resource, not the target. The directionality is already different to <feImage>, <textPath> etc.
Option B: Resource points to target
From Cyril, "Have a 'target-element' property (for lack of a better name) with two values 'parent' or 'by-reference', the default one being 'by-reference'."
<path ... > <mask target-element="parent"> ... </mask> </path>
- What happens if you target a <mask> with target-element="parent"?
- How to address the alpha vs luminance this way? Just add an attribute to the <mask> element?
- How to address the requirement for using non-<mask> (non-<clipPath>) content? We could say that only works for mask: <funciri> syntax.
- The inconsistency with <animate> still remains but that seems unavoidable. Specifically, the for <animate> element, the default value of target-element is "parent" and the meaning of "by-reference" is by my reference and not by where I'm referencing.