An SVG file is a graph: elements point at other elements by id. The explorer’s Resources tab has a References table with every pointer, where it leads and whether the target exists and is of the right kind, and an Ids table with how often each id is used.
The three kinds of address
| Written as | Where it points |
|---|---|
#id | An element of this document. The id is percent-decoded first. |
file.svg, file.svg#id, https://… | Another document. Not loaded when the SVG is shown as an image, and often blocked for use by the same-origin rule. |
data:image/png;base64,… | A file inside this one. The explorer lists each embedded image, decodes it and lets you open it as a file of its own. |
href and xlink:href
SVG 1.1 writes links as xlink:href with the XLink namespace
(xmlns:xlink="http://www.w3.org/1999/xlink"). SVG 2 uses a plain
href and deprecates the XLink form, which still works everywhere and is
still needed by old software. When both are present href wins.
| Element | href points at |
|---|---|
use | Any element to copy, not one that contains the use. |
a | An address to open, or a view. |
image, feImage | A picture file; feImage may name an element. |
linearGradient, radialGradient | Another gradient to inherit stops and attributes from. |
pattern | Another pattern. |
filter | Another filter (SVG 1.1). |
textPath | A path (SVG 2: any basic shape). |
mpath | A path for animateMotion. |
animate, set, animateMotion, animateTransform, discard | The element to animate, when not the parent. |
script | A script file. |
tref (1.1) | The element whose text to copy. |
url() references in properties
| Property | Must point at |
|---|---|
fill, stroke | linearGradient, radialGradient or pattern. A fallback after the address (url(#g) red) is used if the server is missing; without one, a missing reference is an error and the shape is not painted (SVG 1.1) or painted with none (SVG 2). |
clip-path | clipPath |
mask | mask |
filter | filter. A missing filter turns the element off in browsers. |
marker-start, marker-mid, marker-end | marker |
cursor | cursor (SVG 1.1) or an image address |
The same references can sit in style attributes and in style sheets
(.a { fill: url(#g) }); the explorer follows those too. The address may be
quoted: url("#g").
Other kinds of name
inandin2on filter primitives name aresultof an earlier primitive in the same filter, orSourceGraphic,SourceAlphaand the oldBackgroundImage,BackgroundAlpha,FillPaint,StrokePaint.beginandendof animations name another animation or element:begin="a.end+1s",begin="b.click".aria-labelledbyandaria-describedbynametitleanddescelements by id.- A URL fragment can name a
view:file.svg#front.
What the explorer reports
- an id that no element has, with the attribute and element that refer to it;
- a reference to an element of the wrong kind (a
fillpointing at aclipPath); - a
useinside the element it draws; - an
inthat names a result no earlier primitive makes; - an id used by more than one element, or containing white space.
Not described
This page is partial.
- Reference: the exact error handling of each element for a broken reference, cross-origin rules for
useandimage, and the#svgView()fragment syntax are not described in full. - Viewer: resolves references inside the file, checks their kind, and lists the others. It does not fetch addresses, follow references into other files, or check
aria-labelledbytargets;beginandendids are checked only for the formid.event.