class Components::Elements::Meta

Overview

Represents the element - provides metadata about the HTML document

Defined in:

components/elements/document/meta.cr

Constructors

Class Method Summary

Instance methods inherited from class Components::Elements::VoidElement

<<(child : HTMLElement | String) : self <<, add_child(child : HTMLElement | String) : self add_child, can_have_children? : Bool can_have_children?, render : String render, void_element? : Bool void_element?

Constructor methods inherited from class Components::Elements::VoidElement

new(tag_name : String, **attrs) new

Instance methods inherited from class Components::Elements::HTMLElement

[](name : String) : String | Nil [], add_class(class_names : String) : self add_class, add_style(styles : String) : self add_style, attributes : Hash(String, String) attributes, can_have_children? : Bool can_have_children?, children : Array(HTMLElement | String | RawHTML) children, has_class?(class_name : String) : Bool has_class?, remove_attribute(name : String) : self remove_attribute, remove_class(class_names : String) : self remove_class, render : String render, set_attribute(name : String, value : String | Nil) : self set_attribute, set_safe_style(style : SafeStyleValue) : self set_safe_style, set_safe_url_attribute(name : String, url : SafeURL) : self set_safe_url_attribute, tag_name : String tag_name, to_s(io : IO) : Nil to_s, void_element? : Bool void_element?

Constructor methods inherited from class Components::Elements::HTMLElement

new(tag_name : String, **attrs) new

Constructor Detail

def self.new(**attrs) #

[View source]
def self.safe_refresh(seconds : Int32, url : SafeURL) : Meta #

SafeHTML v1 (docs/SAFE_HTML_V1.md §3.2): <meta http-equiv="refresh" content="N; url=..."> is a URL-bearing sink the proposal calls out by name, but its content value is a compound format ("seconds; url=..."), not a plain URL — so the generic HTMLElement#set_safe_url_attribute (which sets an attribute verbatim from a SafeURL) is the wrong shape for it. This is the dedicated typed constructor: url is validated the same way any other URL-bearing attribute is, and the compound value is assembled only from a validated SafeURL plus a plain integer.


[View source]

Class Method Detail

def self.author(author : String) #

[View source]
def self.charset(charset : String = "UTF-8") #

Convenience constructors for common meta tags


[View source]
def self.description(description : String) #

[View source]
def self.http_equiv(http_equiv : String, content : String) #

[View source]
def self.keywords(keywords : String) #

[View source]
def self.viewport(content : String = "width=device-width, initial-scale=1.0") #

[View source]