1. Introduction
This section is non-normative
SVG Native is a profile of SVG designed with the requirements of native apps. The environment native apps run in is different than the environment of Web browsers in a few fundamental ways:
-
Security: Web content is usually sandboxed, and has only a fraction of the capabilities that a native app has. One of the reasons for this sandboxing is to mitigate security risks that SVG content may contain. However, native apps are usually either not sandboxed or have a more permissive sandbox than Web content. Therefore, code that runs in a native app must be held to a higher standard of security.
-
Performance: Web content is usually run in a separate process, which means the performace of that process has only an indirect affect on the performance of the entire app. If this separate process stalls, the entire app can continue and gracefully degrade behavior. However, native code runs in the app’s process, which requires more stringent performance targets.
SVG Native aims to adhere to the native app environment by meeting the above requirements.
SVG Native also has one additional goal:
-
Ubiquity: SVG Native should be implementable as a system component on any modern computing environment. This means it should be small, lightweight, and only have few dependencies. The dependencies it does have should be standard components that already exist in most computing environments.
To meet these goals, SVG Native is a subset of SVG 1.1, which removes animation, interactivity, linking, remote resource loading, scripting, and CSS (among others).
1.1. Use Cases
This section is non-normative
SVG Native is designed to fit a number of use cases.
-
Icons: Icons are often small vector graphics containing few graphical elements.
-
Emoji: Emoji are often represented as small vector graphics.
-
Color Fonts: Each glyph in a font is represented as a series of vector contours. Color fonts allow the glyphs to include color, in addition to their contours.
-
Drawings and sketches: Drawings and sketches may be created with vector artwork tools. Depending on the complexity of the artwork, representing it using a series of vector drawing elements may result in a smaller file size than a raster format such as [PNG]. Drawings and sketches often need to be viewed outside of the Web platform.
1.2. Basics
SVG Native is presented as a series of modifications of [SVG11]. These modifications are applied as differences from that specification.
Note: This spec will likely be rebased on [SVG2] in the near future.
If the engine encounters an element or attribute that is forbidden, not supported, or not included in this specification, that element or attribute must be disregarded.
SVG Native is a standalone file type, expected to be rendered with a dedicated-purpose renderer. Therefore, SVG Native content must not be present as part of a larger XML (or HTML) document. If it is present as part of a larger XML (or HTML) document, the content should be interpreted as SVG proper.
Note: This means that browsers encounting a SVG Native root element within the DOM must not interpret it as SVG Native, even if it has the baseAttribute attribute set to native
. If a Web author desires to use SVG Native on the Web, the img
element may be used instead. This matches other native image formats such as [PNG]. A Web browser should implement SVG Native by linking with the system’s SVG Native facilities. This matches the implementation of other native image formats.
The root element of an SVG Native document must have the baseAttribute attribute set to native
and the version attribute set to 1.1
.
The file extension for SVG Native is .svn
. The UTI for SVG Native is public.svg.native
. The MIME type for SVG Native is image/svgnative+xml
.
User agents may limit the reference depth of references to implementation-dependent maximas. However, this limit must be greater than or equal to 1 reference.
XSL Processing is forbidden.
XML Entities and CDATA sections may be present.
Is it worth mentioning the 'HTML dialect' of SVG?
2. Concepts
Chapter is unchanged.
3. Rendering Model
Chapter is unchanged.
4. Basic Data Types and Interfaces
Chapter is unchanged.
Note: Because this specification removes some elements and attributes, not all of the syntax productions in this chapter are referenced by other sections of this specification. Therefore, not all of the productions in this chapter need to be implemented.
5. Document Structure
The root element must be an svg
element, and all other svg
elements are forbidden.
Section 5.8 "Conditional Processing" is deleted.
image
elements must only contain base64-encoded data:
URLs of [JPEG] or [PNG] images. [APNG] images must be rendered without animation, using standard backward-compatibility with static [PNG] images. All other image formats must be ignored.
All external resource loading is forbidden.
6. Styling
The style
element and the style attribute are forbidden.
Using calc(), env(), or var() is forbidden.
Note: Other environments may relax these rules and allow these functions as necessary. For example, the [OPENTYPE] spec might allow env() or var() in color fonts to support font color palettes.
The CSS all property is forbidden.
All the global CSS keywords are forbidden. These include:
7. Coordinate Systems, Transformations, and Units
Only the following units are supported:
8. Paths
The pathLength attribute on the path
element is forbidden.
9. Basic Shapes
Chapter is unchanged.
10. Text
Entire chapter is deleted.
Note: This means that all text facilities are forbidden in SVG Native.
11. Painting: Filling, Stroking, and Marker Symbols
The display attribute is forbidden. Hiding elements can be achieved with the visibility attribute.
Delete section 11.6.2 The marker
element.
The color-interpolation attribute is forbidden. All color interpolation occurs in the sRGB color space.
12. Color
Delete section 12.2: The color property.
Note: In some environments, the currentColor keyword is used to provide surrounding context to the SVG graphic. For example, in a color font glyph, currentColor may represent the text color of the surrounding line. Therefore, support of currentColor is required, but support of the color property to change currentColor is not supported.
Delete section 12.3: Color profile descriptions.
Note: This specification will likely adopt [SVG2]'s syntax for specifying colors outside of sRGB.
What should we do about non-sRGB color spaces?
13. Gradients and Patterns
The following attributes are forbidden:
-
'xlink:href' on
linearGradient
orradialGradient
Delete section 13.3: Patterns.
14. Clipping, Masking, and Compositing
Delete section 14.4: Masking.
The following attributes are forbidden:
The scroll value on the overflow property behaves identically to hidden.
The clip-path attribute must not be present on a clipPath
element.
Every clipPath
element must have either exactly zero or exactly one child.
The scroll and the auto values of the overflow property are forbidden.
15. Filter Effects
Entire chapter is deleted.
Note: This means that all filter facilities are forbidden in SVG Native.
16. Interactivity
Entire chapter is deleted.
Note: This means that all interactivity facilities are forbidden in SVG Native.
17. Linking
All external resource loading is forbidden.
Delete section 17.2: Links out of SVG content: the a
element.
Delete section 17.3.3: Predefined views: the view
element.
18. Scripting
Entire chapter is deleted.
Note: This means that all scripting facilities are forbidden in SVG Native.
19. Animation
Entire chapter is deleted.
Note: This means that all animation facilities are forbidden in SVG Native.
20. Fonts
Entire chapter is deleted.
Note: This means that all font facilities are forbidden in SVG Native.
21. Metadata
Entire chapter is deleted.
Note: This means that all metadata facilities are forbidden in SVG Native. Because the engine must ignore document constructs that aren’t included in this specification, it means metadata is ignored. This may be what the author intends.
22. Backwards Compatibility
Entire chapter is deleted.
23. Extensibility
Delete section 23.3: The foreignObject
element.