dom

package module
v0.0.0-...-26252de Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2022 License: MIT Imports: 5 Imported by: 0

README

js/dom

Package dom provides Go bindings for the JavaScript DOM APIs.

Version 2

API Status: Alpha, more API changes may be done soon

Version 2 of package dom is implemented on top of the syscall/js API and supports both Go WebAssembly and GopherJS.

It provides an API that is as close as possible to v1, with the following neccessary changes:

  • All struct fields with js:"foo" tags have been replaced with equivalent methods
  • Underlying() returns js.Value instead of *js.Object
  • AddEventListener() returns js.Func instead of func(*js.Object)
Install
go get honnef.co/go/js/dom/v2
Documentation

For documentation, see https://godoc.org/honnef.co/go/js/dom/v2.

Version 1

API Status: Stable, changes only due to DOM being a moving target

Version 1 of package dom is implemented on top of the github.com/gopherjs/gopherjs/js API and supports GopherJS only.

Install
go get honnef.co/go/js/dom
Documentation

For documentation, see https://godoc.org/honnef.co/go/js/dom.

Documentation

Overview

Package dom provides GopherJS bindings for the JavaScript DOM APIs.

This package is an in progress effort of providing idiomatic Go bindings for the DOM, wrapping the JavaScript DOM APIs. The API is neither complete nor frozen yet, but a great amount of the DOM is already useable.

While the package tries to be idiomatic Go, it also tries to stick closely to the JavaScript APIs, so that one does not need to learn a new set of APIs if one is already familiar with it.

One decision that hasn't been made yet is what parts exactly should be part of this package. It is, for example, possible that the canvas APIs will live in a separate package. On the other hand, types such as StorageEvent (the event that gets fired when the HTML5 storage area changes) will be part of this package, simply due to how the DOM is structured – even if the actual storage APIs might live in a separate package. This might require special care to avoid circular dependencies.

