/
linking.html
745 lines (621 loc) · 34.8 KB
/
linking.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional+edit//EN" "xhtml1-transitional+edit.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:edit="http://xmlns.grorg.org/SVGT12NG/">
<head>
<title>Linking</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
<link rel="stylesheet" title="Default" type="text/css" media="screen" href="style/default_svg.css"/>
<link rel="alternate stylesheet" title="No issues/annotations" type="text/css" media="screen" href="style/default_no_issues.css"/>
<!--
<link rel="alternate stylesheet" title="CSS3 Unmodified" type="text/css" media="screen" href="style/default.css"/>
<link rel="alternate stylesheet" title="SVG 1.1" type="text/css" media="screen" href="style/svg-style.css"/>
-->
<!-- W3C style sheet will be added here during processing. -->
</head>
<body>
<h1>Linking</h1>
<h2 id="URLReference">References</h2>
<h3 id="HeadOverview">Overview</h3>
<p>On the Internet, resources are identified using <a>URLs</a>
(Internationalized Resource Identifiers). For
example, an SVG file called someDrawing.svg located at
http://example.com might have the following <a>URL</a>:</p>
<pre>
http://example.com/someDrawing.svg
</pre>
<p>An <a>URL</a> can also address a particular element within an XML
document by including an <a>URL</a> fragment
identifier as part of the <a>URL</a>. An <a>URL</a> which includes an
<a>URL</a> fragment identifier consists of an optional base <a>URL</a>, followed by a "#" character,
followed by the <a>URL</a> fragment identifier. For example, the
following <a>URL</a> can be used to specify the element whose ID is
"Lamppost" within file someDrawing.svg:</p>
<pre>
http://example.com/someDrawing.svg#Lamppost
</pre>
<!-- from 1.2T - add this too?
<h4 id="AlteringHref">Altering the <span class="attr-name">'href'</span> attribute</h4>
<p>If the <a href="https://svgwg.org/specs/animations/#HrefAttribute"><span class="attr-name">'href'</span></a>
attribute of an element in the tree is altered by any means (e.g. script, declarative
animation) such that a new resource is referenced, the new resource must replace
the existing resource, and must be rendered as appropriate. For specific effects
on the scripting context when a <a>'script'</a> element's
<a>'script/href'</a> attribute is altered, see
<a href="interact.html#ScriptContentProcessing">Script processing</a>.</p>
-->
<h3 id="definitions">Definitions</h3>
<dl class='definitions' data-dfn-type="dfn" data-export="">
<dt id="TermURLReference">URL reference</dt>
<dd>An URL reference is an Internationalized Resource Identifier, as defined in
<a href="http://www.ietf.org/rfc/rfc3987.txt"><cite>Internationalized Resource Identifiers</cite></a>
[<a href='refs.html#ref-RFC3987'>RFC3987</a>]. See
<a href="linking.html#URLReference">References</a> and
<a href="struct.html#Head">References and the
<span class="element-name">'defs'</span> element</a>.</dd>
<dt id="TermURLReferenceWithFragmentIdentifier">URL reference with fragment identifier</dt>
<dd>An Internationalized Resource Identifier [<a href="refs.html#ref-RFC3987">RFC3987</a>] that
can include an <absoluteURL> or
<relativeURL> and a identifier of the fragment in that resource. See <a href="struct.html#Head">References and the
<span class="element-name">'defs'</span> element</a>. URL reference with fragment identifiers are commonly used to reference <a href="pservers.html">paint servers</a>.</dd>
<dt id="TermCircularReference">circular reference</dt>
<dd><a href="#TermURLReference">URL references</a> that directly or indirectly reference
themselves are treated as invalid circular references.</dd>
<dt id="TermInvalidReference">invalid reference</dt>
<dd>
<p>Either of the following:</p>
<ul>
<li>
<a href="#TermURLReference">URL reference</a> to node that do not exist.
</li>
<li>
<a href="#TermURLReference">URL references</a> to elements which are
inappropriate targets for the given reference shall be treated as invalid
references (see <a href="linking.html#processingURL">Processing of URL references</a>
for appropriate targets).
For example, the <a>'clip-path'</a> property can only refer to
<a>'clipPath'</a> elements. The property setting
<span class="attr-value">clip-path:url(#MyElement)</span> is an
invalid reference if the referenced element is not a <a>'clipPath'</a>.</li>
</ul>
</dd>
</dl>
<h3 id="URLandURI">URLs and URIs</h3>
<p>Internationalized Resource Identifiers (<a>URLs</a>) are a more generalized
complement to Uniform Resource Identifiers (URIs). An <a>URL</a> is a sequence
of characters from the Universal Character Set [<a href="refs.html#ref-UNICODE">UNICODE</a>].
A URI is constructed from a much more restricted set of characters. All URIs are
already conformant <a>URLs</a>. A mapping from <a>URLs</a> to URIs is defined by
the <a>URL</a> specification, which means that URLs can be used instead of URIs
in XML documents, to identify resources. <a>URLs</a> can be converted to URIs
for resolution on a network, if the protocol does not support <a>URLs</a>
directly.</p>
<p>Previous versions of SVG, following XLink, defined an URL reference type
as a URI <em>or as a sequence of characters which must result in an URL after a
particular escaping procedure was applied</em>. The escaping procedure was repeated in the
XLink 1.0 specification [<a href="refs.html#ref-XLINK">XLINK</a>], and in the
W3C XML Schema Part 2: Datatypes specification [<a href="refs.html#ref-SCHEMA2">SCHEMA2</a>].
This copying introduced the possibility of error and divergence, but was done
because the <a>URL</a> specification was not yet standardized.</p>
<p>In this specification, the correct term <a>URL</a> is used for this "URI or sequence of characters
plus an algorithm" and the escaping method, which turns URLs into URIs, is defined by reference to the
<a href="http://www.ietf.org/rfc/rfc3987.txt">URL specification</a> [<a href="refs.html#ref-RFC3987">RFC3987</a>],
which has since become an IETF Proposed Standard. Other W3C specifications are
expected to be revised over time to remove these duplicate descriptions of the
escaping procedure and to refer to <a>URL</a> directly.</p>
<h3 id="URLforms">Syntactic forms: URL and <url></h3>
<p>In most cases, URLs are specified using an <a href="#linkRefAttrs"><span
class="attr-name">'href'</span></a> attribute.
However, some attributes allow both URLs and text strings as content.
To disambiguate a text string from a relative URL, the <a><url></a>
production is used [<a href="refs.html#ref-CSS3VALUES">CSS3VALUES</a>].
This is simply a URL delimited with a functional notation.
This form is used in <a
href="styling.html#PresentationAttributes">presentation
attributes</a>.</p>
<p>SVG makes extensive use of <a>URL</a> references, both absolute and relative,
to other objects. For example, to <a>fill</a> a rectangle with a linear
gradient, you first define a <a>'linearGradient'</a> element and give
it an ID, as in:</p>
<edit:example href="images/linking/05_07.xml" image="no" link="no"/>
<p>You then reference the linear gradient as the value of the
<a>'fill'</a> property for the rectangle, as in the following example:</p>
<edit:example href="images/linking/05_08.xml" image="no" link="no"/>
<!-- old stuff from 1.1 for checking
<p id="URLReference">URL references are defined in either of the
following forms:</p>
<pre class='grammar'><![CDATA[
<URL-reference> = [ <absoluteURL> | <relativeURL> ] [ "#" <elementID> ] -or-
<URL-reference> = [ <absoluteURL> | <relativeURL> ] [ "#xpointer(id(" <elementID> "))" ]
]]></pre>
<p>where <span class="grammar"><elementID></span>
is the ID of the referenced element.</p>
<p>(Note that the two forms above (i.e.,
<span class="attr-value">#<elementID></span> and
<span class="attr-value">#xpointer(id(<elementID>))</span>)
are formulated in syntaxes compatible with "XML Pointer Language (XPointer)"
[<a href="http://www.w3.org/TR/xptr">XPTR</a>]. These two formulations of URL
references are the only XPointer formulations that are required in SVG 1.1 user
agents.)</p>
-->
<h3 id="processingURL">Processing of URL references</h3>
<p>The following list describes the elements and properties that allow URL
references and the valid target types for those references:</p>
<ul>
<li>the <a>'a'</a> element can reference any local or non-local resource</li>
<li>the <a>'animate'</a> element (see <a href="https://svgwg.org/specs/animations/#TargetElement">Identifying the target element for an animation</a> for reference rules)</li>
<li>the <a>'animateMotion'</a> element (see <a href="https://svgwg.org/specs/animations/#TargetElement">Identifying the target element for an animation</a> for reference rules)</li>
<li>the <a>'animateTransform'</a> element (see <a href="https://svgwg.org/specs/animations/#TargetElement">Identifying the target element for an animation</a> for reference rules)</li>
<!--
<li>the <a href="color.html#ColorProfileSrcProperty">'src'</a> descriptor on an @color-profile definition must reference an ICC profile resource</li>
-->
<li>the <a>'cursor element'</a> element must reference a resource that can provide an image for the cursor graphic</li>
<li>the <a>'cursor property'</a> property must reference a resource that can provide an image for the cursor graphic</li>
<li>the <a>'fill'</a> property (see <a href="painting.html#SpecifyingPaint">Specifying paint</a> for reference rules)</li>
<li>the <a>'image'</a> element must reference any local or non-local resource</li>
<li>the <a>'linearGradient'</a> element must reference a <a>'linearGradient'</a> or <a>'radialGradient'</a> element</li>
<li>the <a>'marker property'</a>, <a>'marker-start'</a>, <a>'marker-mid'</a> and <a>'marker-end'</a> properties must reference a <a>'marker element'</a> element.</li>
<li>the <a>'pattern'</a> element must reference a <a>'pattern'</a> element</li>
<li>the <a>'radialGradient'</a> element must reference a <a>'linearGradient'</a> or <a>'radialGradient'</a> element</li>
<li>the <a>'script'</a> element must reference an external resource that provides the script content</li>
<li>the <a>'stroke'</a> property (see <a href="painting.html#SpecifyingPaint">Specifying paint</a> for reference rules)</li>
<li>the <a>'textPath'</a> element must reference a <a>'path'</a> element</li>
<li>the <a>'set'</a> element (see <a href="https://svgwg.org/specs/animations/#TargetElement">Identifying the target element for an animation</a> for reference rules)</li>
<li>the <a>'use'</a> element can reference any local or non-local resource</li>
</ul>
<p>The following rules apply to the processing of invalid URL references:</p>
<ul>
<li>An invalid local URL reference (i.e., an <a href="#TermInvalidReference">invalid references</a> to a node
within the current document) represents an error (see
<a href="implnote.html#ErrorProcessing">Error processing</a>), apart from the
<a>'a/href'</a> attribute on the <a>'a'</a> element and the properties
that allow for backup values in the case where the URL reference is invalid
(see <a>'fill'</a> and <a>'stroke'</a>).</li>
<li>An invalid circular URL reference represents an error (see
<a href="implnote.html#ErrorProcessing">Error processing</a>).</li>
</ul>
<h3 id="linkRefAttrs">URL reference attributes</h3>
<p id="linkRefAttrsEmbed"><a>URL references</a> are normally specified with an
<span class="attr-name">'href'</span> attribute.
The value of this attribute forms a reference for the desired resource (or
secondary resource, if there is a fragment identifier).
The value of the <span class="attr-name">'href'</span>
attribute must be a URL.</p>
<p>Because it is impractical for any application to check that
a value is an <a>URL reference</a>, this specification follows the lead
of the <a href="http://www.ietf.org/rfc/rfc3986.txt">URL Specification</a>
in this matter and imposes no such conformance testing
requirement on SVG applications.</p>
<p>If the <a>URL reference</a> is relative, its absolute version must be computed by the method described in
<a href="http://www.w3.org/TR/xmlbase/">XML Base</a> before use [<a href="refs.html#ref-XML-BASE">XML-BASE</a>].</p>
<p class='ready-for-wg-review'>If the <a>URL reference</a> is a fragment-only URL, it must be treated as
a same-document URL as described in
<a href="https://drafts.csswg.org/css-values/#local-urls">CSS Values and Units</a>
[<a href="refs.html#ref-CSS3VALUES">CSS3VALUES</a>].</p>
<p>If the protocol, such as HTTP, does not support <a>URLs</a> directly,
the <a>URL</a> is converted to a URI by the SVG implementation, as described
in section 3.1 of the <a href="http://www.ietf.org/rfc/rfc3987.txt">URL specification</a> [<a href="refs.html#ref-RFC3987">RFC3987</a>].</p>
<h3 id="XLinkRefAttrs">Deprecated XLink URL reference attributes</h3>
<p>In previous versions of SVG, the <span class="attr-name">'href'</span>
attribute was specified in the XLink namespace [<a
href="refs.html#ref-XLINK">XLINK</a>] namespace.
This usage is now deprecated and instead <a>URL references</a> should be
specified using the <span class="attr-name">'href'</span> attribute without
a namespace.</p>
<p>For backwards compatibility, the deprecated <a>'xlink:href'</a> attribute
is defined below along with the <a>'xlink:title'</a> attribute which has also
been deprecated.</p>
<p><em>Attribute definitions:</em></p>
<dl class="attrdef-list">
<dt>
<table class="attrdef def">
<tr>
<th>Name</th>
<th>Value</th>
<th>Initial value</th>
<th>Animatable</th>
</tr>
<tr>
<td><dfn id="XLinkHrefAttribute">xlink:href</dfn></td>
<td>URL <a href="types.html#attribute-url" class="syntax">[URL]</a></td>
<td>(none)</td>
<td>(see below)</td>
</tr>
</table>
</dt>
<dd>
<p>For backwards compatibility, elements with an <span
class="attr-name">'href'</span> attribute also recognize an <span
class="attr-name">'href'</span> attribute in the XLink namespace [<a
href="refs.html#ref-XLINK">XLINK</a>].</p>
<p>When the <span class="attr-name">'href'</span> attribute is present in
<em>both</em> the XLink namespace and without a namespace, the
value of the attribute without a namespace shall be used. The attribute in
the XLink namespace shall be ignored.</p>
<p>A <a>conforming SVG generator</a> must generate <span
class="attr-name">'href'</span> attributes without a namespace.
However, it may <em>also</em> generate <span class="attr-name">'href'</span>
attributes in the XLink namespace to provide backwards compatibility.</p>
<p>This attribute is <a>animatable</a> if and only if the corresponding
<span class="attr-name">'href'</span> attribute is defined to be
animatable.</p>
</dd>
<dt>
<table class="attrdef def">
<tr>
<th>Name</th>
<th>Value</th>
<th>Initial value</th>
<th>Animatable</th>
</tr>
<tr>
<td><dfn id="XLinkTitleAttribute">xlink:title</dfn></td>
<td><anything></td>
<td>(none)</td>
<td>no</td>
</tr>
</table>
</dt>
<dd>
<p>Deprecated attribute to describe the meaning of
a link or resource in a human-readable fashion.
New content should use a <a href="struct.html#TitleElement"><span
class="element-name">'title'</span></a> child element rather than a <span
class="attr-name">'xlink:title'</span> attribute.</p>
<p>The use of this information is highly dependent on the type of processing
being done. It may be used, for example, to make titles
available to applications used by visually impaired users,
or to create a table of links, or to present help text that
appears when a user lets a mouse pointer hover over a
starting resource.</p>
<p>The <span class="attr-name">'title'</span> attribute, if used, must be
in the XLink namespace.
Refer to the <a href="http://www.w3.org/TR/xlink/">XML Linking Language
(XLink)</a> [<a href="refs.html#ref-XLINK">XLINK</a>].</p>
</dd>
</dl>
<p>When using the deprecated XLink attributes <a>'xlink:href'</a> or
<a>'xlink:title'</a> an explicit XLink namespace declaration must be provided
[<a href="refs.html#ref-XML-NS">XML-NS</a>],
One simple way to provide such an XLink namespace declaration
is to include an <span class="attr-name">'xmlns'</span> attribute
for the XLink namespace on the <a>'svg'</a> element for content that uses
XLink attributes. For example:</p>
<pre class='xml'><![CDATA[
<svg xmlns:xlink="http://www.w3.org/1999/xlink" ...>
<image xlink:href="foo.png" .../>
</svg>
]]></pre>
<h2 id="Links">Links out of SVG content: the <span class="element-name">'a'</span> element</h2>
<edit:with element='a'>
<p>SVG provides an <a>'a'</a> element, to indicate links (also known
as <em>hyperlinks</em> or <em>Web links</em>). The <a>'a'</a> element may
contain any element that its parent may contain, except itself.</p>
<p>SVG uses XLink ([<a href="http://www.w3.org/TR/2001/REC-xlink-20010627/">XLink</a>])
for all link definitions. SVG 1.1 only requires
that user agents support XLink's notion of
<a href="http://www.w3.org/TR/2001/REC-xlink-20010627/#simple-links">simple links</a>.
Each simple link associates exactly two resources, one
local and one remote, with an arc going from the former to the latter.</p>
<p>A simple link is defined for each separate rendered element contained
within the <a>'a'</a> element; thus, if the <a>'a'</a> element contains
three <a>'circle'</a> elements, a link is created for each circle. For
each rendered element within an <a>'a'</a> element, the given rendered
element is the local resource (the source anchor for the link).</p>
<p>The remote resource (the destination for the link) is defined by
an <a>URL</a> specified by the <a>'href'</a> attribute on the <a>'a'</a>
element. The remote resource may be any Web resource (e.g., an image, a video
clip, a sound bite, a program, another SVG document, an HTML document, an
element within the current document, an element within a different document, etc.).
By activating these links (by clicking with the mouse, through keyboard
input, voice commands, etc.), users may visit these resources.</p>
<p id="ExampleLink01"><span class="example-ref">Example link01</span> assigns
a link to an ellipse.</p>
<edit:example href='images/linking/link01.svg' name='link01' description='a link on an ellipse' image='yes' link='yes'/>
<p>If the above SVG file is viewed by a user agent that supports both
SVG and HTML, then clicking on the ellipse will cause the current window
or frame to be replaced by the W3C home page.</p>
<div id="AElement">
<edit:elementsummary name='a'/>
</div>
<p><em>Attribute definitions:</em></p>
<dl class="attrdef-list">
<dt>
<table class="attrdef def">
<tr>
<th>Name</th>
<th>Value</th>
<th>Initial value</th>
<th>Animatable</th>
</tr>
<tr>
<td><dfn id="AElementHrefAttribute">href</dfn></td>
<td>URL <a href="types.html#attribute-url" class="syntax">[URL]</a></td>
<td>(none)</td>
<td>yes</td>
</tr>
</table>
</dt>
<dd>
The location of the referenced object, expressed as an <a>URL reference</a>.
Refer to the common handling defined for <a
href="linking.html#linkRefAttrs">URL reference attributes</a>.
</dd>
<dt>
<table class="attrdef def">
<tr>
<th>Name</th>
<th>Value</th>
<th>Initial value</th>
<th>Animatable</th>
</tr>
<tr>
<td><dfn id="AElementTargetAttribute">target</dfn></td>
<td> _self | _parent | _top | _blank | <XML-Name></td>
<td>_self</td>
<td>yes</td>
</tr>
</table>
</dt>
<dd>
<p>This attribute should be used when there are multiple possible targets for
the ending resource, such as when the parent document is embedded within an HTML
or XHTML document, or is viewed with a tabbed browser. This attribute specifies the
name of the browsing context
(e.g., a browser tab or an SVG, HTML, or XHTML iframe or object element) into
which a document is to be opened when the link is activated:</p>
<dl>
<dt><span class="attr-value">_self</span></dt>
<dd>The current SVG image is replaced by the linked content in the
same browsing context as the current SVG image.</dd>
<dt><span class="attr-value">_parent</span></dt>
<dd>The immediate parent browsing context of the SVG image is replaced by the
linked content, if it exists and can be securely accessed from this document.</dd>
<dt><span class="attr-value">_top</span></dt>
<dd>The content of the full active window or tab is replaced by the linked content,
if it exists and can be securely accessed from this document</dd>
<dt><span class="attr-value">_blank</span></dt>
<dd>A new un-named window or tab is requested for the display of the
linked content, if this document can securely do so.
If the user agent does not support multiple windows/tabs,
the result is the same as <span class="attr-value">_top</span>.</dd>
<dt><span class="attr-value"><XML-Name></span></dt>
<dd>Specifies the name of the browsing context (tab, inline frame, object, etc.)
for display of the linked content. If a context with this name
already exists, and can be securely accessed from this document, it is re-used,
replacing the existing content. If it does not exist, it is created
(the same as <span class="attr-value">'_blank'</span>, except that
it now has a name). The name must be a valid XML Name [XML11], and should not start
with an underscore (U+005F LOW LINE character), to meet the requirements of a
<a href="http://www.w3.org/TR/html51/browsers.html#valid-browsing-context-name">valid
browsing context name</a> from HTML.</dd>
</dl>
<p> The normative definitions for browsing contexts and security
restrictions on navigation actions between browsing contexts
is HTML 5 [<a href="refs.html#ref-HTML">HTML</a>], specifically
<a href="http://www.w3.org/TR/html51/browsers.html">the chapter on
loading web pages</a>.
</p>
<!--
The SVG 1.1 text for "_blank" was:
<dt><span class="attr-value">_blank</span></dt>
<dd>A new un-named window or tab is requested for the display of the
linked content. If this fails, the result is the same as <span class="attr-value">_top</span></dd>
However, under HTML 5 a request for a new tab may fail
because of sandboxing/no-popups, in which case the link is simply not followed.
The new language reflects this restriction while still supporting the old
behavior in single-window SVG viewers (if such exist).
-->
<div class="note">
<p>Previous versions of SVG defined the special target value
<span class="attr-value">'_replace'</span>. It was never well implemented,
and the distinction between <span class="attr-value">'_replace'</span>
and <span class="attr-value">'_self'</span> has been made redundant by
changes in the HTML definition of browsing contexts. Use
<span class="attr-value">'_self'</span> to replace the current
SVG document.</p>
<p>The value <span class="attr-value">'_new'</span> is <em>not</em> a
legal value for target. Use <span class="attr-value">'_blank'</span>
to open a document in a new tab/window.</p>
</div>
</dd>
</dl>
</edit:with>
<h2 id="LinksIntoSVG">Linking into SVG content: URL fragments and SVG views</h2>
<p>Because SVG content often represents a picture or drawing
of something, a common need is to link into a particular
<em>view</em> of the document, where a view indicates
the initial transformations so as to present a closeup of a particular
section of the document.</p>
<div class="ready-for-wider-review">
<h3 id="SVGFragmentIdentifiers">SVG fragment identifiers</h3>
<div class="annotation svg2-requirement">
<table>
<tr>
<th>SVG 2 Requirement:</th>
<td>Merge the SVG 1.1 SE text and the SVG Tiny 1.2 text on fragment identifiers link traversal and add media fragments.</td>
</tr>
<tr>
<th>Resolution:</th>
<td><a href="http://www.w3.org/2012/03/08-svg-irc#T21-05-52">SVG 2 will have media fragment identifiers.</a></td>
</tr>
<tr>
<th>Purpose:</th>
<td>To align with Media Fragments URI.</td>
</tr>
<tr>
<th>Owner:</th>
<td>Cyril (<a href="http://www.w3.org/Graphics/SVG/WG/track/actions/3442">ACTION-3442</a>)</td>
</tr>
</table>
</div>
<p>To link into a particular view of an SVG document, the <a href="#TermURLReferenceWithFragmentIdentifier">URL reference with fragment
identifier</a> needs to be a correctly formed <dfn id='svg-fragment-identifier'>SVG
fragment identifier</dfn>. An SVG fragment identifier defines the
meaning of the "selector" or "fragment identifier" portion of URLs that
locate resources of MIME media type "image/svg+xml".</p>
<p>An SVG fragment identifier can come in the following forms:</p>
<ul>
<li>Shorthand <em>bare name</em> form of addressing (e.g.,
<span class="attr-value">MyDrawing.svg#MyView</span>). This form of
addressing, which allows addressing an SVG element by its ID, is compatible
with the fragment addressing mechanism for older versions of HTML.</li>
<li id="SVGViewSpecification">An <dfn>SVG view specification</dfn>
(e.g., <span class="attr-value">MyDrawing.svg#svgView(viewBox(0,200,1000,1000))</span>).
This form of addressing specifies the desired view of the
document (e.g., the region of the document to view, the
initial zoom level) completely within the SVG fragment
specification. The contents of the SVG view specification are defined in
<a href="#SVGFragmentIdentifiersDefinitions">SVG fragment identifiers definitions</a> section.
</li>
<li><em>Basic media fragments identifiers</em> of type spatial or temporal
(e.g., <span class="attr-value">MyDrawing.svg#xywh=0,200,1000,1000 or MyAnimation.svg#t=10)</span>)
as defined in [<a href="refs.html#ref-MEDIAFRAGMENTSURI">Media Fragments URI 1.0 (basic)</a>] and possibly combined using the & sign (e.g. <span class="attr-value">MyDrawing.svg#xywh=0,200,1000,1000&t=10</span>).
</li>
</ul>
<h3 id="SVGFragmentIdentifiersDefinitions">SVG fragment identifiers definitions</h3>
<p>An SVG fragment identifier is defined as follows:</p>
<pre class='grammar'>
SVGFragmentIdentifier ::= BareName *( "&" <a href="http://www.w3.org/TR/media-frags/#timesegment">timesegment</a> ) |
SVGViewSpec *( "&" <a href="http://www.w3.org/TR/media-frags/#timesegment">timesegment</a> ) |
<a href="http://www.w3.org/TR/media-frags/#spacesegment">spacesegment</a> *( "&" timesegment ) |
<a href="http://www.w3.org/TR/media-frags/#timesegment">timesegment</a> *( "&" spacesegment )
BareName ::= XML_Name
SVGViewSpec ::= 'svgView(' SVGViewAttributes ')'
SVGViewAttributes ::= SVGViewAttribute |
SVGViewAttribute ';' SVGViewAttributes
SVGViewAttribute ::= viewBoxSpec |
preserveAspectRatioSpec |
transformSpec |
zoomAndPanSpec
viewBoxSpec ::= 'viewBox(' ViewBoxParams ')'
preserveAspectRatioSpec = 'preserveAspectRatio(' AspectParams ')'
transformSpec ::= 'transform(' TransformParams ')'
zoomAndPanSpec ::= 'zoomAndPan(' ZoomAndPanParams ')'
</pre>
<p>where:</p>
<ul>
<li><em>ViewBoxParams</em> corresponds to the
parameter values for the <a>'viewBox'</a> attribute on the <a>'view'</a>
element. For example, <span class="attr-value">viewBox(0,0,200,200)</span>.</li>
<li><em>AspectParams</em> corresponds to the
parameter values for the <a>'preserveAspectRatio'</a> attribute on the
<a>'view'</a> element. For example,
<span class="attr-value">preserveAspectRatio(xMidYMid)</span>.</li>
<li><em>TransformParams</em> corresponds to the
parameter values for the <a>'transform'</a> property that is available on
many elements. For example, <span class="attr-value">transform(scale(5))</span>.
Currently additional tranform styles and parameters (e.g. transform-origin, perspective) are not supported.
</li>
<li><em>ZoomAndPanParams</em> corresponds to the
parameter values for the <a>'zoomAndPan'</a> attribute on the <a>'view'</a>
element. For example, <span class="attr-value">zoomAndPan(magnify)</span>.</li>
</ul>
<p>SVG view box parameters are applied in order, as defined in
<a href="http://www.w3.org/TR/css3-transforms/">CSS Transforms</a> specification (e.g. SVG view is transformed as defined in <em>ViewBoxParams</em>,
then as defined in <em>TransformParams</em>).</p>
<p>Spaces are allowed in fragment specifications. Commas
are used to separate numeric values within an SVG view specification
(e.g., <span class="attr-value">#svgView(viewBox(0,0,200,200))</span>)
and semicolons are used to separate attributes (e.g.,
<span class="attr-value">#svgView(viewBox(0,0,200,200);preserveAspectRatio(none))</span>).</p>
<div class="note">
<p>Fragment identifiers may be url-escaped according to the rules defined in
<a href="http://www.w3.org/TR/cssom/#common-serializing-idioms">CSS Object Model (CSSOM)</a> specification.
For example semicolons can be escaped as %3B to allow animating a (semi-colon separated) list of URLs because otherwise the semicolon would
be interpreted as a list separator.</p>
</div>
<p>The four types of <em>SVGViewAttribute</em> may occur
in any order, but each type may only occur at most one time in a correctly
formed <em>SVGViewSpec</em>.</p>
<p>When a source document performs a link into an SVG document, for example
via an <a href="http://www.w3.org/TR/1999/REC-html401-19991224/struct/links.html#h-12.2">HTML anchor element</a>
([<a href="refs.html#ref-HTML4">HTML4</a>], section 12.2; i.e.,
<span class="attr-value"><a href=...></span> element in HTML) or an
XLink specification [<a href="refs.html#ref-XLINK">XLINK</a>], then
the SVG fragment identifier specifies the initial view into the SVG document,
as follows:</p>
<ul>
<li>If no SVG fragment identifier is provided (e.g, the specified URL did
not contain a "#" character, such as <span class="attr-value">MyDrawing.svg</span>),
then the initial view into the SVG document is established using the view
specification attributes (i.e., <a>'viewBox'</a>, etc.) on the
<a>outermost svg element</a>.</li>
<li>If the SVG fragment identifier addresses a <a href="http://www.w3.org/TR/media-frags/#spacesegment">space segment</a>
(e.g., <span class="attr-value">MyDrawing.svg#xywh=0,0,100,100</span>),then the initial
view into the SVG document is established using the view specification attributes
on the <a>outermost svg element</a> where the 'viewBox' is overriden by the
x, y, width and height values provided by the fragment identifier.
</li>
<li>Media fragments can be specified as "pixel:" (default) and "percent:". In the latter case the resulting 'viewBox' transformation is
calculated against referenced SVG resolved size (width and height). When the host document cannot resolve the width and height of the SVG document,
the used values for width and height should be calculated accorting to CSS rules for
<a href="http://www.w3.org/TR/CSS21/visudet.html#inline-replaced-width">calculating width and ratio for inline replaced elements</a>.</li>
<li>If the SVG fragment identifier addresses a <a href="http://www.w3.org/TR/media-frags/#timesegment">time segment</a>
(e.g., <span class="attr-value">MyDrawing.svg#t=10</span>),then the initial
view into the SVG document is established as if no fragment identifier was
provided. The rendering of the SVG Document shall be as if the setCurrentTime
method on the SVG Document element had been called with the begin time value
from the fragment identifier. Additionally, if an end time value is provided
in the fragment identifier, the effect is equivalent to calling the pauseAnimations
method on the SVG Document when the document time reaches the end time of the
fragment identifier.
</li>
<li>If the SVG fragment identifier addresses a <a>'view'</a> element within
an SVG document (e.g., <span class="attr-value">MyDrawing.svg#MyView</span>)
then the root <a>'svg'</a> element is displayed in the SVG viewport.
Any view specification attributes included on the given <a>'view'</a>
element override the corresponding view specification attributes on the
root <a>'svg'</a> element.</li>
<li>If the SVG fragment identifier addresses specific SVG view (e.g.,
<span class="attr-value">MyDrawing.svg#svgView(viewBox(0,200,1000,1000))</span>),
then the document fragment defined by the root <a>'svg'</a>
element is displayed in the SVG viewport using the SVG view specification
provided by the SVG fragment identifier. Parameters of the svgView specification override
the parameters defined on the root <a>'svg'</a> element of the referenced document.
Unspecified parameters of the svgView specification don't reset the values defined on the root
<a>'svg'</a> element of the referenced document.</li>
<li>If the SVG fragment identifier addresses a combination of the above
non-time related identifiers with a time-related identifier (ie. a timesegment),
the behavior of each identifier is applied.
</li>
</ul>
</div>
<h3 id="ViewElement">Predefined views: the <span class="element-name">'view'</span> element</h3>
<edit:with element='view'>
<p>The <span class="element-name">'view'</span> element is defined as follows:</p>
<edit:elementsummary name='view'/>
</edit:with>
<div class="annotation">
<p>
We have resolved to remove viewTarget attribute.
</p>
<p>
Resolution: Paris 2015 F2F Day 3.
</p>
<p>
Owner: BogdanBrinza.
</p>
</div>
<h2 id="DOMInterfaces">DOM interfaces</h2>
<div class='ready-for-wider-review'>
<h3 id="InterfaceSVGAElement">Interface SVGAElement</h3>
<edit:with element="a">
<p>An <a>SVGElement</a> object represents an <a>'a'</a> element in the DOM.</p>
<pre class="idl">interface <b>SVGAElement</b> : <a>SVGGraphicsElement</a> {
[SameObject] readonly attribute <a>SVGAnimatedString</a> <a href="linking.html#__svg__SVGAElement__target">target</a>;
};
<a>SVGAElement</a> implements <a>SVGURIReference</a>;</pre>
<p>The <b id="__svg__SVGAElement__target">target</b> IDL attribute
<a>reflects</a> the <a>'target'</a> content attribute.</p>
</edit:with>
<h3 id="InterfaceSVGViewElement">Interface SVGViewElement</h3>
<edit:with element="view">
<p>An <a>SVGViewElement</a> object represents a <a>'view'</a> element in the DOM.</p>
<pre class="idl">interface <b>SVGViewElement</b> : <a>SVGElement</a> {};
<a>SVGViewElement</a> implements <a>SVGFitToViewBox</a>;
<a>SVGViewElement</a> implements <a>SVGZoomAndPan</a>;</pre>
</edit:with>
</div>
</body>
</html>