From 074785cea106179cb3305637055ab0a009ca74f2 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:52 -0500 Subject: initial commit --- files/pt-pt/dom/element/index.html | 573 +++++++++++++++++++++++++++++++++++++ 1 file changed, 573 insertions(+) create mode 100644 files/pt-pt/dom/element/index.html (limited to 'files/pt-pt/dom/element/index.html') diff --git a/files/pt-pt/dom/element/index.html b/files/pt-pt/dom/element/index.html new file mode 100644 index 0000000000..7b9a55f260 --- /dev/null +++ b/files/pt-pt/dom/element/index.html @@ -0,0 +1,573 @@ +--- +title: element +slug: DOM/element +tags: + - API + - API da Web + - DOM + - Element + - Elemento + - Interface + - Referencia + - Referência DOM +translation_of: Web/API/Element +--- +
{{APIRef("DOM")}}
+ +

Element é a classe base mais geral da qual todos os objetos em um {{DOMxRef("Document","documento")}} herdam. Este só tem métodos e propriedades comuns para todos os tipos de elementos. Classes mais específicas herdam de Element. Por exemplo, a interface {{DOMxRef("HTMLElement")}} é a interface base para os elementos HTML, enquanto a interface {{DOMxRef("SVGElement")}} é a base para todos os elementos SVG. A maioria das funcionalidades é especificada mais abaixo na hierarquia de classes.

+ +

Linguagens fora do âmbito da plataforma Web, como XUL através da interface XULElement, também implementa Element.

+ +

{{InheritanceDiagram}}

+ +

Propriedades

+ +

Inherits properties from its parent interface, {{DOMxRef("Node")}}, and by extension that interface's parent, {{DOMxRef("EventTarget")}}. It implements the properties of {{DOMxRef("ParentNode")}}, {{DOMxRef("ChildNode")}}, {{DOMxRef("NonDocumentTypeChildNode")}}, and {{DOMxRef("Animatable")}}.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NomeDescriçãoTipoDosponibilidade
attibutesTodos os atributos associados ao elementoNamedNodeMapAll
childNodesTodos os nós-filhos de um elemento.NodeListAll
classNameRetorna ou define a classe do elemento.StringHTML, XUL
clientHeightA altura interna de um elemento.NumberHTML
clientLeftA largura da borda esquerda de um elemento.NumberHTML
clientTopA largura da borda superior de um elemento.NumberHTML
clientWidthA largura interna de um elemento.NumberHTML
dirRetorna ou define a direcionalidade do elemento.StringHTML, XUL
firstChildO primeiro nó-filho direto de um elemento, ou null se o elemento não tem nós-filhos.NodeAll
idRetorna ou define o id do elemento.StringHTML, XUL
innerHTMLRetorna ou define a marcação e o conteúdo de um elemento.StringHTML
langRetorna ou define o atributo linguagem de um elemento, texto, e conteúdo do elemento.StringHTML
lastChildO último nó-filho direto de um elemento, ou null se o elemento não tem nós-filhos.NodeAll
localNameA parte local de um nome qualificado de um elemento.StringAll
NomeDescriçãoTipoDisponibilidade
nameRetorna/define o atributo name de um elemento.StringHTML
namespaceURIA URI de namespace do nó, ou null se não está especificado.StringAll
nextSiblingO nó imediatamente seguinte ao dado numa árvore, ou null se não existe nó-irmão.NodeAll
nodeNameO nome do nó.StringAll
nodeTypeUm número representando o tipo do nó. É sempre igual a 1 para elementos DOM.NumberAll
nodeValueO valor do nó. É sempre igual a null para elementos DOM.StringAll
offsetHeightA altura de um elemento, em relação ao layout.NumberHTML
offsetLeftA distância da borda esquerda do elemento para o a borda esquerda do seu offsetParent.NumberHTML
offsetParentO elemento para o qual todos cálculos de offset estão atualmente computados.ElementHTML
offsetTopA distância da borda superior do elemento para o a borda superior do seu offsetParent.NumberHTML
offsetWidthA largura de um elemento, em relação ao layout.NumberHTML
ownerDocumentO documento no qual o nó está, ou null se o nó não está dentro de nenhum.DocumentAll
NomeDescriçãoTipoDisponibilidade
parentNodeThe parent element of this node, or null if the node is not inside of a DOM Document.NodeAll
prefixThe namespace prefix of the node, or null if no prefix is specified.StringAll
previousSiblingThe node immediately preceding the given one in the tree, or null if there is no sibling node.NodeAll
scrollHeightThe scroll view height of an element.NumberHTML
scrollLeftGets/sets the left scroll offset of an element.NumberHTML
scrollTopGets/sets the top scroll offset of an element.NumberHTML
scrollWidthThe scroll view width of an element.NumberHTML
styleAn object representing the declarations of an element's style attributes.CSSStyleHTML, XUL
tabIndexGets/sets the position of the element in the tabbing order.NumberHTML
tagNameThe name of the tag for the given element.StringAll
textContentGets/sets the textual contents of an element and all its descendants.StringAll
+ +