The documentation for some of the identifiers is based on the MDN Web Docs by Mozilla Contributors (https://developer.mozilla.org/en-US/docs/Web/API), licensed under CC-BY-SA 2.5 (https://creativecommons.org/licenses/by-sa/2.5/).

Getting started

The usual entry point of using the dom package is by using the GetWindow() function which will return a Window, from which you can get things such as the current Document.

Interfaces

The DOM has a big amount of different element and event types, but they all follow three interfaces. All functions that work on or return generic elements/events will return one of the three interfaces Element, HTMLElement or Event. In these interface values there will be concrete implementations, such as HTMLParagraphElement or FocusEvent. It's also not unusual that values of type Element also implement HTMLElement. In all cases, type assertions can be used.

Example:

el := dom.GetWindow().Document().QuerySelector(".some-element")
htmlEl := el.(dom.HTMLElement)
pEl := el.(*dom.HTMLParagraphElement)

Live collections

Several functions in the JavaScript DOM return "live" collections of elements, that is collections that will be automatically updated when elements get removed or added to the DOM. Our bindings, however, return static slices of elements that, once created, will not automatically reflect updates to the DOM. This is primarily done so that slices can actually be used, as opposed to a form of iterator, but also because we think that magically changing data isn't Go's nature and that snapshots of state are a lot easier to reason about.

This does not, however, mean that all objects are snapshots. Elements, events and generally objects that aren't slices or maps are simple wrappers around JavaScript objects, and as such attributes as well as method calls will always return the most current data. To reflect this behaviour, these bindings use pointers to make the semantics clear. Consider the following example:

d := dom.GetWindow().Document()
e1 := d.GetElementByID("my-element")
e2 := d.GetElementByID("my-element")

e1.Class().SetString("some-class")
println(e1.Class().String() == e2.Class().String())

The above example will print `true`.

DOMTokenList

Some objects in the JS API have two versions of attributes, one that returns a string and one that returns a DOMTokenList to ease manipulation of string-delimited lists. Some other objects only provide DOMTokenList, sometimes DOMSettableTokenList. To simplify these bindings, only the DOMTokenList variant will be made available, by the type TokenList. In cases where the string attribute was the only way to completely replace the value, our TokenList will provide Set([]string) and SetString(string) methods, which will be able to accomplish the same. Additionally, our TokenList will provide methods to convert it to strings and slices.

Backwards compatibility

This package has a relatively stable API. However, there will be backwards incompatible changes from time to time. This is because the package isn't complete yet, as well as because the DOM is a moving target, and APIs do change sometimes.

While an attempt is made to reduce changing function signatures to a minimum, it can't always be guaranteed. Sometimes mistakes in the bindings are found that require changing arguments or return values.

Interfaces defined in this package may also change on a semi-regular basis, as new methods are added to them. This happens because the bindings aren't complete and can never really be, as new features are added to the DOM.

If you depend on none of the APIs changing unexpectedly, you're advised to vendor this package.

Index

Constants

View Source
const (
	DocumentPositionDisconnected           = 1
	DocumentPositionPreceding              = 2
	DocumentPositionFollowing              = 4
	DocumentPositionContains               = 8
	DocumentPositionContainedBy            = 16
	DocumentPositionImplementationSpecific = 32
)
View Source
const (
	EvPhaseNone      = 0
	EvPhaseCapturing = 1
	EvPhaseAtTarget  = 2
	EvPhaseBubbling  = 3
)
View Source
const (
	KeyLocationStandard = 0
	KeyLocationLeft     = 1
	KeyLocationRight    = 2
	KeyLocationNumpad   = 3
)
View Source
const (
	DeltaPixel = 0
	DeltaLine  = 1
	DeltaPage  = 2
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AnimationEvent

type AnimationEvent struct{ *BasicEvent }

type AudioProcessingEvent

type AudioProcessingEvent struct{ *BasicEvent }

type BasicElement

type BasicElement struct {
	*BasicNode
}

Type BasicElement implements the Element interface and is embedded by concrete element types and HTML element types.

func (*BasicElement) Attributes

func (e *BasicElement) Attributes() map[string]string

func (*BasicElement) Class

func (e *BasicElement) Class() *TokenList

func (*BasicElement) Closest

func (e *BasicElement) Closest(s string) Element

func (*BasicElement) GetAttribute

func (e *BasicElement) GetAttribute(name string) string

func (*BasicElement) GetAttributeNS

func (e *BasicElement) GetAttributeNS(ns string, name string) string

func (*BasicElement) GetBoundingClientRect

func (e *BasicElement) GetBoundingClientRect() ClientRect

func (*BasicElement) GetElementsByClassName

func (e *BasicElement) GetElementsByClassName(s string) []Element

func (*BasicElement) GetElementsByTagName

func (e *BasicElement) GetElementsByTagName(s string) []Element

func (*BasicElement) GetElementsByTagNameNS

func (e *BasicElement) GetElementsByTagNameNS(ns string, name string) []Element

func (*BasicElement) HasAttribute

func (e *BasicElement) HasAttribute(s string) bool

func (*BasicElement) HasAttributeNS

func (e *BasicElement) HasAttributeNS(ns string, name string) bool

func (*BasicElement) ID

func (e *BasicElement) ID() string

func (*BasicElement) InnerHTML

func (e *BasicElement) InnerHTML() string

func (*BasicElement) Matches

func (e *BasicElement) Matches(s string) bool

func (*BasicElement) NextElementSibling

func (e *BasicElement) NextElementSibling() Element

func (*BasicElement) OuterHTML

func (e *BasicElement) OuterHTML() string

func (*BasicElement) PreviousElementSibling

func (e *BasicElement) PreviousElementSibling() Element

func (*BasicElement) QuerySelector

func (e *BasicElement) QuerySelector(s string) Element

func (*BasicElement) QuerySelectorAll

func (e *BasicElement) QuerySelectorAll(s string) []Element

func (*BasicElement) RemoveAttribute

func (e *BasicElement) RemoveAttribute(s string)

func (*BasicElement) RemoveAttributeNS

func (e *BasicElement) RemoveAttributeNS(ns string, name string)

func (*BasicElement) SetAttribute

func (e *BasicElement) SetAttribute(name string, value string)

func (*BasicElement) SetAttributeNS

func (e *BasicElement) SetAttributeNS(ns string, name string, value string)

func (*BasicElement) SetClass

func (e *BasicElement) SetClass(s string)

SetClass sets the element's className attribute to s. Consider using the Class method instead.

func (*BasicElement) SetID

func (e *BasicElement) SetID(s string)

func (*BasicElement) SetInnerHTML

func (e *BasicElement) SetInnerHTML(s string)

func (*BasicElement) SetOuterHTML

func (e *BasicElement) SetOuterHTML(s string)

func (*BasicElement) TagName

func (e *BasicElement) TagName() string

type BasicEvent

type BasicEvent struct{ *js.Object }

Type BasicEvent implements the Event interface and is embedded by concrete event types.

func CreateEvent

func CreateEvent(typ string, opts EventOptions) *BasicEvent

func (*BasicEvent) Bubbles

func (ev *BasicEvent) Bubbles() bool

func (*BasicEvent) Cancelable

func (ev *BasicEvent) Cancelable() bool

func (*BasicEvent) CurrentTarget

func (ev *BasicEvent) CurrentTarget() Element

func (*BasicEvent) DefaultPrevented

func (ev *BasicEvent) DefaultPrevented() bool

func (*BasicEvent) EventPhase

func (ev *BasicEvent) EventPhase() int

func (*BasicEvent) PreventDefault

func (ev *BasicEvent) PreventDefault()

func (*BasicEvent) StopImmediatePropagation

func (ev *BasicEvent) StopImmediatePropagation()

func (*BasicEvent) StopPropagation

func (ev *BasicEvent) StopPropagation()

func (*BasicEvent) Target

func (ev *BasicEvent) Target() Element

func (*BasicEvent) Timestamp

func (ev *BasicEvent) Timestamp() time.Time

func (*BasicEvent) Type

func (ev *BasicEvent) Type() string

func (*BasicEvent) Underlying

func (ev *BasicEvent) Underlying() *js.Object

type BasicHTMLElement

type BasicHTMLElement struct {
	*BasicElement
}

Type BasicHTMLElement implements the HTMLElement interface and is embedded by concrete HTML element types.

func (*BasicHTMLElement) AccessKey

func (e *BasicHTMLElement) AccessKey() string

func (*BasicHTMLElement) AccessKeyLabel

func (e *BasicHTMLElement) AccessKeyLabel() string

func (*BasicHTMLElement) Blur

func (e *BasicHTMLElement) Blur()

func (*BasicHTMLElement) Click

func (e *BasicHTMLElement) Click()

func (*BasicHTMLElement) ContentEditable

func (e *BasicHTMLElement) ContentEditable() string

func (*BasicHTMLElement) Dataset

func (e *BasicHTMLElement) Dataset() map[string]string

func (*BasicHTMLElement) Dir

func (e *BasicHTMLElement) Dir() string

func (*BasicHTMLElement) Draggable

func (e *BasicHTMLElement) Draggable() bool

func (*BasicHTMLElement) Focus

func (e *BasicHTMLElement) Focus()

func (*BasicHTMLElement) IsContentEditable

func (e *BasicHTMLElement) IsContentEditable() bool

func (*BasicHTMLElement) Lang

func (e *BasicHTMLElement) Lang() string

func (*BasicHTMLElement) OffsetHeight

func (e *BasicHTMLElement) OffsetHeight() float64

func (*BasicHTMLElement) OffsetLeft

func (e *BasicHTMLElement) OffsetLeft() float64

func (*BasicHTMLElement) OffsetParent

func (e *BasicHTMLElement) OffsetParent() HTMLElement

func (*BasicHTMLElement) OffsetTop

func (e *BasicHTMLElement) OffsetTop() float64

func (*BasicHTMLElement) OffsetWidth

func (e *BasicHTMLElement) OffsetWidth() float64

func (*BasicHTMLElement) SetAccessKey

func (e *BasicHTMLElement) SetAccessKey(s string)

func (*BasicHTMLElement) SetAccessKeyLabel

func (e *BasicHTMLElement) SetAccessKeyLabel(s string)

func (*BasicHTMLElement) SetContentEditable

func (e *BasicHTMLElement) SetContentEditable(s string)

func (*BasicHTMLElement) SetDir

func (e *BasicHTMLElement) SetDir(s string)

func (*BasicHTMLElement) SetDraggable

func (e *BasicHTMLElement) SetDraggable(b bool)

func (*BasicHTMLElement) SetLang

func (e *BasicHTMLElement) SetLang(s string)

func (*BasicHTMLElement) SetTabIndex

func (e *BasicHTMLElement) SetTabIndex(i int)

func (*BasicHTMLElement) SetTitle

func (e *BasicHTMLElement) SetTitle(s string)

func (*BasicHTMLElement) Style

func (*BasicHTMLElement) TabIndex

func (e *BasicHTMLElement) TabIndex() int

func (*BasicHTMLElement) Title

func (e *BasicHTMLElement) Title() string

type BasicNode

type BasicNode struct {
	*js.Object
}

Type BasicNode implements the Node interface and is embedded by concrete node types and element types.

func (*BasicNode) AddEventListener

func (n *BasicNode) AddEventListener(typ string, useCapture bool, listener func(Event)) func(*js.Object)

func (*BasicNode) AppendChild

func (n *BasicNode) AppendChild(newchild Node)

func (*BasicNode) BaseURI

func (n *BasicNode) BaseURI() string

func (*BasicNode) ChildNodes

func (n *BasicNode) ChildNodes() []Node

func (*BasicNode) CloneNode

func (n *BasicNode) CloneNode(deep bool) Node

func (*BasicNode) CompareDocumentPosition

func (n *BasicNode) CompareDocumentPosition(other Node) int

func (*BasicNode) Contains

func (n *BasicNode) Contains(other Node) bool

func (*BasicNode) DispatchEvent

func (n *BasicNode) DispatchEvent(event Event) bool

func (*BasicNode) FirstChild

func (n *BasicNode) FirstChild() Node

func (*BasicNode) HasChildNodes

func (n *BasicNode) HasChildNodes() bool

func (*BasicNode) InsertBefore

func (n *BasicNode) InsertBefore(which Node, before Node)

func (*BasicNode) IsDefaultNamespace

func (n *BasicNode) IsDefaultNamespace(s string) bool

func (*BasicNode) IsEqualNode

func (n *BasicNode) IsEqualNode(other Node) bool

func (*BasicNode) LastChild

func (n *BasicNode) LastChild() Node

func (*BasicNode) LookupNamespaceURI

func (n *BasicNode) LookupNamespaceURI(s string) string

func (*BasicNode) LookupPrefix

func (n *BasicNode) LookupPrefix() string

func (*BasicNode) NextSibling

func (n *BasicNode) NextSibling() Node

func (*BasicNode) NodeName

func (n *BasicNode) NodeName() string

func (*BasicNode) NodeType

func (n *BasicNode) NodeType() int

func (*BasicNode) NodeValue

func (n *BasicNode) NodeValue() string

func (*BasicNode) Normalize

func (n *BasicNode) Normalize()

func (*BasicNode) OwnerDocument

func (n *BasicNode) OwnerDocument() Document

func (*BasicNode) ParentElement

func (n *BasicNode) ParentElement() Element

func (*BasicNode) ParentNode

func (n *BasicNode) ParentNode() Node

func (*BasicNode) PreviousSibling

func (n *BasicNode) PreviousSibling() Node

func (*BasicNode) RemoveChild

func (n *BasicNode) RemoveChild(other Node)

func (*BasicNode) RemoveEventListener

func (n *BasicNode) RemoveEventListener(typ string, useCapture bool, listener func(*js.Object))

func (*BasicNode) ReplaceChild

func (n *BasicNode) ReplaceChild(newChild, oldChild Node)

func (*BasicNode) SetNodeValue

func (n *BasicNode) SetNodeValue(s string)

func (*BasicNode) SetTextContent

func (n *BasicNode) SetTextContent(s string)

func (*BasicNode) TextContent

func (n *BasicNode) TextContent() string

func (*BasicNode) Underlying

func (n *BasicNode) Underlying() *js.Object

type BeforeInputEvent

type BeforeInputEvent struct{ *BasicEvent }

type BeforeUnloadEvent

type BeforeUnloadEvent struct{ *BasicEvent }

type BlobEvent

type BlobEvent struct{ *BasicEvent }

type CSSFontFaceLoadEvent

type CSSFontFaceLoadEvent struct{ *BasicEvent }

type CSSStyleDeclaration

type CSSStyleDeclaration struct{ *js.Object }

func (*CSSStyleDeclaration) GetPropertyPriority

func (css *CSSStyleDeclaration) GetPropertyPriority(name string) string

func (*CSSStyleDeclaration) GetPropertyValue

func (css *CSSStyleDeclaration) GetPropertyValue(name string) string

func (*CSSStyleDeclaration) Index

func (css *CSSStyleDeclaration) Index(idx int) string

func (*CSSStyleDeclaration) Length

func (css *CSSStyleDeclaration) Length() int

func (*CSSStyleDeclaration) RemoveProperty

func (css *CSSStyleDeclaration) RemoveProperty(name string)

func (*CSSStyleDeclaration) SetProperty

func (css *CSSStyleDeclaration) SetProperty(name, value, priority string)

func (*CSSStyleDeclaration) ToMap

func (css *CSSStyleDeclaration) ToMap() map[string]string

type CSSStyleSheet

type CSSStyleSheet interface{}

type CanvasGradient

type CanvasGradient struct {
	*js.Object
}

CanvasGradient represents an opaque object describing a gradient. It is returned by the methods CanvasRenderingContext2D.CreateLinearGradient or CanvasRenderingContext2D.CreateRadialGradient.

Reference: https://developer.mozilla.org/en-US/docs/Web/API/CanvasGradient.

func (*CanvasGradient) AddColorStop

func (cg *CanvasGradient) AddColorStop(offset float64, color string)

AddColorStop adds a new stop, defined by an offset and a color, to the gradient. It panics with *js.Error if the offset is not between 0 and 1, or if the color can't be parsed as a CSS <color>.

Reference: https://developer.mozilla.org/en-US/docs/Web/API/CanvasGradient/addColorStop.

type CanvasPattern

type CanvasPattern struct {
	*js.Object
}

CanvasPattern represents an opaque object describing a pattern. It is based on an image, a canvas or a video, created by the CanvasRenderingContext2D.CreatePattern method.

Reference: https://developer.mozilla.org/en-US/docs/Web/API/CanvasPattern.

type CanvasRenderingContext2D

type CanvasRenderingContext2D struct {
	*js.Object

	FillStyle     string `js:"fillStyle"`
	StrokeStyle   string `js:"strokeStyle"`
	ShadowColor   string `js:"shadowColor"`
	ShadowBlur    int    `js:"shadowBlur"`
	ShadowOffsetX int    `js:"shadowOffsetX"`
	ShadowOffsetY int    `js:"shadowOffsetY"`

	LineCap    string `js:"lineCap"`
	LineJoin   string `js:"lineJoin"`
	LineWidth  int    `js:"lineWidth"`
	MiterLimit int    `js:"miterLimit"`

	Font         string `js:"font"`
	TextAlign    string `js:"textAlign"`
	TextBaseline string `js:"textBaseline"`

	GlobalAlpha              float64 `js:"globalAlpha"`
	GlobalCompositeOperation string  `js:"globalCompositeOperation"`
}

func (*CanvasRenderingContext2D) Arc

func (ctx *CanvasRenderingContext2D) Arc(x, y, r, sAngle, eAngle float64, counterclockwise bool)

func (*CanvasRenderingContext2D) ArcTo

func (ctx *CanvasRenderingContext2D) ArcTo(x1, y1, x2, y2, r float64)

func (*CanvasRenderingContext2D) BeginPath

func (ctx *CanvasRenderingContext2D) BeginPath()

func (*CanvasRenderingContext2D) BezierCurveTo

func (ctx *CanvasRenderingContext2D) BezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y float64)

func (*CanvasRenderingContext2D) ClearRect

func (ctx *CanvasRenderingContext2D) ClearRect(x, y, width, height float64)

func (*CanvasRenderingContext2D) Clip

func (ctx *CanvasRenderingContext2D) Clip()

func (*CanvasRenderingContext2D) ClosePath

func (ctx *CanvasRenderingContext2D) ClosePath()

func (*CanvasRenderingContext2D) CreateImageData

func (ctx *CanvasRenderingContext2D) CreateImageData(width, height int) *ImageData

func (*CanvasRenderingContext2D) CreateLinearGradient

func (ctx *CanvasRenderingContext2D) CreateLinearGradient(x0, y0, x1, y1 float64) *CanvasGradient

CreateLinearGradient creates a linear gradient along the line given by the coordinates represented by the parameters.

Reference: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/createLinearGradient.

func (*CanvasRenderingContext2D) CreatePattern

func (ctx *CanvasRenderingContext2D) CreatePattern(image Element, repetition string) *CanvasPattern

CreatePattern creates a pattern using the specified image (a CanvasImageSource). It repeats the source in the directions specified by the repetition argument.

Reference: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/createPattern.

func (*CanvasRenderingContext2D) CreateRadialGradient

func (ctx *CanvasRenderingContext2D) CreateRadialGradient(x0, y0, r0, x1, y1, r1 float64) *CanvasGradient

CreateRadialGradient creates a radial gradient given by the coordinates of the two circles represented by the parameters.

Reference: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/createRadialGradient.

func (*CanvasRenderingContext2D) DrawFocusIfNeeded

func (ctx *CanvasRenderingContext2D) DrawFocusIfNeeded(element HTMLElement, path *js.Object)

func (*CanvasRenderingContext2D) DrawImage

func (ctx *CanvasRenderingContext2D) DrawImage(image Element, dx, dy float64)

func (*CanvasRenderingContext2D) DrawImageWithDst

func (ctx *CanvasRenderingContext2D) DrawImageWithDst(image Element, dx, dy, dWidth, dHeight float64)

func (*CanvasRenderingContext2D) DrawImageWithSrcAndDst

func (ctx *CanvasRenderingContext2D) DrawImageWithSrcAndDst(image Element, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight float64)

func (*CanvasRenderingContext2D) Ellipse

func (ctx *CanvasRenderingContext2D) Ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle float64, anticlockwise bool)

