object

package
v0.3.0-rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TagOpen  = []byte("<object")
	TagClose = []byte("</object>")

	AttrData   = []byte(" data=\"")
	AttrType   = []byte(" type=\"")
	AttrForm   = []byte(" form=\"")
	AttrHeight = []byte(" height=\"")
	AttrName   = []byte(" name=\"")
	AttrUseMap = []byte(" usemap=\"")
	AttrWidth  = []byte(" width=\"")
)

Byte constants for HTML rendering.

Functions

func Audio deprecated

func Audio(data string, nodes ...node.Node) *element

Audio Creates an object element for audio content Example: object.Audio("/audio.mp3") Renders: <object data="/audio.mp3" type="audio/mpeg"></object>

Deprecated: Use the audio element instead.

func Flash deprecated

func Flash(data string, nodes ...node.Node) *element

Flash Creates an object element for Flash content (legacy) Example: object.Flash("/animation.swf") Renders: <object data="/animation.swf" type="application/x-shockwave-flash"></object>

Deprecated: Flash is no longer supported by browsers.

func New

func New(nodes ...node.Node) *element

New Creates a new object element with optional child nodes Example: object.New() Renders: <object></object>

func PDF

func PDF(data string, nodes ...node.Node) *element

PDF Creates an object element for PDF documents Example: object.PDF("/document.pdf") Renders: <object data="/document.pdf" type="application/pdf"></object>

func RawText

func RawText(content string) *element

RawText Creates a new object element with raw fallback text content. Uses text.RawText which is not HTML-escaped. Example: object.RawText("<p>Fallback content</p>") Renders: <object><p>Fallback content</p></object>

func RawTextf

func RawTextf(format string, args ...any) *element

RawTextf Creates a new object element with formatted raw fallback text content. Uses text.RawTextf which is not HTML-escaped. Example: object.RawTextf("<p>Cannot display <strong>%s</strong></p>", file) Renders: <object><p>Cannot display <strong>report.pdf</strong></p></object>

func Static

func Static(content string) *element

Static Creates a new object element with static fallback text content. Uses text.Static which is not HTML-escaped and is JIT-optimisable. Example: object.Static("Loading content...") Renders: <object>Loading content...</object>

func Text

func Text(content string) *element

Text Creates a new object element with fallback text content. Uses text.Text which HTML-escapes the output. Example: object.Text("Your browser does not support embedded objects.") Renders: <object>Your browser does not support embedded objects.</object>

func Textf

func Textf(format string, args ...any) *element

Textf Creates a new object element with formatted fallback text content. Uses text.Textf which HTML-escapes the output. Example: object.Textf("Cannot display %s", file) Renders: <object>Cannot display report.pdf</object>

func Video deprecated

func Video(data string, nodes ...node.Node) *element

Video Creates an object element for video content Example: object.Video("/video.mp4") Renders: <object data="/video.mp4" type="video/mp4"></object>

Deprecated: Use the video element instead.

Types

type Element

type Element = element

Element is an exported alias for the private element type

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL