[−][src]Trait svgdom::ElementType
This trait contains methods that check element's type according to the SVG spec.
Note that all methods works with Node
type and will return false
if node's type is not equal to NodeType::Element
.
Panics
All methods panics if the node is currently mutability borrowed.
Required methods
fn is_referenced(&self) -> bool
Returns true if the current node is referenced.
Referenced elements are elements that do not render by itself, rather defines rendering properties for other.
List: altGlyphDef
, clipPath
, cursor
, filter
, linearGradient
, marker
,
mask
, pattern
, radialGradient
and symbol
.
Details: https://www.w3.org/TR/SVG/struct.html#Head
Examples
use svgdom::{Document, ElementType}; let doc = Document::from_str( "<svg xmlns='http://www.w3.org/2000/svg'><linearGradient/></svg>").unwrap(); let mut iter = doc.root().descendants(); assert_eq!(iter.next().unwrap().is_referenced(), false); // root assert_eq!(iter.next().unwrap().is_referenced(), false); // svg assert_eq!(iter.next().unwrap().is_referenced(), true); // linearGradient
fn is_basic_shape(&self) -> bool
Returns true if the current node is a basic shape element.
List: rect
, circle
, ellipse
, line
, polyline
, polygon
.
fn is_shape(&self) -> bool
Returns true if the current node is a shape element.
List: path
, rect
, circle
, ellipse
, line
, polyline
and polygon
.
fn is_container(&self) -> bool
Returns true if the current node is a container element.
List: a
, defs
, glyph
, g
, marker
, mask
, missing-glyph
, pattern
, svg
,
switch
and symbol
.
Details: https://www.w3.org/TR/SVG/intro.html#TermContainerElement
fn is_text_content(&self) -> bool
Returns true if the current node is a text content element.
List: altGlyph
, textPath
, text
, tref
and tspan
.
Details: https://www.w3.org/TR/SVG/intro.html#TermTextContentElement
fn is_text_content_child(&self) -> bool
Returns true if the current node is a text content child element.
List: altGlyph
, textPath
, tref
and tspan
.
Details: https://www.w3.org/TR/SVG/intro.html#TermTextContentChildElement
fn is_graphic(&self) -> bool
Returns true if the current node is a graphic element.
List: circle
, ellipse
, image
, line
, path
, polygon
, polyline
, rect
,
text
and use
.
Details: https://www.w3.org/TR/SVG/intro.html#TermGraphicsElement
fn is_gradient(&self) -> bool
Returns true if the current node is a gradient element.
List: linearGradient
, radialGradient
.
fn is_paint_server(&self) -> bool
Returns true if the current node is a paint server.
List: linearGradient
, radialGradient
and pattern
.
fn is_filter_primitive(&self) -> bool
Returns true if the current node is a filter primitive.
List: feBlend
, feColorMatrix
, feComponentTransfer
, feComposite
,
feConvolveMatrix
, feDiffuseLighting
, feDisplacementMap
, feFlood
, feGaussianBlur
,
feImage
, feMerge
, feMorphology
, feOffset
, feSpecularLighting
,
feTile
and feTurbulence
.