func (*CanvasRenderingContext2D) Fill

func (ctx *CanvasRenderingContext2D) Fill()

func (*CanvasRenderingContext2D) FillRect

func (ctx *CanvasRenderingContext2D) FillRect(x, y, width, height float64)

func (*CanvasRenderingContext2D) FillText

func (ctx *CanvasRenderingContext2D) FillText(text string, x, y, maxWidth float64)

FillText fills a given text at the given (x, y) position. If the optional maxWidth parameter is not -1, the text will be scaled to fit that width.

func (*CanvasRenderingContext2D) GetImageData

func (ctx *CanvasRenderingContext2D) GetImageData(sx, sy, sw, sh int) *ImageData

func (*CanvasRenderingContext2D) GetLineDash

func (ctx *CanvasRenderingContext2D) GetLineDash() []float64

func (*CanvasRenderingContext2D) IsPointInPath

func (ctx *CanvasRenderingContext2D) IsPointInPath(x, y float64) bool

func (*CanvasRenderingContext2D) IsPointInStroke

func (ctx *CanvasRenderingContext2D) IsPointInStroke(path *js.Object, x, y float64) bool

func (*CanvasRenderingContext2D) LineTo

func (ctx *CanvasRenderingContext2D) LineTo(x, y float64)

func (*CanvasRenderingContext2D) MeasureText

func (ctx *CanvasRenderingContext2D) MeasureText(text string) *TextMetrics

func (*CanvasRenderingContext2D) MoveTo

func (ctx *CanvasRenderingContext2D) MoveTo(x, y float64)

func (*CanvasRenderingContext2D) PutImageData

func (ctx *CanvasRenderingContext2D) PutImageData(imageData *ImageData, dx, dy float64)

func (*CanvasRenderingContext2D) PutImageDataDirty

func (ctx *CanvasRenderingContext2D) PutImageDataDirty(imageData *ImageData, dx, dy float64, dirtyX, dirtyY, dirtyWidth, dirtyHeight int)

func (*CanvasRenderingContext2D) QuadraticCurveTo

func (ctx *CanvasRenderingContext2D) QuadraticCurveTo(cpx, cpy, x, y float64)

func (*CanvasRenderingContext2D) Rect

func (ctx *CanvasRenderingContext2D) Rect(x, y, width, height float64)

func (*CanvasRenderingContext2D) ResetTransform

func (ctx *CanvasRenderingContext2D) ResetTransform()

func (*CanvasRenderingContext2D) Restore

func (ctx *CanvasRenderingContext2D) Restore()

func (*CanvasRenderingContext2D) Rotate

func (ctx *CanvasRenderingContext2D) Rotate(angle float64)

func (*CanvasRenderingContext2D) Save

func (ctx *CanvasRenderingContext2D) Save()

func (*CanvasRenderingContext2D) Scale

func (ctx *CanvasRenderingContext2D) Scale(scaleWidth, scaleHeight float64)

func (*CanvasRenderingContext2D) ScrollPathIntoView

func (ctx *CanvasRenderingContext2D) ScrollPathIntoView(path *js.Object)

func (*CanvasRenderingContext2D) SetLineDash

func (ctx *CanvasRenderingContext2D) SetLineDash(dashes []float64)

func (*CanvasRenderingContext2D) SetTransform

func (ctx *CanvasRenderingContext2D) SetTransform(a, b, c, d, e, f float64)

func (*CanvasRenderingContext2D) Stroke

func (ctx *CanvasRenderingContext2D) Stroke()

func (*CanvasRenderingContext2D) StrokeRect

func (ctx *CanvasRenderingContext2D) StrokeRect(x, y, width, height float64)

func (*CanvasRenderingContext2D) StrokeText

func (ctx *CanvasRenderingContext2D) StrokeText(text string, x, y, maxWidth float64)

StrokeText strokes a given text at the given (x, y) position. If the optional maxWidth parameter is not -1, the text will be scaled to fit that width.

func (*CanvasRenderingContext2D) Transform

func (ctx *CanvasRenderingContext2D) Transform(a, b, c, d, e, f float64)

func (*CanvasRenderingContext2D) Translate

func (ctx *CanvasRenderingContext2D) Translate(x, y float64)

type ChildNode

type ChildNode interface {
	PreviousElementSibling() Element
	NextElementSibling() Element
}

type ClientRect

type ClientRect struct {
	*js.Object
	Height float64 `js:"height"`
	Width  float64 `js:"width"`
	Left   float64 `js:"left"`
	Right  float64 `js:"right"`
	Top    float64 `js:"top"`
	Bottom float64 `js:"bottom"`
}

type ClipboardEvent

type ClipboardEvent struct{ *BasicEvent }

type CloseEvent

type CloseEvent struct {
	*BasicEvent
	Code     int    `js:"code"`
	Reason   string `js:"reason"`
	WasClean bool   `js:"wasClean"`
}

type CompositionEvent

type CompositionEvent struct{ *BasicEvent }

type Console

type Console struct {
	*js.Object
}

type Coordinates

type Coordinates struct {
	*js.Object
	Latitude         float64 `js:"latitude"`
	Longitude        float64 `js:"longitude"`
	Altitude         float64 `js:"altitude"`
	Accuracy         float64 `js:"accuracy"`
	AltitudeAccuracy float64 `js:"altitudeAccuracy"`
	Heading          float64 `js:"heading"`
	Speed            float64 `js:"speed"`
}

type CustomEvent

type CustomEvent struct{ *BasicEvent }

type DOMImplementation

type DOMImplementation interface{}

type DOMTransactionEvent

type DOMTransactionEvent struct{ *BasicEvent }

type DeviceLightEvent

type DeviceLightEvent struct{ *BasicEvent }

type DeviceMotionEvent

type DeviceMotionEvent struct{ *BasicEvent }

type DeviceOrientationEvent

type DeviceOrientationEvent struct{ *BasicEvent }

type DeviceProximityEvent

type DeviceProximityEvent struct{ *BasicEvent }

type Document

type Document interface {
	Node
	ParentNode

	Async() bool
	SetAsync(bool)
	Doctype() DocumentType
	DocumentElement() Element
	DocumentURI() string
	Implementation() DOMImplementation
	LastStyleSheetSet() string
	PreferredStyleSheetSet() string // TODO correct type?
	SelectedStyleSheetSet() string  // TODO correct type?
	StyleSheets() []StyleSheet      // TODO s/StyleSheet/Stylesheet/ ?
	StyleSheetSets() []StyleSheet   // TODO correct type?
	AdoptNode(node Node) Node
	ImportNode(node Node, deep bool) Node
	CreateElement(name string) Element
	CreateElementNS(namespace, name string) Element
	CreateTextNode(s string) *Text
	ElementFromPoint(x, y int) Element
	EnableStyleSheetsForSet(name string)
	GetElementsByClassName(name string) []Element
	GetElementsByTagName(name string) []Element
	GetElementsByTagNameNS(ns, name string) []Element
	GetElementByID(id string) Element
	QuerySelector(sel string) Element
	QuerySelectorAll(sel string) []Element

	CreateDocumentFragment() DocumentFragment
}

func WrapDocument

func WrapDocument(o *js.Object) Document

type DocumentFragment

type DocumentFragment interface {
	Node
	ParentNode
	QuerySelector(sel string) Element
	QuerySelectorAll(sel string) []Element
	GetElementByID(id string) Element
}

func WrapDocumentFragment

func WrapDocumentFragment(o *js.Object) DocumentFragment

type DocumentType

type DocumentType interface{}

type DragEvent

type DragEvent struct{ *BasicEvent }

type EditingBeforeInputEvent

type EditingBeforeInputEvent struct{ *BasicEvent }

type Element

type Element interface {
	Node
	ParentNode
	ChildNode

	Attributes() map[string]string
	Class() *TokenList
	Closest(string) Element
	ID() string
	SetID(string)
	TagName() string
	GetAttribute(string) string                   // TODO can attributes only be strings?
	GetAttributeNS(ns string, name string) string // can attributes only be strings?
	GetBoundingClientRect() ClientRect
	GetElementsByClassName(string) []Element
	GetElementsByTagName(string) []Element
	GetElementsByTagNameNS(ns string, name string) []Element
	HasAttribute(string) bool
	HasAttributeNS(ns string, name string) bool
	Matches(string) bool
	QuerySelector(string) Element
	QuerySelectorAll(string) []Element
	RemoveAttribute(string)
	RemoveAttributeNS(ns string, name string)
	SetAttribute(name string, value string)
	SetAttributeNS(ns string, name string, value string)
	InnerHTML() string
	SetInnerHTML(string)
	OuterHTML() string
	SetOuterHTML(string)
}

func WrapElement

func WrapElement(o *js.Object) Element

type ErrorEvent

type ErrorEvent struct{ *BasicEvent }

type Event

type Event interface {
	Bubbles() bool
	Cancelable() bool
	CurrentTarget() Element
	DefaultPrevented() bool
	EventPhase() int
	Target() Element
	Timestamp() time.Time
	Type() string
	PreventDefault()
	StopImmediatePropagation()
	StopPropagation()
	Underlying() *js.Object
}

func WrapEvent

func WrapEvent(o *js.Object) Event

type EventOptions

type EventOptions struct {
	Bubbles    bool
	Cancelable bool
}

type EventTarget

type EventTarget interface {
	// AddEventListener adds a new event listener and returns the
	// wrapper function it generated. If using RemoveEventListener,
	// that wrapper has to be used.
	AddEventListener(typ string, useCapture bool, listener func(Event)) func(*js.Object)
	RemoveEventListener(typ string, useCapture bool, listener func(*js.Object))
	DispatchEvent(event Event) bool
}

type File

type File struct {
	*js.Object
}

File represents files as can be obtained from file choosers or drag and drop. The dom package does not define any methods on File nor does it provide access to the blob or a way to read it.

type FocusEvent

type FocusEvent struct{ *BasicEvent }

func (*FocusEvent) RelatedTarget

func (ev *FocusEvent) RelatedTarget() Element

type GamepadEvent

type GamepadEvent struct{ *BasicEvent }

type Geolocation

type Geolocation interface {
	// TODO wrap PositionOptions into something that uses the JS
	// object
	CurrentPosition(success func(Position), err func(PositionError), opts PositionOptions) Position
	WatchPosition(success func(Position), err func(PositionError), opts PositionOptions) int
	ClearWatch(int)
}

type GlobalEventHandlers

type GlobalEventHandlers interface{}

type HTMLAnchorElement

type HTMLAnchorElement struct {
	*BasicHTMLElement
	*URLUtils
	HrefLang string `js:"hreflang"`
	Media    string `js:"media"`
	TabIndex int    `js:"tabIndex"`
	Target   string `js:"target"`
	Text     string `js:"text"`
	Type     string `js:"type"`
}

func (*HTMLAnchorElement) Rel

func (e *HTMLAnchorElement) Rel() *TokenList

type HTMLAppletElement

type HTMLAppletElement struct {
	*BasicHTMLElement
	Alt      string `js:"alt"`
	Coords   string `js:"coords"`
	HrefLang string `js:"hreflang"`
	Media    string `js:"media"`
	Search   string `js:"search"`
	Shape    string `js:"shape"`
	TabIndex int    `js:"tabIndex"`
	Target   string `js:"target"`
	Type     string `js:"type"`
}

func (*HTMLAppletElement) Rel

func (e *HTMLAppletElement) Rel() *TokenList

type HTMLAreaElement

type HTMLAreaElement struct {
	*BasicHTMLElement
	*URLUtils
	Alt      string `js:"alt"`
	Coords   string `js:"coords"`
	HrefLang string `js:"hreflang"`
	Media    string `js:"media"`
	Search   string `js:"search"`
	Shape    string `js:"shape"`
	TabIndex int    `js:"tabIndex"`
	Target   string `js:"target"`
	Type     string `js:"type"`
}

func (*HTMLAreaElement) Rel

func (e *HTMLAreaElement) Rel() *TokenList

type HTMLAudioElement

type HTMLAudioElement struct{ *HTMLMediaElement }

type HTMLBRElement

type HTMLBRElement struct{ *BasicHTMLElement }

type HTMLBaseElement

type HTMLBaseElement struct{ *BasicHTMLElement }

func (*HTMLBaseElement) Href

func (e *HTMLBaseElement) Href() string

func (*HTMLBaseElement) Target

func (e *HTMLBaseElement) Target() string

type HTMLBodyElement

type HTMLBodyElement struct{ *BasicHTMLElement }

type HTMLButtonElement

type HTMLButtonElement struct {
	*BasicHTMLElement
	AutoFocus         bool   `js:"autofocus"`
	Disabled          bool   `js:"disabled"`
	FormAction        string `js:"formAction"`
	FormEncType       string `js:"formEncType"`
	FormMethod        string `js:"formMethod"`
	FormNoValidate    bool   `js:"formNoValidate"`
	FormTarget        string `js:"formTarget"`
	Name              string `js:"name"`
	TabIndex          int    `js:"tabIndex"`
	Type              string `js:"type"`
	ValidationMessage string `js:"validationMessage"`
	Value             string `js:"value"`
	WillValidate      bool   `js:"willValidate"`
}

func (*HTMLButtonElement) CheckValidity

func (e *HTMLButtonElement) CheckValidity() bool

func (*HTMLButtonElement) Form

func (*HTMLButtonElement) Labels

func (e *HTMLButtonElement) Labels() []*HTMLLabelElement

func (*HTMLButtonElement) SetCustomValidity

func (e *HTMLButtonElement) SetCustomValidity(s string)

func (*HTMLButtonElement) Validity

func (e *HTMLButtonElement) Validity() *ValidityState

type HTMLCanvasElement

type HTMLCanvasElement struct {
	*BasicHTMLElement
	Height int `js:"height"`
	Width  int `js:"width"`
}

func (*HTMLCanvasElement) GetContext

func (e *HTMLCanvasElement) GetContext(param string) *js.Object

func (*HTMLCanvasElement) GetContext2d

func (e *HTMLCanvasElement) GetContext2d() *CanvasRenderingContext2D

type HTMLDListElement

type HTMLDListElement struct{ *BasicHTMLElement }

type HTMLDataElement

type HTMLDataElement struct {
	*BasicHTMLElement
	Value string `js:"value"`
}

type HTMLDataListElement

type HTMLDataListElement struct{ *BasicHTMLElement }

func (*HTMLDataListElement) Options

func (e *HTMLDataListElement) Options() []*HTMLOptionElement

type HTMLDirectoryElement

type HTMLDirectoryElement struct{ *BasicHTMLElement }

