Documentation
¶
Overview ¶
Package dom is a thin wrapper of some useful dom functions for gopherjs.
Index ¶
Constants ¶
View Source
const ( // Wheel Delta DeltaPixel = 0 DeltaLine = 1 DeltaPage = 2 // Event Phase EvPhaseNone = 0 EvPhaseCapturing = 1 EvPhaseAtTarget = 2 EvPhaseBubbling = 3 )
View Source
const ( // Window Event Attributes // Window Events triggered for a window object and apply in <body> tag // Attributes Value Description In HTML5? EvtAfterprint = "afterprint" // Script is run after the document is printed NEW EvtBeforeprint = "beforeprint" // Script is run before the document is printed NEW EvtBeforeunload = "beforeunload" // Script is run before the document is unloaded NEW EvtError = "error" // Script is run when any error occur NEW EvtHaschange = "haschange" // Script is run when document has changed NEW EvtLoad = "load" // Event fires after the page loading finished EvtDOMContentLoaded = "DOMContentLoaded" // Event fires after the page DOM is ready EvtMessage = "message" // Script is run when document goes in offline NEW EvtOffline = "offline" // Script is run when document comes in Event = "line NEW EvtPagehide = "pagehide" // Script is run when document window is hidden NEW EvtPageshow = "pageshow" // Script is run when document window become visible NEW EvtPopstate = "popstate" // Script is run when document window history changes NEW EvtRedo = "redo" // Script is run when document perform redo NEW EvtResize = "resize" // Event fires when browser window is resized NEW EvtStorage = "storage" // Script is run when web storage area is updated NEW EvtUndo = "undo" // Script is run when document performs undo NEW EvtUnload = "unload" // Event fires when browser window has been closed // Form Events // Form Events triggered by perform some action inside HTML form elements. // Attributes Value Description In HTML5? EvtBlur = "blur" // Event fire when element loses focus EvtChange = "change" // Event fire when element value is changed EvtFocus = "focus" // Event fire when element gets focus EvtFormchange = "formchange" // Event fire when form changes NEW EvtForminput = "forminput" // Event fire when form get input field EvtInput = "input" // Event fire when element get input field NEW EvtInvalid = "invalid" // Event fire when element is invalid NEW EvtReset = "reset" // Event fire when clicked on form reset button REMOVE EvtSelect = "select" // Event fire after allow to select text in an element EvtSubmit = "Submit" // Event fire when form is submitted // Keyboard Events // Attributes Value Description In HTML5? EvtKeydown = "keydown" // Event fire when pressing a key EvtKeypress = "keypress" // Event fire when press a key EvtKeyup = "keyup" // Event fire when releases a key // Mouse Events // Mouse Events triggered by mouse action. // Attributes Value Description In HTML5? EvtClick = "click" // Event fire when mouse click on element EvtDblclick = "dblclick" // Event fire when mouse double click on element EvtDrag = "drag" // Script is run when element is dragged NEW EvtDragend = "dragend" // Script is run at end of drag operation NEW EvtDragenter = "dragenter" // Script is run when element has dragged to a valid drop target NEW EvtDragleave = "dragleave" // Script is run when element leaves valid drop target NEW EvtDragover = "dragover" // Script is run when element is dragged over on valid drop target NEW EvtDragstart = "dragstart" // Script is run at start of drag operation NEW EvtDrop = "drop" // Script is run when dragged element is dropped NEW EvtMousedown = "mousedown" // Event fire when mouse button is pressed down on element EvtMousemove = "mousemove" // Event fire when mouse pointer moves over an element EvtMouseout = "mouseout" // Event fire when mouse pointer moves out an element EvtMouseover = "mouseover" // Event fire when mouse pointer moves over on element EvtMouseup = "mouseup" // Event fire when mouse button is released over an element EvtMousewheel = "mousewheel" // Event fire when mouse wheel being rotated NEW EvtScroll = "scroll" // Event fire when element scrollbar being scrolled NEW // Media Events // Media Events triggered by common media elements like <img>, <audio>, <embed>, <object>, and <video>. // Attributes Value Description In HTML5? EvtAbort = "abort" // Script is run when element is abort EvtCanplay = "canplay" // Script is run when file is ready for start playing NEW EvtCanplaythrough = "canplaythrough" // Script is run when file is played all way without pausing for buffering NEW EvtDurationchange = "durationchange" // Script is run when media length changes NEW EvtEmptied = "emptied" // Script is run when something unavailable/disconnects NEW EvtEnded = "ended" // Script is run when media has reach to end position NEW EvtLoadeddata = "loadeddata" // Script is run when media is loaded NEW EvtLoadedmetadata = "loadedmetadata" // Script is run when meta data are loaded NEW EvtLoadstart = "loadstart" // Script is run when file being loaded NEW EvtPause = "pause" // Script is run when media is paused NEW EvtPlay = "play" // Script is run when media is ready to start playing NEW EvtPlaying = "playing" // Script is run when media is actually start for playing NEW EvtProgress = "progress" // Script is run when browser is process of getting media data NEW EvtRatechange = "ratechange" // Script is run when playback rate changes NEW EvtReadystatechange = "readystatechange" // Script is run when ready state changes for each time NEW EvtSeeked = "seeked" // Script is run when seeking attribute value set to false, that indicate seeking has ended NEW EvtSeeking = "seeking" // Script is run when seeking attribute value set to true, that indicate seeking has active NEW EvtStalled = "stalled" // Script is run when browser is unable to fetch media data for any reason NEW EvtSuspend = "suspend" // Script is run when fetching media data is stopped before it is completely loaded for any reason NEW EvtTimeupdate = "timeupdate" // Script is run when playing position has changed NEW EvtVolumechange = "volumechange" // Script is run each time volume is changed NEW EvtWaiting = "waiting" // Script is run when media has paused(for buffer more data) NEW )
Events Types
View Source
const ( ELEMENT_NODE NodeType = 1 ATTRIBUTE_NODE = 2 TEXT_NODE = 3 CDATA_SECTION_NODE = 4 ENTITY_REFERENCE_NODE = 5 ENTITY_NODE = 6 PROCESSING_INSTRUCTION_NODE = 7 COMMENT_NODE = 8 DOCUMENT_NODE = 9 DOCUMENT_TYPE_NODE = 10 DOCUMENT_FRAGMENT_NODE = 11 NOTATION_NODE = 12 )
Variables ¶
This section is empty.
Functions ¶
func OnDOMContentLoaded ¶
func OnDOMContentLoaded(callback func())
The event "DOMContentLoaded" will be fired when the document has been parsed completely, that is without stylesheets* and additional images. If you need to wait for images and stylesheets, use "load" instead.
Types ¶
type CSSStyleDeclaration ¶
type CSSStyleDeclaration struct {
*js.Object
// Textual representation of the declaration block. Setting this attribute changes the style.
CssText string `js:"cssText"`
// The number of properties. See the item method below.
Length int `js:"length"`
// The containing CssRule.
ParentRule *CSSStyleDeclaration `js:"parentRule"`
// funcs
RemoveProperty func(name string) `js:"removeProperty"`
GetPropertyValue func(name string) string `js:"getPropertyValue"`
GetPropertyPriority func(name string) string `js:"getPropertyPriority"`
SetProperty func(name, value string, priority ...string) `js:"setProperty"`
}
func GetComputedStyle ¶
func GetComputedStyle(e *Element) *CSSStyleDeclaration
func (*CSSStyleDeclaration) ToMap ¶
func (css *CSSStyleDeclaration) ToMap() map[string]string
type Doc ¶
type Doc struct {
*Node
CharacterSet string `js:"characterSet"`
Async bool `js:"async"` // 规定 XML 文件的下载是否应当被同步处理。 5 1.5 9 No
Doctype *js.Object `js:"doctype"` // 返回与文档相关的文档类型声明 (DTD)。 6 1 9 Yes
DocumentElement *Element `js:"documentElement"` // 返回文档的根节点 5 1 9 Yes
DocumentURI string `js:"documentURI"` // 设置或返回文档的位置 No 1 9 Yes
// DomConfig string `js:"domConfig"` // 返回normalizeDocument()被调用时所使用的配置 No Yes
Implementation *js.Object `js:"implementation"` // 返回处理该文档的 DOMImplementation 对象。 No 1 9 Yes
// methods
AdoptNode func(*Node) *Node `js:"adoptNode"` // (sourcenode) 从另一个文档向本文档选定一个节点,然后返回被选节点。 No Yes
// CreateAttribute func() `js:"createAttribute"` // (name) 创建拥有指定名称的属性节点,并返回新的 Attr 对象。 6 1 9 Yes
// CreateAttributeNS func() `js:"createAttributeNS"` // (uri,name) 创建拥有指定名称和命名空间的属性节点,并返回新的 Attr 对象。 9 Yes
// CreateCDATASection func() `js:"createCDATASection"` // () 创建 CDATA 区段节点。 5 1 9 Yes
CreateComment func(string) *Node `js:"createComment"` // () 创建注释节点。 6 1 9 Yes
// CreateDocumentFragment func() `js:"createDocumentFragment"` // () 创建空的 DocumentFragment 对象,并返回此对象。 5 1 9 Yes
CreateElement func(tagName string) *Element `js:"createElement"` // () 创建元素节点。 5 1 9 Yes
CreateElementNS func(namespace, name string) *Element `js:"createElementNS"` // () 创建带有指定命名空间的元素节点。 No 1 9 Yes
CreateEvent func(etype string) *Event `js:"createEvent"` // () 创建新的 Event 对象。 Yes
// CreateEntityReference func() `js:"createEntityReference"` // (name) 创建 EntityReference 对象,并返回此对象。 5 No Yes
// CreateExpression func() `js:"createExpression"` // () 创建一个XPath表达式以供稍后计算。 Yes
// CreateProcessingInstruction func() `js:"createProcessingInstruction"` // () 创建 ProcessingInstruction 对象,并返回此对象。 5 9 Yes
// CreateRange func() `js:"createRange"` // () 创建 Range 对象,并返回此对象。 No Yes
// Evaluate func() `js:"evaluate"` // () 计算一个 XPath 表达式。 No 1 9 Yes
CreateTextNode func(text string) *Node `js:"createTextNode"` // () 创建文本节点。 5 1 9 Yes
GetElementById func(id string) *Element `js:"getElementById"` // () 查找具有指定的唯一 ID 的元素。 5 1 9 Yes
GetElementsByTagName func(tag string) *HTMLCollection `js:"getElementsByTagName"` // () 返回所有具有指定名称的元素节点。 5 1 9 Yes
GetElementsByTagNameNS func(ns, tag string) *HTMLCollection `js:"getElementsByTagNameNS"` // () 返回所有具有指定名称和命名空间的元素节点。 No 1 9 Yes
ImportNode func(node *Node, deep bool) *Node `js:"importNode"` // () 把一个节点从另一个文档复制到该文档以便应用。 9 Yes
// LoadXML func() `js:"loadXML"` // () 通过解析XML标签字符串来组成文档。
// NormalizeDocument func() `js:"normalizeDocument"` // () No Yes
// RenameNode func() `js:"renameNode"` // () 重命名元素或者属性节点。 No Yes
QuerySelector func(sel string) *Element `js:"querySelector"`
QuerySelectorAll func(sel string) *HTMLCollection `js:"querySelectorAll"`
}
func WrapDocument ¶
type Element ¶
type Element struct {
*Node
// basic attr
Id string `js:"id"`
InnerHTML string `js:"innerHTML"`
InnerText string `js:"innerText"`
TagName string `js:"tagName"`
ContentEditable bool `js:"contentEditable"`
// width & height, not all element supoort these attributes,
// use Style to set width/height
Width int `js:"width"`
Height int `js:"height"`
// window size, for window object
InnerWidth int `js:"innerWidth"`
InnerHeight int `js:"innerHeight"`
// dom
PreviousElementSibling *Element `js:"previousElementSibling"`
NextElementSibling *Element `js:"nextElementSibling"`
FirstElementChild *Element `js:"firstElementChild"`
LastElementChild *Element `js:"lastElementChild"`
// img, script
Src string `js:"src"`
// style
Style *CSSStyleDeclaration `js:"style"`
ClassName string `js:"className"`
ClassList []string `js:"classList"`
// funcs
SetAttribute func(attr string, val interface{}) `js:"setAttribute"`
GetAttribute func(attr string) *js.Object `js:"getAttribute"`
RemoveAttribute func(attr string) `js:"removeAttribute"`
AppendChild func(child *Element) `js:"appendChild"`
RemoveChild func(child *Element) `js:"removeChild"`
Remove func() `js:"remove"`
QuerySelector func(sel string) *Element `js:"querySelector"`
QuerySelectorAll func(sel string) *HTMLCollection `js:"querySelectorAll"`
Click func() `js:"click"`
}
func WrapElement ¶
type Event ¶
type Event struct {
*js.Object
Type string `js:"type"`
// close event
Code int `js:"code"`
Reason string `js:"reason"`
WasClean bool `js:"wasClean"`
// wheel event
DeltaX float64 `js:"deltaX"`
DeltaY float64 `js:"deltaY"`
DeltaZ float64 `js:"deltaZ"`
DeltaMode int `js:"deltaMode"`
// keyboard event
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"`
// mouse event
Button int `js:"button"`
// mouse position
ClientX int `js:"clientX"`
ClientY int `js:"clientY"`
MovementX int `js:"movementX"`
MovementY int `js:"movementY"`
ScreenX int `js:"screenX"`
ScreenY int `js:"screenY"`
// UIEvent.layerX Read only
LayerX int `js:"layerX"`
// Returns the horizontal coordinate of the event relative to the current layer(element).
// UIEvent.layerY Read only
LayerY int `js:"layerY"`
// Returns the vertical coordinate of the event relative to the current layer.
// message event
Data *js.Object `js:"data"`
// A boolean indicating whether the event bubbles up through the DOM or not.
Bubbles bool `js:"bubbles"`
// A boolean indicating whether the event is cancelable.
Cancelable bool `js:"cancelable"`
// A reference to the currently registered target for the event.
CurrentTarget *Element `js:"currentTarget"`
DefaultPrevented bool `js:"defaultPrevented"`
// Indicates which phase of the event flow is being processed.
EventPhase int `js:"eventPhase"`
// A reference to the target to which the event was originally dispatched.
Target *Element `js:"target"`
// The time that the event was created. timestamp in ms
Timestamp int `js:"timeStamp"`
PreventDefault func() `js:"preventDefault"`
StopImmediatePropagation func() `js:"stopImmediatePropagation"`
StopPropagation func() `js:"stopPropagation"`
// The KeyboardEvent.getModifierState() method returns the current state of the specified modifier key,
// true if the modifier is active (that is the modifier key is pressed or locked), otherwise, false.
//
// keyArg
// A modifier key value. The value must be one of the KeyboardEvent.key values which represent modifier keys or "Accel". This is case-sensitive.
GetModifierState func(keyArg string) bool `js:"getModifierState"`
}
Type Event implements the Event interface and is embedded by concrete event types.
type EventTarget ¶
type EventTarget struct {
*js.Object
// Registers an event handler to a specific event type on the element.
// If true, useCapture indicates that the user wishes to initiate capture.
// After initiating capture, all events of the specified type will be dispatched to the registered listener before being dispatched to any EventTarget beneath it in the DOM tree.
// Events which are bubbling upward through the tree will not trigger a listener designated to use capture.
AddEventListener func(eventType string, listener func(*Event), useCapture ...bool) `js:"addEventListener"`
RemoveEventListener func(eventType string, listener func(*Event), useCapture ...bool) `js:"removeEventListener"`
DispatchEvent func(*Event) `js:"dispatchEvent"`
}
func WrapEventTarget ¶
func WrapEventTarget(t *js.Object) *EventTarget
type FormData ¶
func NewFormData ¶
func NewFormData() *FormData
type HTMLCollection ¶
type HTMLCollection struct {
*js.Object
// length Read only
// Returns the number of items in the collection.
Length int `js:"length"`
// HTMLCollection.item(index number)
// Returns the specific node at the given zero-based index into the list. Returns null if the index is out of range.
Item func(index int) *Element `js:"item"`
}
type Node ¶
type Node struct {
*EventTarget
// attrs
BaseURI string `js:"baseURI"` // 返回节点的绝对基准 URI。 No 1 No Yes
ChildNodes *NodeList `js:"childNodes"` // 返回节点到子节点的节点列表。 5 1 9 Yes
FirstChild *Node `js:"firstChild"` // 返回节点的首个子节点。 5 1 9 Yes
LastChild *Node `js:"lastChild"` // 返回节点的最后一个子节点。 5 1 9 Yes
LocalName string `js:"localName"` // 返回节点的本地名称。 No 1 9 Yes
NamespaceURI string `js:"namespaceURI"` // 返回节点的命名空间 URI。 No 1 9 Yes
NextSibling *Node `js:"nextSibling"` // 返回节点之后紧跟的同级节点。 5 1 9 Yes
NodeName string `js:"nodeName"` // 返回节点的名称,根据其类型。 5 1 9 Yes
NodeType NodeType `js:"nodeType"` // 返回节点的类型。 5 1 9 Yes
NodeValue string `js:"nodeValue"` // 设置或返回节点的值,根据其类型。 5 1 9 Yes
OwnerDocument *Doc `js:"ownerDocument"` // 返回节点的根元素(document 对象)。 5 1 9 Yes
ParentNode *Node `js:"parentNode"` // 返回节点的父节点。 5 1 9 Yes
Prefix string `js:"prefix"` // 设置或返回节点的命名空间前缀。 No 1 9 Yes
PreviousSibling *Node `js:"previousSibling"` // 返回节点之前紧跟的同级节点。 5 1 9 Yes
TextContent string `js:"textContent"` // 设置或返回节点及其后代的文本内容。 No 1 No Yes
// methods
AppendChild func(*Node) `js:"appendChild"` // 向节点的子节点列表的结尾添加新的子节点。 5 1 9 Yes
CloneNode func() *Node `js:"cloneNode"` // 复制节点。 5 1 9 Yes
CompareDocumentPosition func(*Node) int `js:"compareDocumentPosition"` // 对比两个节点的文档位置。 No 1 No Yes
// GetFeature func() `js:"getFeature"` //eature,version) 返回一个 DOM 对象,此对象可执行带有指定特性和版本的专门的 API。 No Yes
// GetUserData func() `js:"getUserData"` //ey) 返回与此节点上的某个键相关联的对象。此对象必须首先通过使用相同的键来调用 setUserData 被设置到此节点。 No Yes
// HasAttributes func() `js:"hasAttributes"` // 判断当前节点是否拥有属性。 No 1 9 Yes
HasChildNodes func() bool `js:"hasChildNodes"` // 判断当前节点是否拥有子节点。 5 1 9 Yes
InsertBefore func(which *Node, before *Node) `js:"insertBefore"` // 在指定的子节点前插入新的子节点。 5 1 9 Yes
IsDefaultNamespace func(string) bool `js:"isDefaultNamespace"` //RI) 返回指定的命名空间 URI 是否为默认。 No Yes
IsEqualNode func(*Node) bool `js:"isEqualNode"` // 检查两个节点是否相等。 No No No Yes
IsSameNode func(*Node) bool `js:"isSameNode"` // 检查两个节点是否是相同的节点。 No 1 No Yes
// IsSupported func() `js:"isSupported"` // 返回当前节点是否支持某个特性。 9 Yes
LookupNamespaceURI func(string) string `js:"lookupNamespaceURI"` // 返回匹配指定前缀的命名空间 URI。 No 1 No Yes
LookupPrefix func() string `js:"lookupPrefix"` // 返回匹配指定命名空间 URI 的前缀。 No 1 No Yes
Normalize func() `js:"normalize"` // 合并相邻的Text节点并删除空的Text节点。 5 1 9 Yes
RemoveChild func(*Node) `js:"removeChild"` // 删除(并返回)当前节点的指定子节点。 5 1 9 Yes
ReplaceChild func(newChild, oldChild *Node) `js:"replaceChild"` // 用新节点替换一个子节点。 5 1 9 Yes
}
type Win ¶
type Win struct {
*EventTarget
ApplicationCache *js.Object `js:"applicationCache "` // Window.applicationCache Read only An OfflineResourceList object providing access to the offline resources for the window.
Closed bool `js:"closed "` // Window.closed Read only This property indicates whether the current window is closed or not.
Components *js.Object `js:"Components "` // Window.Components The entry point to many XPCOM features. Some properties, e.g. classes, are only available to sufficiently privileged code. Web code should not use this property.
Console *js.Object `js:"console "` // Window.console Read only Returns a reference to the console object which provides access to the browser's debugging console.
Content *Element `js:"content "` // Window.content and Window._content Read only Returns a reference to the content element in the current window. The obsolete variant with underscore is no longer available from Web content.
Controllers *js.Object `js:"controllers "` // Window.controllers Read only Returns the XUL controller objects for the current chrome window.
Crypto *js.Object `js:"crypto "` // Window.crypto Read only Returns the browser crypto object.
// DefaultStatus string `js:"defaultStatus "` // Window.defaultStatus Obsolete since Gecko 23 Gets/sets the status bar text for the given window.
DevicePixelRatio float64 `js:"devicePixelRatio "` // Window.devicePixelRatio Read only Returns the ratio between physical pixels and device independent pixels in the current display.
DialogArguments int `js:"dialogArguments "` // Window.dialogArguments Read only Gets the arguments passed to the window (if it's a dialog box) at the time window.showModalDialog() was called. This is an nsIArray.
Directories *js.Object `js:"directories "` // Window.directories Synonym of window.personalbar
Document *Doc `js:"document "` // Window.document Read only Returns a reference to the document that the window contains.
FrameElement *Element `js:"frameElement "` // Window.frameElement Read only Returns the element in which the window is embedded, or null if the window is not embedded.
Frames []*js.Object `js:"frames "` // Window.frames Read only Returns an array of the subframes in the current window.
FullScreen bool `js:"fullScreen "` // Window.fullScreen This property indicates whether the window is displayed in full screen or not.
GlobalStorage *js.Object `js:"globalStorage "` // Window.globalStorage Obsolete since Gecko 13 Unsupported since Gecko 13 (Firefox 13). Use Window.localStorage instead. Was: Multiple storage objects that are used for storing data across multiple pages.
History *js.Object `js:"history "` // Window.history Read only Returns a reference to the history object.
InnerHeight int `js:"innerHeight "` // Window.innerHeight Gets the height of the content area of the browser window including, if rendered, the horizontal scrollbar.
InnerWidth int `js:"innerWidth "` // Window.innerWidth Gets the width of the content area of the browser window including, if rendered, the vertical scrollbar.
IsSecureContext bool `js:"isSecureContext "` // Window.isSecureContext Read only Indicates whether a context is capable of using features that require secure contexts.
Length int `js:"length "` // Window.length Read only Returns the number of frames in the window. See also window.frames.
Location *js.Object `js:"location "` // Window.location Read only Gets/sets the location, or current URL, of the window object.
Locationbar *js.Object `js:"locationbar "` // Window.locationbar Read only Returns the locationbar object, whose visibility can be toggled in the window.
LocalStorage *js.Object `js:"localStorage "` // Window.localStorage Read only Returns a reference to the local storage object used to store data that may only be accessed by the origin that created it.
Menubar *js.Object `js:"menubar "` // Window.menubar Read only Returns the menubar object, whose visibility can be toggled in the window.
MessageManager *js.Object `js:"messageManager "` // Window.messageManager Returns the message manager object for this window.
// MozAnimationStartTime string `js:"mozAnimationStartTime "` // Window.mozAnimationStartTime Read only The time in milliseconds since epoch at which the current animation cycle began.
// MozInnerScreenX string `js:"mozInnerScreenX "` // Window.mozInnerScreenX Read only Returns the horizontal (X) coordinate of the top-left corner of the window's viewport, in screen coordinates. This value is reported in CSS pixels. See mozScreenPixelsPerCSSPixel in nsIDOMWindowUtils for a conversion factor to adapt to screen pixels if needed.
// MozInnerScreenY string `js:"mozInnerScreenY "` // Window.mozInnerScreenY Read only Returns the vertical (Y) coordinate of the top-left corner of the window's viewport, in screen coordinates. This value is reported in CSS pixels. See mozScreenPixelsPerCSSPixel for a conversion factor to adapt to screen pixels if needed.
// MozPaintCount string `js:"mozPaintCount "` // Window.mozPaintCount Read only Returns the number of times the current document has been rendered to the screen in this window. This can be used to compute rendering performance.
Name string `js:"name "` // Window.name Gets/sets the name of the window.
Opener *Win `js:"opener "` // Window.opener Returns a reference to the window that opened this current window.
Orientation float64 `js:"orientation "` // Window.orientation Read only Returns the orientation in degrees (in 90 degree increments) of the viewport relative to the device's natural orientation.
OuterHeight int `js:"outerHeight "` // Window.outerHeight Read only Gets the height of the outside of the browser window.
OuterWidth int `js:"outerWidth "` // Window.outerWidth Read only Gets the width of the outside of the browser window.
PageXOffset int `js:"pageXOffset "` // Window.pageXOffset Read only An alias for window.scrollX.
PageYOffsetRead int `js:"pageYOffsetRead "` // Window.pageYOffsetRead only An alias for window.scrollY
SessionStorage *js.Object `js:"sessionStorage "` // Window.sessionStorage Read only Returns a reference to the session storage object used to store data that may only be accessed by the origin that created it.
Parent *Win `js:"parent "` // Window.parent Read only Returns a reference to the parent of the current window or subframe.
Performance *js.Object `js:"performance "` // Window.performance Read only Provides a hosting area for performance related attributes.
Personalbar *js.Object `js:"personalbar "` // Window.personalbar Read only Returns the personalbar object, whose visibility can be toggled in the window.
// Pkcs11 string `js:"pkcs11 "` // Window.pkcs11 Obsolete since Gecko 29 Formerly provided access to install and remove PKCS11 modules.
ReturnValue *js.Object `js:"returnValue "` // Window.returnValue The return value to be returned to the function that called window.showModalDialog() to display the window as a modal dialog.
Screen *js.Object `js:"screen "` // Window.screen Read only Returns a reference to the screen object associated with the window.
ScreenX int `js:"screenX "` // Window.screenX Read only Returns the horizontal distance of the left border of the user's browser from the left side of the screen.
ScreenY int `js:"screenY "` // Window.screenY Read only Returns the vertical distance of the top border of the user's browser from the top side of the screen.
Scrollbars *js.Object `js:"scrollbars "` // Window.scrollbars Read only Returns the scrollbars object, whose visibility can be toggled in the window.
ScrollMaxX int `js:"scrollMaxX "` // Window.scrollMaxX Read only The maximum offset that the window can be scrolled to horizontally, that is the document width minus the viewport width.
ScrollMaxY int `js:"scrollMaxY "` // Window.scrollMaxY Read only The maximum offset that the window can be scrolled to vertically (i.e., the document height minus the viewport height).
ScrollX int `js:"scrollX "` // Window.scrollX Read only Returns the number of pixels that the document has already been scrolled horizontally.
ScrollY int `js:"scrollY "` // Window.scrollY Read only Returns the number of pixels that the document has already been scrolled vertically.
Self *js.Object `js:"self "` // Window.self Read only Returns an object reference to the window object itself.
Sidebar *js.Object `js:"sidebar "` // Window.sidebar Read only Returns a reference to the window object of the sidebar.
SpeechSynthesis *js.Object `js:"speechSynthesis "` // Window.speechSynthesis Read only Returns a SpeechSynthesis object, which is the entry point into using Web Speech API speech synthesis functionality.
Status *js.Object `js:"status "` // Window.status Gets/sets the text in the statusbar at the bottom of the browser.
Statusbar *js.Object `js:"statusbar "` // Window.statusbar Read only Returns the statusbar object, whose visibility can be toggled in the window.
Toolbar *js.Object `js:"toolbar "` // Window.toolbar Read only Returns the toolbar object, whose visibility can be toggled in the window.
Top *Win `js:"top "` // Window.top Read only Returns a reference to the topmost window in the window hierarchy. This property is read only.
Window *Win `js:"window "` // Window.window Read only Returns a reference to the current window.
Alert func(msg string) `js:"alert"` // Window.alert() Displays an alert dialog.
Back func() `js:"back"` // Window.back() Moves back one in the window history.
Blur func() `js:"blur"` // Window.blur() Sets focus away from the window.
CancelIdleCallback func() `js:"cancelIdleCallback"` // Window.cancelIdleCallback() Enables you to cancel a callback previously scheduled with Window.requestIdleCallback.
CaptureEvents func() `js:"captureEvents"` // Window.captureEvents() Registers the window to capture all events of the specified type.
ClearImmediate func() `js:"clearImmediate"` // Window.clearImmediate() Cancels the repeated execution set using setImmediate.
Close func() `js:"close"` // Window.close() Closes the current window.
Confirm func(msg string) `js:"confirm"` // Window.confirm() Displays a dialog with a message that the user needs to respond to.
// DisableExternalCapture func() `js:"disableExternalCapture"` // Window.disableExternalCapture() Obsolete since Gecko 24 FIXME: NeedsContents
DispatchEvent func() `js:"dispatchEvent"` // Window.dispatchEvent() Used to trigger an event.
Dump func() `js:"dump"` // Window.dump() Writes a message to the console.
EnableExternalCapture func() `js:"enableExternalCapture"` // Window.enableExternalCapture() Obsolete since Gecko 24 FIXME: NeedsContents
Find func() `js:"find"` // Window.find() Searches for a given string in a window.
Focus func() `js:"focus"` // Window.focus() Sets focus on the current window.
Forward func() `js:"forward"` // Window.forward() Moves the window one document forward in the history.
GetAttention func() `js:"getAttention"` // Window.getAttention() Flashes the application icon.
GetAttentionWithCycleCount func() `js:"getAttentionWithCycleCount"` // Window.getAttentionWithCycleCount() FIXME: NeedsContents
GetComputedStyle func() `js:"getComputedStyle"` // Window.getComputedStyle() Gets computed style for the specified element. Computed style indicates the computed values of all CSS properties of the element.
GetDefaultComputedStyle func() `js:"getDefaultComputedStyle"` // Window.getDefaultComputedStyle() Gets default computed style for the specified element, ignoring author stylesheets.
GetSelection func() `js:"getSelection"` // Window.getSelection() Returns the selection object representing the selected item(s).
Home func() `js:"home"` // Window.home() Returns the browser to the home page.
MatchMedia func() `js:"matchMedia"` // Window.matchMedia() Returns a MediaQueryList object representing the specified media query string.
Maximize func() `js:"maximize"` // Window.maximize() FIXME: NeedsContents
Minimize func() `js:"minimize"` // Window.minimize() (top-level XUL windows only) Minimizes the window.
MoveBy func() `js:"moveBy"` // Window.moveBy() Moves the current window by a specified amount.
MoveTo func() `js:"moveTo"` // Window.moveTo() Moves the window to the specified coordinates.
MozRequestAnimationFrame func() `js:"mozRequestAnimationFrame"` // Window.mozRequestAnimationFrame() Tells the browser that an animation is in progress, requesting that the browser schedule a repaint of the window for the next animation frame. This will cause a MozBeforePaint event to fire before that repaint occurs.
Open func(url string) *js.Object `js:"open"` // Window.open() Opens a new window.
OpenDialog func() `js:"openDialog"` // Window.openDialog() Opens a new dialog window.
PostMessage func() `js:"postMessage"` // Window.postMessage() Provides a secure means for one window to send a string of data to another window, which need not be within the same domain as the first.
Print func() `js:"print"` // Window.print() Opens the Print Dialog to print the current document.
Prompt func() `js:"prompt"` // Window.prompt() Returns the text entered by the user in a prompt dialog.
ReleaseEvents func() `js:"releaseEvents"` // Window.releaseEvents() Releases the window from trapping events of a specific type.
RequestIdleCallback func() `js:"requestIdleCallback"` // Window.requestIdleCallback() Enables the scheduling of tasks during a browser's idle periods.
ResizeBy func() `js:"resizeBy"` // Window.resizeBy() Resizes the current window by a certain amount.
ResizeTo func() `js:"resizeTo"` // Window.resizeTo() Dynamically resizes window.
Restore func() `js:"restore"` // Window.restore() FIXME: NeedsContents
RouteEvent func() `js:"routeEvent"` // Window.routeEvent() Obsolete since Gecko 24 FIXME: NeedsContents
Scroll func() `js:"scroll"` // Window.scroll() Scrolls the window to a particular place in the document.
ScrollBy func() `js:"scrollBy"` // Window.scrollBy() Scrolls the document in the window by the given amount.
ScrollByLines func() `js:"scrollByLines"` // Window.scrollByLines() Scrolls the document by the given number of lines.
ScrollByPages func() `js:"scrollByPages"` // Window.scrollByPages() Scrolls the current document by the specified number of pages.
ScrollTo func() `js:"scrollTo"` // Window.scrollTo() Scrolls to a particular set of coordinates in the document.
SetCursor func() `js:"setCursor"` // Window.setCursor() Changes the cursor for the current window
SetImmediate func() `js:"setImmediate"` // Window.setImmediate() Executes a function after the browser has finished other heavy tasks
SetResizable func() `js:"setResizable"` // Window.setResizable() Toggles a user's ability to resize a window.
ShowModalDialog func() `js:"showModalDialog"` // Window.showModalDialog() Displays a modal dialog.
SizeToContent func() `js:"sizeToContent"` // Window.sizeToContent() Sizes the window according to its content.
Stop func() `js:"stop"` // Window.stop() This method stops window loading.
UpdateCommands func() `js:"updateCommands"` // Window.updateCommands() Updates the state of commands of the current chrome window (UI).
Ondevicelight func() `js:"ondevicelight "` // Window.ondevicelight An event handler property for any ambient light levels changes
Ondevicemotion func() `js:"ondevicemotion "` // Window.ondevicemotion Called if accelerometer detects a change (For mobile devices)
Ondeviceorientation func() `js:"ondeviceorientation "` // Window.ondeviceorientation Called when the orientation is changed (For mobile devices)
Ondeviceorientationabsolute func() `js:"ondeviceorientationabsolute "` // Window.ondeviceorientationabsolute Chrome only An event handler property for any device orientation changes.
Ondeviceproximity func() `js:"ondeviceproximity "` // Window.ondeviceproximity An event handler property for device proximity event
Onappinstalled func() `js:"onappinstalled "` // Window.onappinstalled Called when the page is installed as a webapp. See appinstalled event.
Oninput func() `js:"oninput "` // Window.oninput Called when the value of an <input> element changes
Onpaint func() `js:"onpaint "` // Window.onpaint An event handler property for paint events on the window.
Onrejectionhandled func() `js:"onrejectionhandled "` // Window.onrejectionhandled An event handler for handled Promise rejection events.
Onuserproximity func() `js:"onuserproximity "` // Window.onuserproximity An event handler property for user proximity events.
Onvrdisplayconnected func() `js:"onvrdisplayconnected "` // Window.onvrdisplayconnected Represents an event handler that will run when a compatible VR device has been connected to the computer (when the vrdisplayconnected event fires).
Onvrdisplaydisconnected func() `js:"onvrdisplaydisconnected "` // Window.onvrdisplaydisconnected Represents an event handler that will run when a compatible VR device has been disconnected from the computer (when the vrdisplaydisconnected event fires).
Onvrdisplaypresentchange func() `js:"onvrdisplaypresentchange "` // Window.onvrdisplaypresentchange represents an event handler that will run when the presenting state of a VR device changes — i.e. goes from presenting to not presenting, or vice versa (when the onvrdisplaypresentchange event fires).
}
Win The window object represents a window containing a DOM document; the document property points to the DOM document loaded in that window. A window for a given document can be obtained using the document.defaultView property.
func WrapWindow ¶
Click to show internal directories.
Click to hide internal directories.