Métodos

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Nome & DescriçãoRetornaDisponibilidade
addEventListener( type, listener, useCapture )
+ Register an event handler to a specific event type on the element.
-All
appendChild( appendedNode )
+ Insert a node as the last child node of this element.
NodeAll
blur()
+ Removes keyboard focus from the current element.
-HTML, XUL
click()
+ Simulates a click on the current element.
-HTML, XUL
cloneNode( deep )
+ Clone a node, and optionally, all of its contents.
NodeAll
dispatchEvent( event )
+ Dispatch an event to this node in the DOM.
BooleanAll
focus()
+ Gives keyboard focus to the current element.
-HTML, XUL
getAttribute( name )
+ Retrieve the value of the named attribute from the current node.
ObjectAll
getAttributeNS( namespace, name )
+ Retrieve the value of the attribute with the specified name and namespace, from the current node.
ObjectAll
getAttributeNode( name )
+ Retrieve the node representation of the named attribute from the current node.
AttrAll
getAttributeNodeNS( namespace, name )
+ Retrieve the node representation of the attribute with the specified name and namespace, from the current node.
AttrAll
Nome & DescriçãoRetornaDisponibilidade
getElementsByTagName( name )
+ Retrieve a set of all descendant elements, of a particular tag name, from the current element.
NodeSetAll
getElementsByTagNameNS( namespace, name )
+ Retrieve a set of all descendant elements, of a particular tag name and namespace, from the current element.
NodeSetAll
hasAttribute( name )
+ Check if the element has the specified attribute, or not.
BooleanAll
hasAttributeNS( namespace, name )
+ Check if the element has the specified attribute, in the specified namespace, or not.
BooleanAll
hasAttributes()
+ Check if the element has any attributes, or not.
BooleanAll
hasChildNodes()
+ Check if the element has any child nodes, or not.
BooleanAll
insertBefore( insertedNode, adjacentNode )
+ Inserts the first node before the second, child, Node in the DOM.
NodeAll
normalize()
+ Clean up all the text nodes under this element (merge adjacent, remove empty).
-All
removeAttribute( name )
+ Remove the named attribute from the current node.
-All
removeAttributeNS( namespace, name )
+ Remove the attribute with the specified name and namespace, from the current node.
-All
Nome & DescriçãoRetornaDisponibilidade
removeAttributeNode( name )
+ Remove the node representation of the named attribute from the current node.
-All
removeChild( removedNode )
+ Removes a child node from the current element.
NodeAll
removeEventListener( type, handler, useCapture )
+ Removes an event listener from the element.
-All
replaceChild( insertedNode, replacedNode )
+ Replaces one child node in the current element with another.
NodeAll
scrollIntoView( alignWithTop )
+ Scrolls the page until the element gets into the view.
-HTML
setAttribute( name, value )
+ Set the value of the named attribute from the current node.
-All
setAttributeNS( namespace, name, value )
+ Set the value of the attribute with the specified name and namespace, from the current node.
-All
setAttributeNode( name, attrNode )
+ Set the node representation of the named attribute from the current node.
-All
setAttributeNodeNS( namespace, name, attrNode )
+ Set the node representation of the attribute with the specified name and namespace, from the current node.
-All
+ +

Event Handlers

+ +

These are properties that correspond to the HTML 'on' event attributes.

+ +

Unlike the corresponding attributes, the values of these properties are functions (or any other object implementing the EventListener interface) rather than a string. In fact, assigning an event attribute in HTML creates a wrapper function around the specified code. For example, given the following HTML:

+ +
<div onclick="foo();">click me!</div>
+
+ +

If element is a reference to this div, the value of element.onclick is effectively:

+ +
function onclick(event) {
+   foo();
+}
+
+ +

Note how the event object is passed as parameter event to this wrapper function.

+ +
+
onblur
+
Returns the event handling code for the blur event.
+
+ +
+
onchange
+
Returns the event handling code for the change event.
+
+ +
+
onclick
+
Returns the event handling code for the click event.
+
+ +
+
ondblclick
+
Returns the event handling code for the dblclick event.
+
+ +
+
onfocus
+
Returns the event handling code for the focus event.
+
+ +
+
onkeydown
+
Returns the event handling code for the keydown event.
+
+ +
+
onkeypress
+
Returns the event handling code for the keypress event.
+
+ +
+
onkeyup
+
Returns the event handling code for the keyup event.
+
+ +
+
onmousedown
+
Returns the event handling code for the mousedown event.
+
+ +
+
onmousemove
+
Returns the event handling code for the mousemove event.
+
+ +
+
onmouseout
+
Returns the event handling code for the mouseout event.
+
+ +
+
onmouseover
+
Returns the event handling code for the mouseover event.
+
+ +
+
onmouseup
+
Returns the event handling code for the mouseup event.
+
+ +
+
onresize
+
Returns the event handling code for the resize event.
+
+ +
+
onscroll
+
Returns the event handling code for the scroll event.
+
+ +
 
+ +

Compatibilidade de navegador

+ + + +

{{Compat("api.Element")}}

-- cgit v1.2.3-54-g00ecf