type HTMLDivElement

type HTMLDivElement struct{ *BasicHTMLElement }

type HTMLDocument

type HTMLDocument interface {
	Document

	ActiveElement() HTMLElement
	Body() HTMLElement
	Cookie() string
	SetCookie(string)
	DefaultView() Window
	DesignMode() bool
	SetDesignMode(bool)
	Domain() string
	SetDomain(string)
	Forms() []*HTMLFormElement
	Head() *HTMLHeadElement
	Images() []*HTMLImageElement
	LastModified() time.Time
	Links() []HTMLElement
	Location() *Location
	Plugins() []*HTMLEmbedElement
	ReadyState() string
	Referrer() string
	Scripts() []*HTMLScriptElement
	Title() string
	SetTitle(string)
	URL() string
}

type HTMLElement

type HTMLElement interface {
	Element
	GlobalEventHandlers

	AccessKey() string
	Dataset() map[string]string
	SetAccessKey(string)
	AccessKeyLabel() string
	SetAccessKeyLabel(string)
	ContentEditable() string
	SetContentEditable(string)
	IsContentEditable() bool
	Dir() string
	SetDir(string)
	Draggable() bool
	SetDraggable(bool)
	Lang() string
	SetLang(string)
	OffsetHeight() float64
	OffsetLeft() float64
	OffsetParent() HTMLElement
	OffsetTop() float64
	OffsetWidth() float64
	Style() *CSSStyleDeclaration
	Title() string
	SetTitle(string)
	Blur()
	Click()
	Focus()
}

func WrapHTMLElement

func WrapHTMLElement(o *js.Object) HTMLElement

type HTMLEmbedElement

type HTMLEmbedElement struct {
	*BasicHTMLElement
	Src   string `js:"src"`
	Type  string `js:"type"`
	Width string `js:"width"`
}

type HTMLFieldSetElement

type HTMLFieldSetElement struct {
	*BasicHTMLElement
	Disabled          bool   `js:"disabled"`
	Name              string `js:"name"`
	Type              string `js:"type"`
	ValidationMessage string `js:"validationMessage"`
	WillValidate      bool   `js:"willValidate"`
}

func (*HTMLFieldSetElement) CheckValidity

func (e *HTMLFieldSetElement) CheckValidity() bool

func (*HTMLFieldSetElement) Elements

func (e *HTMLFieldSetElement) Elements() []HTMLElement

func (*HTMLFieldSetElement) Form

func (*HTMLFieldSetElement) SetCustomValidity

func (e *HTMLFieldSetElement) SetCustomValidity(s string)

func (*HTMLFieldSetElement) Validity

func (e *HTMLFieldSetElement) Validity() *ValidityState

type HTMLFontElement

type HTMLFontElement struct{ *BasicHTMLElement }

type HTMLFormElement

type HTMLFormElement struct {
	*BasicHTMLElement
	AcceptCharset string `js:"acceptCharset"`
	Action        string `js:"action"`
	Autocomplete  string `js:"autocomplete"`
	Encoding      string `js:"encoding"`
	Enctype       string `js:"enctype"`
	Length        int    `js:"length"`
	Method        string `js:"method"`
	Name          string `js:"name"`
	NoValidate    bool   `js:"noValidate"`
	Target        string `js:"target"`
}

func (*HTMLFormElement) CheckValidity

func (e *HTMLFormElement) CheckValidity() bool

func (*HTMLFormElement) Elements

func (e *HTMLFormElement) Elements() []HTMLElement

func (*HTMLFormElement) Item

func (e *HTMLFormElement) Item(index int) HTMLElement

func (*HTMLFormElement) NamedItem

func (e *HTMLFormElement) NamedItem(name string) HTMLElement

func (*HTMLFormElement) Reset

func (e *HTMLFormElement) Reset()

func (*HTMLFormElement) Submit

func (e *HTMLFormElement) Submit()

type HTMLFrameElement

type HTMLFrameElement struct{ *BasicHTMLElement }

type HTMLFrameSetElement

type HTMLFrameSetElement struct{ *BasicHTMLElement }

type HTMLHRElement

type HTMLHRElement struct{ *BasicHTMLElement }

type HTMLHeadElement

type HTMLHeadElement struct{ *BasicHTMLElement }

type HTMLHeadingElement

type HTMLHeadingElement struct{ *BasicHTMLElement }

type HTMLHtmlElement

type HTMLHtmlElement struct{ *BasicHTMLElement }

type HTMLIFrameElement

type HTMLIFrameElement struct {
	*BasicHTMLElement
	Width    string `js:"width"`
	Height   string `js:"height"`
	Name     string `js:"name"`
	Src      string `js:"src"`
	SrcDoc   string `js:"srcdoc"`
	Seamless bool   `js:"seamless"`
}

func (*HTMLIFrameElement) ContentDocument

func (e *HTMLIFrameElement) ContentDocument() Document

func (*HTMLIFrameElement) ContentWindow

func (e *HTMLIFrameElement) ContentWindow() Window

type HTMLImageElement

type HTMLImageElement struct {
	*BasicHTMLElement
	Complete      bool   `js:"complete"`
	CrossOrigin   string `js:"crossOrigin"`
	Height        int    `js:"height"`
	IsMap         bool   `js:"isMap"`
	NaturalHeight int    `js:"naturalHeight"`
	NaturalWidth  int    `js:"naturalWidth"`
	Src           string `js:"src"`
	UseMap        string `js:"useMap"`
	Width         int    `js:"width"`
}

type HTMLInputElement

type HTMLInputElement struct {
	*BasicHTMLElement
	Accept             string    `js:"accept"`
	Alt                string    `js:"alt"`
	Autocomplete       string    `js:"autocomplete"`
	Autofocus          bool      `js:"autofocus"`
	Checked            bool      `js:"checked"`
	DefaultChecked     bool      `js:"defaultChecked"`
	DefaultValue       string    `js:"defaultValue"`
	DirName            string    `js:"dirName"`
	Disabled           bool      `js:"disabled"`
	FormAction         string    `js:"formAction"`
	FormEncType        string    `js:"formEncType"`
	FormMethod         string    `js:"formMethod"`
	FormNoValidate     bool      `js:"formNoValidate"`
	FormTarget         string    `js:"formTarget"`
	Height             string    `js:"height"`
	Indeterminate      bool      `js:"indeterminate"`
	Max                string    `js:"max"`
	MaxLength          int       `js:"maxLength"`
	Min                string    `js:"min"`
	Multiple           bool      `js:"multiple"`
	Name               string    `js:"name"`
	Pattern            string    `js:"pattern"`
	Placeholder        string    `js:"placeholder"`
	ReadOnly           bool      `js:"readOnly"`
	Required           bool      `js:"required"`
	SelectionDirection string    `js:"selectionDirection"`
	SelectionEnd       int       `js:"selectionEnd"`
	SelectionStart     int       `js:"selectionStart"`
	Size               int       `js:"size"`
	Src                string    `js:"src"`
	Step               string    `js:"step"`
	TabIndex           int       `js:"tabIndex"`
	Type               string    `js:"type"`
	ValidationMessage  string    `js:"validationMessage"`
	Value              string    `js:"value"`
	ValueAsDate        time.Time `js:"valueAsDate"`
	ValueAsNumber      float64   `js:"valueAsNumber"`
	Width              string    `js:"width"`
	WillValidate       bool      `js:"willValidate"`
}

func (*HTMLInputElement) CheckValidity

func (e *HTMLInputElement) CheckValidity() bool

func (*HTMLInputElement) Files

func (e *HTMLInputElement) Files() []*File

func (*HTMLInputElement) Form

func (e *HTMLInputElement) Form() *HTMLFormElement

func (*HTMLInputElement) Labels

func (e *HTMLInputElement) Labels() []*HTMLLabelElement

func (*HTMLInputElement) List

func (*HTMLInputElement) Select

func (e *HTMLInputElement) Select()

func (*HTMLInputElement) SetCustomValidity

func (e *HTMLInputElement) SetCustomValidity(s string)

func (*HTMLInputElement) SetSelectionRange

func (e *HTMLInputElement) SetSelectionRange(start, end int, direction string)

func (*HTMLInputElement) StepDown

func (e *HTMLInputElement) StepDown(n int) error

func (*HTMLInputElement) StepUp

func (e *HTMLInputElement) StepUp(n int) error

func (*HTMLInputElement) Validity

func (e *HTMLInputElement) Validity() *ValidityState

type HTMLKeygenElement

type HTMLKeygenElement struct {
	*BasicHTMLElement
	Autofocus         bool   `js:"autofocus"`
	Challenge         string `js:"challenge"`
	Disabled          bool   `js:"disabled"`
	Keytype           string `js:"keytype"`
	Name              string `js:"name"`
	Type              string `js:"type"`
	ValidationMessage string `js:"validationMessage"`
	WillValidate      bool   `js:"willValidate"`
}

func (*HTMLKeygenElement) CheckValidity

func (e *HTMLKeygenElement) CheckValidity() bool

func (*HTMLKeygenElement) Form

func (*HTMLKeygenElement) Labels

func (e *HTMLKeygenElement) Labels() []*HTMLLabelElement

func (*HTMLKeygenElement) SetCustomValidity

func (e *HTMLKeygenElement) SetCustomValidity(s string)

