Class DOM
-
Field Summary
Modifier and TypeFieldDescription(package private) static final com.google.gwt.user.client.impl.DOMImpl
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addEventPreview
(EventPreview preview) Deprecated.static void
appendChild
(Element parent, Element child) Appends one element to another's list of children.static Element
static Element
Clones an element.static boolean
Deprecated.Use identity comparison.static Element
Creates an HTML A element.static Element
Creates an HTML BUTTON element.static Element
Creates an HTML CAPTION element.static Element
Creates an HTML COL element.static Element
Creates an HTML COLGROUP element.static Element
Creates an HTML DIV element.static Element
createElement
(String tagName) Creates an HTML element.static Element
Creates an HTML FIELDSET element.static Element
Creates an HTML FORM element.static Element
Creates an HTML IFRAME element.static Element
Creates an HTML IMG element.static Element
Creates an HTML INPUT type='CHECK' element.static Element
Creates an HTML INPUT type='PASSWORD' element.static Element
createInputRadio
(String name) Creates an HTML INPUT type='RADIO' element.static Element
Creates an HTML INPUT type='TEXT' element.static Element
Creates an HTML LABEL element.static Element
Creates an HTML LEGEND element.static Element
Creates an HTML OPTION element.static Element
Deprecated.there is no "options" element; usecreateOption()
insteadstatic Element
Creates a single-selection HTML SELECT element.static Element
createSelect
(boolean multiple) Creates an HTML SELECT element.static Element
Creates an HTML SPAN element.static Element
Creates an HTML TABLE element.static Element
Creates an HTML TBODY element.static Element
createTD()
Creates an HTML TD element.static Element
Creates an HTML TEXTAREA element.static Element
Creates an HTML TFOOT element.static Element
createTH()
Creates an HTML TH element.static Element
Creates an HTML THEAD element.static Element
createTR()
Creates an HTML TR element.static String
Generates a unique DOM id.static boolean
dispatchEvent
(Event evt, Element elem) This method is a similar todispatchEvent(Event, Element, EventListener)
but only dispatches if an event listener is set to element.static void
dispatchEvent
(Event evt, Element elem, EventListener listener) This method is called directly by native code when any event is fired.static void
eventCancelBubble
(Event evt, boolean cancel) Cancels bubbling for the given event.static boolean
eventGetAltKey
(Event evt) Deprecated.UseNativeEvent.getAltKey()
instead.static int
eventGetButton
(Event evt) Deprecated.UseNativeEvent.getButton()
instead.static int
eventGetClientX
(Event evt) Deprecated.UseNativeEvent.getClientX()
instead.static int
eventGetClientY
(Event evt) Deprecated.UseNativeEvent.getClientY()
instead.static boolean
eventGetCtrlKey
(Event evt) Deprecated.UseNativeEvent.getCtrlKey()
instead.static Event
Gets the current event that is being fired.static Element
Gets the current target element of the given event.static Element
eventGetFromElement
(Event evt) Gets the element from which the mouse pointer was moved (valid forEvent.ONMOUSEOVER
andEvent.ONMOUSEOUT
).static int
eventGetKeyCode
(Event evt) Deprecated.UseNativeEvent.getKeyCode()
instead.static boolean
eventGetMetaKey
(Event evt) Deprecated.UseNativeEvent.getMetaKey()
instead.static int
Deprecated.UseNativeEvent.getMouseWheelVelocityY()
instead.static boolean
eventGetRepeat
(Event evt) Deprecated.not supported in any browser but IEstatic int
eventGetScreenX
(Event evt) Deprecated.UseNativeEvent.getScreenX()
instead.static int
eventGetScreenY
(Event evt) Deprecated.UseNativeEvent.getScreenY()
instead.static boolean
eventGetShiftKey
(Event evt) Deprecated.UseNativeEvent.getShiftKey()
instead.static Element
eventGetTarget
(Event evt) Returns the element that was the actual target of the given event.static Element
eventGetToElement
(Event evt) Gets the element to which the mouse pointer was moved (only valid forEvent.ONMOUSEOUT
andEvent.ONMOUSEOVER
).static int
eventGetType
(Event evt) Gets the enumerated type of this event (as defined inEvent
).static String
eventGetTypeString
(Event evt) Deprecated.UseNativeEvent.getType()
instead.static void
eventPreventDefault
(Event evt) Deprecated.UseNativeEvent.preventDefault()
instead.static void
eventSetKeyCode
(Event evt, char key) Deprecated.this method only works in IE and should not have been added to the APIstatic String
eventToString
(Event evt) Deprecated.UseNativeEvent.getString()
instead.static int
getAbsoluteLeft
(Element elem) Deprecated.UseElement.getAbsoluteLeft()
instead.static int
getAbsoluteTop
(Element elem) Deprecated.UseElement.getAbsoluteTop()
instead.static String
getAttribute
(Element elem, String attr) Deprecated.Use the more appropriately namedElement.getPropertyString(String)
instead.static boolean
getBooleanAttribute
(Element elem, String attr) Deprecated.Use the more appropriately namedElement.getPropertyBoolean(String)
instead.static Element
Gets the element that currently has mouse capture.static Element
Gets an element's n-th child element.static int
getChildCount
(Element parent) Gets the number of child elements present in a given parent element.static int
getChildIndex
(Element parent, Element child) Gets the index of a given child element within its parent.static String
getElementAttribute
(Element elem, String attr) Deprecated.UseElement.getAttribute(String)
instead.static Element
getElementById
(String id) Gets the element associated with the given unique id within the entire document.static String
getElementProperty
(Element elem, String prop) Deprecated.UseElement#getProperty(String)
instead.static boolean
getElementPropertyBoolean
(Element elem, String prop) Deprecated.UseElement.getPropertyBoolean(String)
instead.static int
getElementPropertyInt
(Element elem, String prop) Deprecated.UseElement.getPropertyInt(String)
instead.static EventListener
getEventListener
(Element elem) Gets theEventListener
that will receive events for the given element.static int
getEventsSunk
(Element elem) Gets the current set of events sunk by a given element.static Element
getFirstChild
(Element elem) Gets the first child element of the given element.static String
Gets the src attribute of an img element.static String
getInnerHTML
(Element elem) Deprecated.UseElement.getInnerHTML()
instead.static String
getInnerText
(Element elem) Deprecated.UseElement.getInnerText()
instead.static int
getIntAttribute
(Element elem, String attr) Deprecated.Use the more appropriately namedElement.getPropertyInt(String)
instead.static int
getIntStyleAttribute
(Element elem, String attr) Gets an integer attribute on a given element's style.static Element
getNextSibling
(Element elem) Gets an element's next sibling element.static Element
Gets an element's parent element.static String
getStyleAttribute
(Element elem, String attr) Deprecated.UseElement.getStyle()
andStyle#getProperty(String)
instead.static void
insertBefore
(Element parent, Element child, Element before) Inserts an element as a child of the given parent element, before another child of that parent.static void
insertChild
(Element parent, Element child, int index) Inserts an element as a child of the given parent element.static void
insertListItem
(Element selectElem, String item, String value, int index) Creates an<option>
element and inserts it as a child of the specified<select>
element.static boolean
isOrHasChild
(Element parent, Element child) Deprecated.UseNode.isOrHasChild(Element)
instead.(package private) static void
Initialize the event system if it has not already been initialized.static boolean
previewEvent
(Event evt) This method is called directly by native code when event preview is being used.static void
releaseCapture
(Element elem) Releases mouse/touch/gesture capture on the given element.static void
removeChild
(Element parent, Element child) Deprecated.UseNode.removeChild(Element)
instead.static void
removeElementAttribute
(Element elem, String attr) Deprecated.UseElement.removeAttribute(String)
instead.static void
removeEventPreview
(EventPreview preview) Deprecated.useHandlerRegistration
returned fromEvent.addNativePreviewHandler(Event.NativePreviewHandler)
static void
scrollIntoView
(Element elem) Deprecated.UseElement.scrollIntoView()
instead.static void
setAttribute
(Element elem, String attr, String value) Deprecated.Use the more appropriately namedElement.setPropertyString(String, String)
instead.static void
setBooleanAttribute
(Element elem, String attr, boolean value) Deprecated.Use the more appropriately namedElement.setPropertyBoolean(String, boolean)
instead.static void
setCapture
(Element elem) Sets mouse/touch/gesture capture on the given element.static void
setElementAttribute
(Element elem, String attr, String value) Deprecated.UseElement.setAttribute(String, String)
instead.static void
setElementProperty
(Element elem, String prop, String value) Deprecated.UseElement.setPropertyString(String, String)
instead.static void
setElementPropertyBoolean
(Element elem, String prop, boolean value) Deprecated.UseElement.setPropertyBoolean(String, boolean)
instead.static void
setElementPropertyInt
(Element elem, String prop, int value) Deprecated.UseElement.setPropertyInt(String, int)
instead.static void
setEventListener
(Element elem, EventListener listener) Sets theEventListener
to receive events for the given element.static void
Sets the src attribute of an img element.static void
setInnerHTML
(Element elem, String html) Deprecated.UseElement.setInnerHTML(String)
instead.static void
setInnerText
(Element elem, String text) Deprecated.UseElement.setInnerText(String)
instead.static void
setIntAttribute
(Element elem, String attr, int value) Deprecated.Use the more appropriately namedElement.setPropertyInt(String, int)
instead.static void
setIntStyleAttribute
(Element elem, String attr, int value) Sets an integer attribute on the given element's style.static void
setOptionText
(Element select, String text, int index) Sets the option text of the given select object.static void
setStyleAttribute
(Element elem, String attr, String value) Deprecated.UseElement.getStyle()
andStyle#setProperty(String, String)
instead.static void
sinkBitlessEvent
(Element elem, String eventTypeName) Sinks a named event.static void
sinkEvents
(Element elem, int eventBits) Sets the current set of events sunk by a given element.static String
Deprecated.UseElement.getString()
instead.static int
Deprecated.As of GWT 1.5, replaced byWindow.getClientHeight()
static int
Deprecated.As of GWT 1.5, replaced byWindow.getClientWidth()
-
Field Details
-
impl
static final com.google.gwt.user.client.impl.DOMImpl impl
-
-
Constructor Details
-
DOM
public DOM()
-
-
Method Details
-
addEventPreview
Deprecated.Adds an event preview to the preview stack. As long as this preview remains on the top of the stack, it will receive all events before they are fired to their listeners. Note that the event preview will receive all events, including those received due to bubbling, whereas normal event handlers only receive explicitly sunk events.- Parameters:
preview
- the event preview to be added to the stack.
-
appendChild
Appends one element to another's list of children.If the child element is a
PotentialElement
, it is first resolved.- Parameters:
parent
- the parent elementchild
- its new child- See Also:
-
clone
Clones an element.- Parameters:
elem
- the element to be cloneddeep
- should children be cloned as well?
-
compare
Deprecated.Use identity comparison.Compares two elements for equality. Note that this method is now deprecated because reference identity accurately reports equality.- Parameters:
elem1
- the first element to be comparedelem2
- the second element to be compared- Returns:
true
if they are in fact the same element
-
createAnchor
Creates an HTML A element.- Returns:
- the newly-created element
-
createButton
Creates an HTML BUTTON element.- Returns:
- the newly-created element
-
createCaption
Creates an HTML CAPTION element.- Returns:
- the newly-created element
-
createCol
Creates an HTML COL element.- Returns:
- the newly-created element
-
createColGroup
Creates an HTML COLGROUP element.- Returns:
- the newly-created element
-
createDiv
Creates an HTML DIV element.- Returns:
- the newly-created element
-
createElement
Creates an HTML element.- Parameters:
tagName
- the HTML tag of the element to be created- Returns:
- the newly-created element
-
createFieldSet
Creates an HTML FIELDSET element.- Returns:
- the newly-created element
-
createForm
Creates an HTML FORM element.- Returns:
- the newly-created element
-
createIFrame
Creates an HTML IFRAME element.- Returns:
- the newly-created element
-
createImg
Creates an HTML IMG element.- Returns:
- the newly-created element
-
createInputCheck
Creates an HTML INPUT type='CHECK' element.- Returns:
- the newly-created element
-
createInputPassword
Creates an HTML INPUT type='PASSWORD' element.- Returns:
- the newly-created element
-
createInputRadio
Creates an HTML INPUT type='RADIO' element.- Parameters:
name
- the name of the group with which this radio button will be associated- Returns:
- the newly-created element
-
createInputText
Creates an HTML INPUT type='TEXT' element.- Returns:
- the newly-created element
-
createLabel
Creates an HTML LABEL element.- Returns:
- the newly-created element
-
createLegend
Creates an HTML LEGEND element.- Returns:
- the newly-created element
-
createOption
Creates an HTML OPTION element.- Returns:
- the newly-created element
-
createOptions
Deprecated.there is no "options" element; usecreateOption()
insteadCreates an HTML OPTIONS element.- Returns:
- the newly-created element
-
createSelect
Creates a single-selection HTML SELECT element. Equivalent tocreateSelect(false)
- Returns:
- the newly-created element
-
createSelect
Creates an HTML SELECT element.- Parameters:
multiple
- true if multiple selection of options is allowed- Returns:
- the newly-created element
-
createSpan
Creates an HTML SPAN element.- Returns:
- the newly-created element
-
createTable
Creates an HTML TABLE element.- Returns:
- the newly-created element
-
createTBody
Creates an HTML TBODY element.- Returns:
- the newly-created element
-
createTD
Creates an HTML TD element.- Returns:
- the newly-created element
-
createTextArea
Creates an HTML TEXTAREA element.- Returns:
- the newly-created element
-
createTFoot
Creates an HTML TFOOT element.- Returns:
- the newly-created element
-
createTH
Creates an HTML TH element.- Returns:
- the newly-created element
-
createTHead
Creates an HTML THEAD element.- Returns:
- the newly-created element
-
createTR
Creates an HTML TR element.- Returns:
- the newly-created element
-
createUniqueId
Generates a unique DOM id. The id is of the form "gwt-id-". - Returns:
- a unique DOM id
-
eventCancelBubble
Cancels bubbling for the given event. This will stop the event from being propagated to parent elements.- Parameters:
evt
- the event on which to cancel bubblingcancel
-true
to cancel bubbling
-
eventGetAltKey
Deprecated.UseNativeEvent.getAltKey()
instead.Gets whether the ALT key was depressed when the given event occurred.- Parameters:
evt
- the event to be tested- Returns:
true
if ALT was depressed when the event occurred
-
eventGetButton
Deprecated.UseNativeEvent.getButton()
instead.Gets the mouse buttons that were depressed when the given event occurred.- Parameters:
evt
- the event to be tested- Returns:
- a bit-field, defined by
NativeEvent.BUTTON_LEFT
,NativeEvent.BUTTON_MIDDLE
, andNativeEvent.BUTTON_RIGHT
-
eventGetClientX
Deprecated.UseNativeEvent.getClientX()
instead.Gets the mouse x-position within the browser window's client area.- Parameters:
evt
- the event to be tested- Returns:
- the mouse x-position
-
eventGetClientY
Deprecated.UseNativeEvent.getClientY()
instead.Gets the mouse y-position within the browser window's client area.- Parameters:
evt
- the event to be tested- Returns:
- the mouse y-position
-
eventGetCtrlKey
Deprecated.UseNativeEvent.getCtrlKey()
instead.Gets whether the CTRL key was depressed when the given event occurred.- Parameters:
evt
- the event to be tested- Returns:
true
if CTRL was depressed when the event occurred
-
eventGetCurrentEvent
Gets the current event that is being fired. The current event is only available within the lifetime of the onBrowserEvent function. Once the onBrowserEvent method returns, the current event is reset to null.- Returns:
- the current event
-
eventGetCurrentTarget
Gets the current target element of the given event. This is the element whose listener fired last, not the element which fired the event initially.- Parameters:
evt
- the event- Returns:
- the event's current target element
- See Also:
-
eventGetFromElement
Gets the element from which the mouse pointer was moved (valid forEvent.ONMOUSEOVER
andEvent.ONMOUSEOUT
).- Parameters:
evt
- the event to be tested- Returns:
- the element from which the mouse pointer was moved
-
eventGetKeyCode
Deprecated.UseNativeEvent.getKeyCode()
instead.Gets the key code associated with this event.For
Event.ONKEYPRESS
, this method returns the Unicode value of the character generated. ForEvent.ONKEYDOWN
andEvent.ONKEYUP
, it returns the code associated with the physical key.- Parameters:
evt
- the event to be tested- Returns:
- the Unicode character or key code.
- See Also:
-
eventGetMetaKey
Deprecated.UseNativeEvent.getMetaKey()
instead.Gets whether the META key was depressed when the given event occurred.- Parameters:
evt
- the event to be tested- Returns:
true
if META was depressed when the event occurred
-
eventGetMouseWheelVelocityY
Deprecated.UseNativeEvent.getMouseWheelVelocityY()
instead.Gets the velocity of the mouse wheel associated with the event along the Y axis.The velocity of the event is an artificial measurement for relative comparisons of wheel activity. It is affected by some non-browser factors, including choice of input hardware and mouse acceleration settings. The sign of the velocity measurement agrees with the screen coordinate system; negative values are towards the origin and positive values are away from the origin. Standard scrolling speed is approximately ten units per event.
- Parameters:
evt
- the event to be examined.- Returns:
- The velocity of the mouse wheel.
-
eventGetRepeat
Deprecated.not supported in any browser but IEGets the key-repeat state of this event. Only IE supports this attribute.- Parameters:
evt
- the event to be tested- Returns:
true
if this key event was an auto-repeat
-
eventGetScreenX
Deprecated.UseNativeEvent.getScreenX()
instead.Gets the mouse x-position on the user's display.- Parameters:
evt
- the event to be tested- Returns:
- the mouse x-position
-
eventGetScreenY
Deprecated.UseNativeEvent.getScreenY()
instead.Gets the mouse y-position on the user's display.- Parameters:
evt
- the event to be tested- Returns:
- the mouse y-position
-
eventGetShiftKey
Deprecated.UseNativeEvent.getShiftKey()
instead.Gets whether the shift key was depressed when the given event occurred.- Parameters:
evt
- the event to be tested- Returns:
true
if shift was depressed when the event occurred
-
eventGetTarget
Returns the element that was the actual target of the given event.- Parameters:
evt
- the event to be tested- Returns:
- the target element
-
eventGetToElement
Gets the element to which the mouse pointer was moved (only valid forEvent.ONMOUSEOUT
andEvent.ONMOUSEOVER
).- Parameters:
evt
- the event to be tested- Returns:
- the element to which the mouse pointer was moved
-
eventGetType
Gets the enumerated type of this event (as defined inEvent
).- Parameters:
evt
- the event to be tested- Returns:
- the event's enumerated type, or -1 if not defined
-
eventGetTypeString
Deprecated.UseNativeEvent.getType()
instead.Gets the type of the given event as a string.- Parameters:
evt
- the event to be tested- Returns:
- the event's type name
-
eventPreventDefault
Deprecated.UseNativeEvent.preventDefault()
instead.Prevents the browser from taking its default action for the given event.- Parameters:
evt
- the event whose default action is to be prevented
-
eventSetKeyCode
Deprecated.this method only works in IE and should not have been added to the APISets the key code associated with the given keyboard event.- Parameters:
evt
- the event whose key code is to be setkey
- the new key code
-
eventToString
Deprecated.UseNativeEvent.getString()
instead.Returns a stringized version of the event. This string is for debugging purposes and will NOT be consistent on different browsers.- Parameters:
evt
- the event to stringize- Returns:
- a string form of the event
-
getAbsoluteLeft
Deprecated.UseElement.getAbsoluteLeft()
instead.Gets an element's absolute left coordinate in the document's coordinate system.- Parameters:
elem
- the element to be measured- Returns:
- the element's absolute left coordinate
-
getAbsoluteTop
Deprecated.UseElement.getAbsoluteTop()
instead.Gets an element's absolute top coordinate in the document's coordinate system.- Parameters:
elem
- the element to be measured- Returns:
- the element's absolute top coordinate
-
getAttribute
Deprecated.Use the more appropriately namedElement.getPropertyString(String)
instead.Gets any named property from an element, as a string.- Parameters:
elem
- the element whose property is to be retrievedattr
- the name of the property- Returns:
- the property's value
-
getBooleanAttribute
Deprecated.Use the more appropriately namedElement.getPropertyBoolean(String)
instead.Gets a boolean property on the given element.- Parameters:
elem
- the element whose property is to be setattr
- the name of the property to be set- Returns:
- the property's value as a boolean
-
getCaptureElement
Gets the element that currently has mouse capture.- Returns:
- a handle to the capture element, or
null
if none exists
-
getChild
Gets an element's n-th child element.- Parameters:
parent
- the element whose child is to be retrievedindex
- the index of the child element- Returns:
- the n-th child element
-
getChildCount
Gets the number of child elements present in a given parent element.- Parameters:
parent
- the element whose children are to be counted- Returns:
- the number of children
-
getChildIndex
Gets the index of a given child element within its parent.- Parameters:
parent
- the parent elementchild
- the child element- Returns:
- the child's index within its parent, or
-1
if it is not a child of the given parent
-
getElementAttribute
Deprecated.UseElement.getAttribute(String)
instead.Gets the named attribute from the element.- Parameters:
elem
- the element whose property is to be retrievedattr
- the name of the attribute- Returns:
- the value of the attribute
-
getElementById
Gets the element associated with the given unique id within the entire document.- Parameters:
id
- the id whose associated element is to be retrieved- Returns:
- the associated element, or
null
if none is found
-
getElementProperty
Deprecated.UseElement#getProperty(String)
instead.Gets any named property from an element, as a string.- Parameters:
elem
- the element whose property is to be retrievedprop
- the name of the property- Returns:
- the property's value
-
getElementPropertyBoolean
Deprecated.UseElement.getPropertyBoolean(String)
instead.Gets any named property from an element, as a boolean.- Parameters:
elem
- the element whose property is to be retrievedprop
- the name of the property- Returns:
- the property's value as a boolean
-
getElementPropertyInt
Deprecated.UseElement.getPropertyInt(String)
instead.Gets any named property from an element, as an int.- Parameters:
elem
- the element whose property is to be retrievedprop
- the name of the property- Returns:
- the property's value as an int
-
getEventListener
Gets theEventListener
that will receive events for the given element. Only one such listener may exist for a single element.- Parameters:
elem
- the element whose listener is to be set- Returns:
- the element's event listener
-
getEventsSunk
Gets the current set of events sunk by a given element.- Parameters:
elem
- the element whose events are to be retrieved- Returns:
- a bitfield describing the events sunk on this element (its possible
values are described in
Event
)
-
getFirstChild
Gets the first child element of the given element.- Parameters:
elem
- the element whose child is to be retrieved- Returns:
- the child element
-
getImgSrc
Gets the src attribute of an img element. This method is paired withsetImgSrc(Element, String)
so that it always returns the correct url.- Parameters:
img
- a non-null img whose src attribute is to be read.- Returns:
- the src url of the img
-
getInnerHTML
Deprecated.UseElement.getInnerHTML()
instead.Gets an HTML representation of an element's children.- Parameters:
elem
- the element whose HTML is to be retrieved- Returns:
- the HTML representation of the element's children
-
getInnerText
Deprecated.UseElement.getInnerText()
instead.Gets the text contained within an element. If the element has child elements, only the text between them will be retrieved.- Parameters:
elem
- the element whose inner text is to be retrieved- Returns:
- the text inside this element
-
getIntAttribute
Deprecated.Use the more appropriately namedElement.getPropertyInt(String)
instead.Gets an integer property on a given element.- Parameters:
elem
- the element whose property is to be retrievedattr
- the name of the property to be retrieved- Returns:
- the property's value as an integer
-
getIntStyleAttribute
Gets an integer attribute on a given element's style.- Parameters:
elem
- the element whose style attribute is to be retrievedattr
- the name of the attribute to be retrieved- Returns:
- the style attribute's value as an integer
-
getNextSibling
Gets an element's next sibling element.- Parameters:
elem
- the element whose sibling is to be retrieved- Returns:
- the sibling element
-
getParent
Gets an element's parent element.- Parameters:
elem
- the element whose parent is to be retrieved- Returns:
- the parent element
-
getStyleAttribute
Deprecated.UseElement.getStyle()
andStyle#getProperty(String)
instead.Gets an attribute of the given element's style.- Parameters:
elem
- the element whose style attribute is to be retrievedattr
- the name of the style attribute to be retrieved- Returns:
- the style attribute's value
-
insertBefore
Inserts an element as a child of the given parent element, before another child of that parent.If the child element is a
PotentialElement
, it is first resolved.- Parameters:
parent
- the parent elementchild
- the child element to add toparent
before
- an existing child element ofparent
before whichchild
will be inserted- See Also:
-
insertChild
Inserts an element as a child of the given parent element.If the child element is a
PotentialElement
, it is first resolved.- Parameters:
parent
- the parent elementchild
- the child element to add toparent
index
- the index before which the child will be inserted (any value greater than the number of existing children will cause the child to be appended)- See Also:
-
insertListItem
Creates an<option>
element and inserts it as a child of the specified<select>
element. If the index is less than zero, or greater than or equal to the length of the list, then the option element will be appended to the end of the list.- Parameters:
selectElem
- the<select>
elementitem
- the text of the new item; cannot benull
value
- thevalue
attribute for the new<option>
; cannot benull
index
- the index at which to insert the child
-
isOrHasChild
Deprecated.UseNode.isOrHasChild(Element)
instead.Determine whether one element is equal to, or the child of, another.- Parameters:
parent
- the potential parent elementchild
- the potential child element- Returns:
true
if the relationship holds
-
releaseCapture
Releases mouse/touch/gesture capture on the given element. Calling this method has no effect if the element does not currently have mouse/touch/gesture capture.- Parameters:
elem
- the element to release capture- See Also:
-
removeChild
Deprecated.UseNode.removeChild(Element)
instead.Removes a child element from the given parent element.- Parameters:
parent
- the parent elementchild
- the child element to be removed
-
removeElementAttribute
Deprecated.UseElement.removeAttribute(String)
instead.Removes the named attribute from the given element.- Parameters:
elem
- the element whose attribute is to be removedattr
- the name of the element to remove
-
removeEventPreview
Deprecated.useHandlerRegistration
returned fromEvent.addNativePreviewHandler(Event.NativePreviewHandler)
Removes an element from the preview stack. This element will no longer capture events, though any preview underneath it will begin to do so.- Parameters:
preview
- the event preview to be removed from the stack
-
scrollIntoView
Deprecated.UseElement.scrollIntoView()
instead.Scrolls the given element into view.This method crawls up the DOM hierarchy, adjusting the scrollLeft and scrollTop properties of each scrollable element to ensure that the specified element is completely in view. It adjusts each scroll position by the minimum amount necessary.
- Parameters:
elem
- the element to be made visible
-
setAttribute
Deprecated.Use the more appropriately namedElement.setPropertyString(String, String)
instead.Sets a property on the given element.- Parameters:
elem
- the element whose property is to be setattr
- the name of the property to be setvalue
- the new property value
-
setBooleanAttribute
Deprecated.Use the more appropriately namedElement.setPropertyBoolean(String, boolean)
instead.Sets a boolean property on the given element.- Parameters:
elem
- the element whose property is to be setattr
- the name of the property to be setvalue
- the property's new boolean value
-
setCapture
Sets mouse/touch/gesture capture on the given element. This element will directly receive all mouse events untilreleaseCapture(Element)
is called on it.- Parameters:
elem
- the element on which to set mouse/touch/gesture capture
-
setElementAttribute
Deprecated.UseElement.setAttribute(String, String)
instead.Sets an attribute on a given element.- Parameters:
elem
- element whose attribute is to be setattr
- the name of the attributevalue
- the value to which the attribute should be set
-
setElementProperty
Deprecated.UseElement.setPropertyString(String, String)
instead.Sets a property on the given element.- Parameters:
elem
- the element whose property is to be setprop
- the name of the property to be setvalue
- the new property value
-
setElementPropertyBoolean
Deprecated.UseElement.setPropertyBoolean(String, boolean)
instead.Sets a boolean property on the given element.- Parameters:
elem
- the element whose property is to be setprop
- the name of the property to be setvalue
- the new property value as a boolean
-
setElementPropertyInt
Deprecated.UseElement.setPropertyInt(String, int)
instead.Sets an int property on the given element.- Parameters:
elem
- the element whose property is to be setprop
- the name of the property to be setvalue
- the new property value as an int
-
setEventListener
Sets theEventListener
to receive events for the given element. Only one such listener may exist for a single element.- Parameters:
elem
- the element whose listener is to be setlistener
- the listener to receiveevents
-
setImgSrc
Sets the src attribute of an img element. This method ensures that imgs only ever have their contents requested one single time from the server.- Parameters:
img
- a non-null img whose src attribute will be set.src
- a non-null url for the img
-
setInnerHTML
Deprecated.UseElement.setInnerHTML(String)
instead.Sets the HTML contained within an element.- Parameters:
elem
- the element whose inner HTML is to be sethtml
- the new html
-
setInnerText
Deprecated.UseElement.setInnerText(String)
instead.Sets the text contained within an element. If the element already has children, they will be destroyed.- Parameters:
elem
- the element whose inner text is to be settext
- the new text
-
setIntAttribute
Deprecated.Use the more appropriately namedElement.setPropertyInt(String, int)
instead.Sets an integer property on the given element.- Parameters:
elem
- the element whose property is to be setattr
- the name of the property to be setvalue
- the property's new integer value
-
setIntStyleAttribute
Sets an integer attribute on the given element's style.- Parameters:
elem
- the element whose style attribute is to be setattr
- the name of the style attribute to be setvalue
- the style attribute's new integer value
-
setOptionText
Sets the option text of the given select object.- Parameters:
select
- the select object whose option text is being settext
- the text to setindex
- the index of the option whose text should be set
-
setStyleAttribute
Deprecated.UseElement.getStyle()
andStyle#setProperty(String, String)
instead.Sets an attribute on the given element's style.- Parameters:
elem
- the element whose style attribute is to be setattr
- the name of the style attribute to be setvalue
- the style attribute's new value
-
sinkBitlessEvent
Sinks a named event. Events will be fired to the nearestEventListener
specified on any of the element's parents.- Parameters:
elem
- the element whose events are to be retrievedeventTypeName
- name of the event to sink on this element
-
sinkEvents
Sets the current set of events sunk by a given element. These events will be fired to the nearestEventListener
specified on any of the element's parents.- Parameters:
elem
- the element whose events are to be retrievedeventBits
- a bitfield describing the events sunk on this element (its possible values are described inEvent
)
-
toString
Deprecated.UseElement.getString()
instead.Returns a stringized version of the element. This string is for debugging purposes and will NOT be consistent on different browsers.- Parameters:
elem
- the element to stringize- Returns:
- a string form of the element
-
windowGetClientHeight
Deprecated.As of GWT 1.5, replaced byWindow.getClientHeight()
-
windowGetClientWidth
Deprecated.As of GWT 1.5, replaced byWindow.getClientWidth()
-
dispatchEvent
This method is called directly by native code when any event is fired.- Parameters:
evt
- the handle to the event being fired.elem
- the handle to the element that received the event.listener
- the listener associated with the element that received the event.
-
dispatchEvent
This method is a similar todispatchEvent(Event, Element, EventListener)
but only dispatches if an event listener is set to element.- Parameters:
evt
- the handle to the event being fired.elem
- the handle to the element that received the event.- Returns:
true
if the event was dispatched
-
maybeInitializeEventSystem
static void maybeInitializeEventSystem()Initialize the event system if it has not already been initialized. -
previewEvent
This method is called directly by native code when event preview is being used.- Parameters:
evt
- a handle to the event being previewed- Returns:
false
to cancel the event
-
asOld
Provided as a convenient way to upcast values statically typed asElement
toElement
. For easier upgrades in the future, it's recommended that this function only be called within areturn
statement.Does not throw a
NullPointerException
if elem is null.
-
Event.addNativePreviewHandler(Event.NativePreviewHandler)