func (*HTMLKeygenElement) Validity

func (e *HTMLKeygenElement) Validity() *ValidityState

type HTMLLIElement

type HTMLLIElement struct {
	*BasicHTMLElement
	Value int `js:"value"`
}

type HTMLLabelElement

type HTMLLabelElement struct {
	*BasicHTMLElement
	For string `js:"htmlFor"`
}

func (*HTMLLabelElement) Control

func (e *HTMLLabelElement) Control() HTMLElement

func (*HTMLLabelElement) Form

func (e *HTMLLabelElement) Form() *HTMLFormElement

type HTMLLegendElement

type HTMLLegendElement struct{ *BasicHTMLElement }

func (*HTMLLegendElement) Form

type HTMLLinkElement

type HTMLLinkElement struct {
	*BasicHTMLElement
	Disabled bool   `js:"disabled"`
	Href     string `js:"href"`
	HrefLang string `js:"hrefLang"`
	Media    string `js:"media"`
	Type     string `js:"type"`
}

func (*HTMLLinkElement) Rel

func (e *HTMLLinkElement) Rel() *TokenList

func (*HTMLLinkElement) Sheet

func (e *HTMLLinkElement) Sheet() StyleSheet

func (*HTMLLinkElement) Sizes

func (e *HTMLLinkElement) Sizes() *TokenList

type HTMLMapElement

type HTMLMapElement struct {
	*BasicHTMLElement
	Name string `js:"name"`
}

func (*HTMLMapElement) Areas

func (e *HTMLMapElement) Areas() []*HTMLAreaElement

func (*HTMLMapElement) Images

func (e *HTMLMapElement) Images() []HTMLElement

type HTMLMediaElement

type HTMLMediaElement struct {
	*BasicHTMLElement
	Paused bool `js:"paused"`
}

func (*HTMLMediaElement) Pause

func (e *HTMLMediaElement) Pause()

func (*HTMLMediaElement) Play

func (e *HTMLMediaElement) Play()

type HTMLMenuElement

type HTMLMenuElement struct{ *BasicHTMLElement }

type HTMLMetaElement

type HTMLMetaElement struct {
	*BasicHTMLElement
	Content   string `js:"content"`
	HTTPEquiv string `js:"httpEquiv"`
	Name      string `js:"name"`
}

type HTMLMeterElement

type HTMLMeterElement struct {
	*BasicHTMLElement
	High    float64 `js:"high"`
	Low     float64 `js:"low"`
	Max     float64 `js:"max"`
	Min     float64 `js:"min"`
	Optimum float64 `js:"optimum"`
}

func (HTMLMeterElement) Labels

func (e HTMLMeterElement) Labels() []*HTMLLabelElement

type HTMLModElement

type HTMLModElement struct {
	*BasicHTMLElement
	Cite     string `js:"cite"`
	DateTime string `js:"dateTime"`
}

type HTMLOListElement

type HTMLOListElement struct {
	*BasicHTMLElement
	Reversed bool   `js:"reversed"`
	Start    int    `js:"start"`
	Type     string `js:"type"`
}

type HTMLObjectElement

type HTMLObjectElement struct {
	*BasicHTMLElement
	Data              string `js:"data"`
	Height            string `js:"height"`
	Name              string `js:"name"`
	TabIndex          int    `js:"tabIndex"`
	Type              string `js:"type"`
	TypeMustMatch     bool   `js:"typeMustMatch"`
	UseMap            string `js:"useMap"`
	ValidationMessage string `js:"validationMessage"`
	With              string `js:"with"`
	WillValidate      bool   `js:"willValidate"`
}

func (*HTMLObjectElement) CheckValidity

func (e *HTMLObjectElement) CheckValidity() bool

func (*HTMLObjectElement) ContentDocument

func (e *HTMLObjectElement) ContentDocument() Document

func (*HTMLObjectElement) ContentWindow

func (e *HTMLObjectElement) ContentWindow() Window

func (*HTMLObjectElement) Form

func (*HTMLObjectElement) SetCustomValidity

func (e *HTMLObjectElement) SetCustomValidity(s string)

func (*HTMLObjectElement) Validity

func (e *HTMLObjectElement) Validity() *ValidityState

type HTMLOptGroupElement

type HTMLOptGroupElement struct {
	*BasicHTMLElement
	Disabled bool   `js:"disabled"`
	Label    string `js:"label"`
}

type HTMLOptionElement

type HTMLOptionElement struct {
	*BasicHTMLElement
	DefaultSelected bool   `js:"defaultSelected"`
	Disabled        bool   `js:"disabled"`
	Index           int    `js:"index"`
	Label           string `js:"label"`
	Selected        bool   `js:"selected"`
	Text            string `js:"text"`
	Value           string `js:"value"`
}

func (*HTMLOptionElement) Form

type HTMLOutputElement

type HTMLOutputElement struct {
	*BasicHTMLElement
	DefaultValue      string `js:"defaultValue"`
	Name              string `js:"name"`
	Type              string `js:"type"`
	ValidationMessage string `js:"validationMessage"`
	Value             string `js:"value"`
	WillValidate      bool   `js:"willValidate"`
}

func (*HTMLOutputElement) CheckValidity

func (e *HTMLOutputElement) CheckValidity() bool

func (*HTMLOutputElement) For

func (e *HTMLOutputElement) For() *TokenList

func (*HTMLOutputElement) Form

func (*HTMLOutputElement) Labels

func (e *HTMLOutputElement) Labels() []*HTMLLabelElement

func (*HTMLOutputElement) SetCustomValidity

func (e *HTMLOutputElement) SetCustomValidity(s string)

func (*HTMLOutputElement) Validity

func (e *HTMLOutputElement) Validity() *ValidityState

type HTMLParagraphElement

type HTMLParagraphElement struct{ *BasicHTMLElement }

type HTMLParamElement

type HTMLParamElement struct {
	*BasicHTMLElement
	Name  string `js:"name"`
	Value string `js:"value"`
}

type HTMLPreElement

type HTMLPreElement struct{ *BasicHTMLElement }

type HTMLProgressElement

type HTMLProgressElement struct {
	*BasicHTMLElement
	Max      float64 `js:"max"`
	Position float64 `js:"position"`
	Value    float64 `js:"value"`
}

func (HTMLProgressElement) Labels

func (e HTMLProgressElement) Labels() []*HTMLLabelElement

type HTMLQuoteElement

type HTMLQuoteElement struct {
	*BasicHTMLElement
	Cite string `js:"cite"`
}

type HTMLScriptElement

type HTMLScriptElement struct {
	*BasicHTMLElement
	Type    string `js:"type"`
	Src     string `js:"src"`
	Charset string `js:"charset"`
	Async   bool   `js:"async"`
	Defer   bool   `js:"defer"`
	Text    string `js:"text"`
}

type HTMLSelectElement

type HTMLSelectElement struct {
	*BasicHTMLElement
	Autofocus         bool   `js:"autofocus"`
	Disabled          bool   `js:"disabled"`
	Length            int    `js:"length"`
	Multiple          bool   `js:"multiple"`
	Name              string `js:"name"`
	Required          bool   `js:"required"`
	SelectedIndex     int    `js:"selectedIndex"`
	Size              int    `js:"size"`
	Type              string `js:"type"`
	ValidationMessage string `js:"validationMessage"`
	Value             string `js:"value"`
	WillValidate      bool   `js:"willValidate"`
}

func (*HTMLSelectElement) CheckValidity

func (e *HTMLSelectElement) CheckValidity() bool

func (*HTMLSelectElement) Form

func (*HTMLSelectElement) Item

func (e *HTMLSelectElement) Item(index int) *HTMLOptionElement

func (*HTMLSelectElement) Labels

func (e *HTMLSelectElement) Labels() []*HTMLLabelElement

func (*HTMLSelectElement) NamedItem

func (e *HTMLSelectElement) NamedItem(name string) *HTMLOptionElement

func (*HTMLSelectElement) Options

func (e *HTMLSelectElement) Options() []*HTMLOptionElement

func (*HTMLSelectElement) SelectedOptions

func (e *HTMLSelectElement) SelectedOptions() []*HTMLOptionElement

func (*HTMLSelectElement) SetCustomValidity

func (e *HTMLSelectElement) SetCustomValidity(s string)

func (*HTMLSelectElement) Validity

func (e *HTMLSelectElement) Validity() *ValidityState

type HTMLSourceElement

type HTMLSourceElement struct {
	*BasicHTMLElement
	Media string `js:"media"`
	Src   string `js:"src"`
	Type  string `js:"type"`
}

type HTMLSpanElement

type HTMLSpanElement struct{ *BasicHTMLElement }

type HTMLStyleElement

type HTMLStyleElement struct{ *BasicHTMLElement }

type HTMLTableCaptionElement

type HTMLTableCaptionElement struct{ *BasicHTMLElement }

type HTMLTableCellElement

type HTMLTableCellElement struct {
	*BasicHTMLElement
	ColSpan   int `js:"colSpan"`
	RowSpan   int `js:"rowSpan"`
	CellIndex int `js:"cellIndex"`
}

type HTMLTableColElement

type HTMLTableColElement struct {
	*BasicHTMLElement
	Span int `js:"span"`
}

type HTMLTableDataCellElement

type HTMLTableDataCellElement struct{ *BasicHTMLElement }

type HTMLTableElement

type HTMLTableElement struct{ *BasicHTMLElement }

type HTMLTableHeaderCellElement

type HTMLTableHeaderCellElement struct {
	*BasicHTMLElement
	Abbr  string `js:"abbr"`
	Scope string `js:"scope"`
}

type HTMLTableRowElement

type HTMLTableRowElement struct {
	*BasicHTMLElement
	RowIndex        int `js:"rowIndex"`
	SectionRowIndex int `js:"sectionRowIndex"`
}

func (*HTMLTableRowElement) Cells

func (*HTMLTableRowElement) DeleteCell

func (e *HTMLTableRowElement) DeleteCell(index int)

func (*HTMLTableRowElement) InsertCell

func (e *HTMLTableRowElement) InsertCell(index int) *HTMLTableCellElement

type HTMLTableSectionElement

type HTMLTableSectionElement struct{ *BasicHTMLElement }

func (*HTMLTableSectionElement) DeleteRow

func (e *HTMLTableSectionElement) DeleteRow(index int)

func (*HTMLTableSectionElement) InsertRow

func (e *HTMLTableSectionElement) InsertRow(index int) *HTMLTableRowElement

func (*HTMLTableSectionElement) Rows

type HTMLTemplateElement

type HTMLTemplateElement struct{ *BasicHTMLElement }

func (*HTMLTemplateElement) Content

type HTMLTextAreaElement

type HTMLTextAreaElement struct {
	*BasicHTMLElement
	Autocomplete       string `js:"autocomplete"`
	Autofocus          bool   `js:"autofocus"`
	Cols               int    `js:"cols"`
	DefaultValue       string `js:"defaultValue"`
	DirName            string `js:"dirName"`
	Disabled           bool   `js:"disabled"`
	MaxLength          int    `js:"maxLength"`
	Name               string `js:"name"`
	Placeholder        string `js:"placeholder"`
	ReadOnly           bool   `js:"readOnly"`
	Required           bool   `js:"required"`
	Rows               int    `js:"rows"`
	SelectionDirection string `js:"selectionDirection"`
	SelectionStart     int    `js:"selectionStart"`
	SelectionEnd       int    `js:"selectionEnd"`
	TabIndex           int    `js:"tabIndex"`
	TextLength         int    `js:"textLength"`
	Type               string `js:"type"`
	ValidationMessage  string `js:"validationMessage"`
	Value              string `js:"value"`
	WillValidate       bool   `js:"willValidate"`
	Wrap               string `js:"wrap"`
}

func (*HTMLTextAreaElement) CheckValidity

func (e *HTMLTextAreaElement) CheckValidity() bool

func (*HTMLTextAreaElement) Form

func (*HTMLTextAreaElement) Labels

func (e *HTMLTextAreaElement) Labels() []*HTMLLabelElement

func (*HTMLTextAreaElement) Select

func (e *HTMLTextAreaElement) Select()

func (*HTMLTextAreaElement) SetCustomValidity

func (e *HTMLTextAreaElement) SetCustomValidity(s string)

func (*HTMLTextAreaElement) SetSelectionRange

func (e *HTMLTextAreaElement) SetSelectionRange(start, end int, direction string)

func (*HTMLTextAreaElement) Validity

func (e *HTMLTextAreaElement) Validity() *ValidityState

type HTMLTimeElement

type HTMLTimeElement struct {
	*BasicHTMLElement
	DateTime string `js:"dateTime"`
}

type HTMLTitleElement

type HTMLTitleElement struct {
	*BasicHTMLElement
	Text string `js:"text"`
}

type HTMLTrackElement

type HTMLTrackElement struct {
	*BasicHTMLElement
	Kind       string `js:"kind"`
	Src        string `js:"src"`
	Srclang    string `js:"srclang"`
	Label      string `js:"label"`
	Default    bool   `js:"default"`
	ReadyState int    `js:"readyState"`
}

func (*HTMLTrackElement) Track

func (e *HTMLTrackElement) Track() *TextTrack

type HTMLUListElement

type HTMLUListElement struct{ *BasicHTMLElement }

type HTMLUnknownElement

type HTMLUnknownElement struct{ *BasicHTMLElement }

type HTMLVideoElement

type HTMLVideoElement struct{ *HTMLMediaElement }

type HashChangeEvent

type HashChangeEvent struct{ *BasicEvent }

type History

type History interface {
	Length() int
	State() interface{}
	Back()
	Forward()
	Go(offset int)
	PushState(state interface{}, title string, url string)
	ReplaceState(state interface{}, title string, url string)
}

type IDBVersionChangeEvent

type IDBVersionChangeEvent struct{ *BasicEvent }

type ImageData

type ImageData struct {
	*js.Object

	Width  int        `js:"width"`
	Height int        `js:"height"`
	Data   *js.Object `js:"data"`
}

func (*ImageData) At

func (m *ImageData) At(x, y int) color.Color

func (*ImageData) Bounds

func (m *ImageData) Bounds() image.Rectangle

func (*ImageData) ColorModel

func (m *ImageData) ColorModel() color.Model

func (*ImageData) NRGBAAt

func (m *ImageData) NRGBAAt(x, y int) color.NRGBA

func (*ImageData) Set

func (m *ImageData) Set(x, y int, c color.Color)

func (*ImageData) SetNRGBA

func (m *ImageData) SetNRGBA(x, y int, c color.NRGBA)

type KeyboardEvent

type KeyboardEvent struct {
	*BasicEvent
	AltKey        bool   `js:"altKey"`
	CharCode      int    `js:"charCode"`
	CtrlKey       bool   `js:"ctrlKey"`
	Key           string `js:"key"`
	KeyIdentifier string `js:"keyIdentifier"`
	KeyCode       int    `js:"keyCode"`
	Locale        string `js:"locale"`
	Location      int    `js:"location"`
	KeyLocation   int    `js:"keyLocation"`
	MetaKey       bool   `js:"metaKey"`
	Repeat        bool   `js:"repeat"`
	ShiftKey      bool   `js:"shiftKey"`
}

func (*KeyboardEvent) ModifierState

func (ev *KeyboardEvent) ModifierState(mod string) bool

type Location

type Location struct {
	*js.Object
	*URLUtils
}

type MediaStreamEvent

type MediaStreamEvent struct{ *BasicEvent }

type MessageEvent

type MessageEvent struct {
	*BasicEvent
	Data *js.Object `js:"data"`
}

type MouseEvent

type MouseEvent struct {
	*UIEvent
	AltKey    bool `js:"altKey"`
	Button    int  `js:"button"`
	ClientX   int  `js:"clientX"`
	ClientY   int  `js:"clientY"`
	CtrlKey   bool `js:"ctrlKey"`
	MetaKey   bool `js:"metaKey"`
	MovementX int  `js:"movementX"`
	MovementY int  `js:"movementY"`
	ScreenX   int  `js:"screenX"`
	ScreenY   int  `js:"screenY"`
	ShiftKey  bool `js:"shiftKey"`
}

func (*MouseEvent) ModifierState

func (ev *MouseEvent) ModifierState(mod string) bool

func (*MouseEvent) RelatedTarget

func (ev *MouseEvent) RelatedTarget() Element

type MutationEvent

type MutationEvent struct{ *BasicEvent }
type Navigator interface {
	NavigatorID
	NavigatorLanguage
	NavigatorOnLine
	NavigatorGeolocation
	// NavigatorPlugins
	// NetworkInformation
	CookieEnabled() bool
	DoNotTrack() string
	RegisterProtocolHandler(protocol, uri, title string)
}
type NavigatorGeolocation interface {
	Geolocation() Geolocation
}
type NavigatorID interface {
	AppName() string
	AppVersion() string
	Platform() string
	Product() string
	UserAgent() string
}
type NavigatorLanguage interface {
	Language() string
}
type NavigatorOnLine interface {
	Online() bool
}

type Node

type Node interface {
	EventTarget

	Underlying() *js.Object
	BaseURI() string
	ChildNodes() []Node
	FirstChild() Node
	LastChild() Node
	NextSibling() Node
	NodeName() string
	NodeType() int
	NodeValue() string
	SetNodeValue(string)
	OwnerDocument() Document
	ParentNode() Node
	ParentElement() Element
	PreviousSibling() Node
	TextContent() string
	SetTextContent(string)
	AppendChild(Node)
	CloneNode(deep bool) Node
	CompareDocumentPosition(Node) int
	Contains(Node) bool
	HasChildNodes() bool
	InsertBefore(which Node, before Node)
	IsDefaultNamespace(string) bool
	IsEqualNode(Node) bool
	LookupPrefix() string
	LookupNamespaceURI(string) string
	Normalize()
	RemoveChild(Node)
	ReplaceChild(newChild, oldChild Node)
}

func WrapNode

func WrapNode(o *js.Object) Node

type OfflineAudioCompletionEvent

type OfflineAudioCompletionEvent struct{ *BasicEvent }

type PageTransitionEvent

type PageTransitionEvent struct{ *BasicEvent }

type ParentNode

type ParentNode interface {
}

type PointerEvent

type PointerEvent struct{ *MouseEvent }

type PopStateEvent

type PopStateEvent struct{ *BasicEvent }

type Position

type Position struct {
	Coords    *Coordinates
	Timestamp time.Time
}

type PositionError

type PositionError struct {
	*js.Object
	Code int `js:"code"`
}

func (*PositionError) Error

func (err *PositionError) Error() string

type PositionOptions

type PositionOptions struct {
	EnableHighAccuracy bool
	Timeout            time.Duration
	MaximumAge         time.Duration
}

type ProgressEvent

type ProgressEvent struct{ *BasicEvent }

type RTCPeerConnectionIceEvent

type RTCPeerConnectionIceEvent struct{ *BasicEvent }

type RelatedEvent

type RelatedEvent struct{ *BasicEvent }

type SVGDocument

type SVGDocument interface{}

type SVGElement

type SVGElement interface {
	Element
}

type SVGEvent

type SVGEvent struct{ *BasicEvent }

type SVGZoomEvent

type SVGZoomEvent struct{ *BasicEvent }

type Screen

type Screen struct {
	*js.Object
	AvailTop    int `js:"availTop"`
	AvailLeft   int `js:"availLeft"`
	AvailHeight int `js:"availHeight"`
	AvailWidth  int `js:"availWidth"`
	ColorDepth  int `js:"colorDepth"`
	Height      int `js:"height"`
	Left        int `js:"left"`
	PixelDepth  int `js:"pixelDepth"`
	Top         int `js:"top"`
	Width       int `js:"width"`
}

type Selection

type Selection interface {
}

type SensorEvent

type SensorEvent struct{ *BasicEvent }

type StorageEvent

type StorageEvent struct{ *BasicEvent }

type StyleSheet

type StyleSheet interface{}

type Text

type Text struct {
	*BasicNode
}

type TextMetrics

type TextMetrics struct {
	*js.Object

	Width                    float64 `js:"width"`
	ActualBoundingBoxLeft    float64 `js:"actualBoundingBoxLeft"`
	ActualBoundingBoxRight   float64 `js:"actualBoundingBoxRight"`
	FontBoundingBoxAscent    float64 `js:"fontBoundingBoxAscent"`
	FontBoundingBoxDescent   float64 `js:"fontBoundingBoxDescent"`
	ActualBoundingBoxAscent  float64 `js:"actualBoundingBoxAscent"`
	ActualBoundingBoxDescent float64 `js:"actualBoundingBoxDescent"`
	EmHeightAscent           float64 `js:"emHeightAscent"`
	EmHeightDescent          float64 `js:"emHeightDescent"`
	HangingBaseline          float64 `js:"hangingBaseline"`
	AlphabeticBaseline       float64 `js:"alphabeticBaseline"`
	IdeographicBaseline      float64 `js:"ideographicBaseline"`
}

type TextTrack

type TextTrack struct{ *js.Object }

TextTrack represents text track data for <track> elements. It does not currently provide any methods or attributes and it hasn't been decided yet whether they will be added to this package or a separate package.

type TimeEvent

type TimeEvent struct{ *BasicEvent }

type TokenList

type TokenList struct {
	Length int `js:"length"`
	// contains filtered or unexported fields
}

func (*TokenList) Add

func (tl *TokenList) Add(token string)

func (*TokenList) Contains

func (tl *TokenList) Contains(token string) bool

func (*TokenList) Item

func (tl *TokenList) Item(idx int) string

func (*TokenList) Remove

func (tl *TokenList) Remove(token string)

func (*TokenList) Set

func (tl *TokenList) Set(s []string)

Set sets the TokenList's value to the list of tokens in s.

Individual tokens in s shouldn't countain spaces.

func (*TokenList) SetString

func (tl *TokenList) SetString(s string)

SetString sets the TokenList's value to the space-separated list of tokens in s.

func (*TokenList) Slice

func (tl *TokenList) Slice() []string

func (*TokenList) String

func (tl *TokenList) String() string

func (*TokenList) Toggle

func (tl *TokenList) Toggle(token string)

type Touch

type Touch struct {
	*js.Object
	Identifier    int     `js:"identifier"`
	ScreenX       float64 `js:"screenX"`
	ScreenY       float64 `js:"screenY"`
	ClientX       float64 `js:"clientX"`
	ClientY       float64 `js:"clientY"`
	PageX         float64 `js:"pageX"`
	PageY         float64 `js:"pageY"`
	RadiusX       float64 `js:"radiusX"`
	RadiusY       float64 `js:"radiusY"`
	RotationAngle float64 `js:"rotationAngle"`
	Force         float64 `js:"force"`
}

Touch represents a single contact point on a touch-sensitive device. The contact point is commonly a finger or stylus and the device may be a touchscreen or trackpad.

Reference: https://developer.mozilla.org/en-US/docs/Web/API/Touch.

func (*Touch) Target

func (t *Touch) Target() Element

Target returns the Element on which the touch point started when it was first placed on the surface, even if the touch point has since moved outside the interactive area of that element or even been removed from the document.

Reference: https://developer.mozilla.org/en-US/docs/Web/API/Touch/target.

type TouchEvent

type TouchEvent struct {
	*BasicEvent
	AltKey   bool `js:"altKey"`
	CtrlKey  bool `js:"ctrlKey"`
	MetaKey  bool `js:"metaKey"`
	ShiftKey bool `js:"shiftKey"`
}

TouchEvent represents an event sent when the state of contacts with a touch-sensitive surface changes. This surface can be a touch screen or trackpad, for example. The event can describe one or more points of contact with the screen and includes support for detecting movement, addition and removal of contact points, and so forth.

Reference: https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent.

func (*TouchEvent) ChangedTouches

func (ev *TouchEvent) ChangedTouches() []*Touch

ChangedTouches lists all individual points of contact whose states changed between the previous touch event and this one.

Reference: https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/changedTouches.

func (*TouchEvent) TargetTouches

func (ev *TouchEvent) TargetTouches() []*Touch

TargetTouches lists all points of contact that are both currently in contact with the touch surface and were also started on the same element that is the target of the event.

Reference: https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/targetTouches.

func (*TouchEvent) Touches

func (ev *TouchEvent) Touches() []*Touch

Touches lists all current points of contact with the surface, regardless of target or changed status.

Reference: https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/touches.

type TrackEvent

type TrackEvent struct{ *BasicEvent }

type TransitionEvent

type TransitionEvent struct{ *BasicEvent }

type UIEvent

type UIEvent struct{ *BasicEvent }

type URLUtils

type URLUtils struct {
	*js.Object

	Href     string `js:"href"`
	Protocol string `js:"protocol"`
	Host     string `js:"host"`
	Hostname string `js:"hostname"`
	Port     string `js:"port"`
	Pathname string `js:"pathname"`
	Search   string `js:"search"`
	Hash     string `js:"hash"`
	Username string `js:"username"`
	Password string `js:"password"`
	Origin   string `js:"origin"`
}

type UserProximityEvent

type UserProximityEvent struct{ *BasicEvent }

type ValidityState

type ValidityState struct {
	*js.Object
	CustomError     bool `js:"customError"`
	PatternMismatch bool `js:"patternMismatch"`
	RangeOverflow   bool `js:"rangeOverflow"`
	RangeUnderflow  bool `js:"rangeUnderflow"`
	StepMismatch    bool `js:"stepMismatch"`
	TooLong         bool `js:"tooLong"`
	TypeMismatch    bool `js:"typeMismatch"`
	Valid           bool `js:"valid"`
	ValueMissing    bool `js:"valueMissing"`
}

type WheelEvent

type WheelEvent struct {
	*MouseEvent
	DeltaX    float64 `js:"deltaX"`
	DeltaY    float64 `js:"deltaY"`
	DeltaZ    float64 `js:"deltaZ"`
	DeltaMode int     `js:"deltaMode"`
}

type Window

type Window interface {
	EventTarget

	Console() *Console
	Document() Document
	FrameElement() Element
	Location() *Location
	Name() string
	SetName(string)
	InnerHeight() int
	InnerWidth() int
	Length() int
	Opener() Window
	OuterHeight() int
	OuterWidth() int
	ScrollX() int
	ScrollY() int
	Parent() Window
	ScreenX() int
	ScreenY() int
	ScrollMaxX() int
	ScrollMaxY() int
	Top() Window
	History() History
	Navigator() Navigator
	Screen() *Screen
	Alert(string)
	Back()
	Blur()
	CancelAnimationFrame(int)
	ClearInterval(int)
	ClearTimeout(int)
	Close()
	Confirm(string) bool
	Focus()
	Forward()
	GetComputedStyle(el Element, pseudoElt string) *CSSStyleDeclaration
	GetSelection() Selection
	Home()
	MoveBy(dx, dy int)
	MoveTo(x, y int)
	Open(url, name, features string) Window
	OpenDialog(url, name, features string, args []interface{}) Window
	PostMessage(message string, target string, transfer []interface{})
	Print()
	Prompt(prompt string, initial string) string
	RequestAnimationFrame(callback func(time.Duration)) int
	ResizeBy(dw, dh int)
	ResizeTo(w, h int)
	Scroll(x, y int)
	ScrollBy(dx, dy int)
	ScrollByLines(int)
	ScrollTo(x, y int)
	SetCursor(name string)
	SetInterval(fn func(), delay int) int
	SetTimeout(fn func(), delay int) int
	Stop()
}

func GetWindow

func GetWindow() Window

Jump to

Keyboard shortcuts

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