--- title: Element slug: Web/API/Element tags: - API - DOM - Element - Interface - Referenza - Referenza del DOM - Web API translation_of: Web/API/Element ---
Element
è la classe base più generale da cui ereditano tutti gli oggetti in un {{DOMxRef("Document")}}. Ha solo metodi e proprietà comuni a tutti i tipi di elementi. Classi più specifiche ereditano da Element
. Ad esempio, l'interfaccia {{DOMxRef("HTMLElement")}} è l'interfaccia di base per gli elementi HTML, mentre l'interfaccia {{DOMxRef("SVGElement")}} è la base per tutti gli elementi SVG. La maggior parte delle funzionalità è specificata più in basso nella gerarchia delle classi.
Le lingue al di fuori del regno della piattaforma Web, come XUL attraverso l'interfaccia XULElement
, implementano anche Element
.
{{InheritanceDiagram}}
Eredita le proprietà dalla sua interfaccia genitore, {{DOMxRef("Node")}}, e per estensione l'interfaccia genitore, {{DOMxRef("EventTarget")}}. Implementa le proprietà di {{DOMxRef("ParentNode")}}, {{DOMxRef("ChildNode")}}, {{DOMxRef("NonDocumentTypeChildNode")}}, e {{DOMxRef("Animatable")}}.
null
if it is no namespace.
Note: In Firefox 3.5 and earlier, HTML elements are in no namespace. In later versions, HTML elements are in the http://www.w3.org/1999/xhtml
namespace in both HTML and XML trees. {{ gecko_minversion_inline("1.9.2")}}
null
if there's no sibling node.null
if no prefix is specified.null
if there is no sibling element.Note: DOM Level 3 defined namespaceURI
, localName
and prefix
on the {{DOMxRef("Node")}} interface. In DOM4 they were moved to Element
.
This change is implemented in Chrome since version 46.0 and Firefox since version 48.0.
L'interfaccia Element
include la seguente proprietà, definita nel mixin {{DOMxRef("Slotable")}}.
Inherits methods from its parents {{DOMxRef("Node")}}, and its own parent, {{DOMxRef("EventTarget")}}, and implements those of {{DOMxRef("ParentNode")}}, {{DOMxRef("ChildNode")}}, {{DOMxRef("NonDocumentTypeChildNode")}}, and {{DOMxRef("Animatable")}}.
Listen to these events using addEventListener()
or by assigning an event listener to the oneventname
property of this interface.
error
Document
or Element
if an error occurs while attempting to switch it into or out of full-screen mode.Specifica | Stato | Commento |
---|---|---|
{{SpecName("Web Animations", '', '')}} | {{Spec2("Web Animations")}} | Aggiunto il metodo getAnimations() . |
{{SpecName('Undo Manager', '', 'Element')}} | {{Spec2('Undo Manager')}} | Aggiunge le proprietà undoScope e undoManager . |
{{SpecName('Pointer Events 2', '#extensions-to-the-element-interface', 'Element')}} | {{Spec2('Pointer Events 2')}} | Aggiunti i seguenti gestori di eventi: ongotpointercapture and onlostpointercapture .Aggiunti i seguenti metodi: setPointerCapture() e releasePointerCapture() . |
{{SpecName('Pointer Events', '#extensions-to-the-element-interface', 'Element')}} | {{Spec2('Pointer Events')}} | Aggiunti i seguenti gestori di eventi: ongotpointercapture e onlostpointercapture .Aggiunti i seguenti metodi: setPointerCapture() e releasePointerCapture() . |
{{SpecName('Selectors API Level 1', '#interface-definitions', 'Element')}} | {{Spec2('Selectors API Level 1')}} | Aggiunti i seguenti metodi: querySelector() e querySelectorAll() . |
{{SpecName('Pointer Lock', 'index.html#element-interface', 'Element')}} | {{Spec2('Pointer Lock')}} | Aggiunto il metodo requestPointerLock() . |
{{SpecName('Fullscreen', '#api', 'Element')}} | {{Spec2('Fullscreen')}} | Aggiunto il metodo requestFullscreen() . |
{{SpecName('DOM Parsing', '#extensions-to-the-element-interface', 'Element')}} | {{Spec2('DOM Parsing')}} | Aggiunte le seguenti proprietà: innerHTML , e outerHTML .Aggiunti i seguenti metodi: insertAdjacentHTML() . |
{{SpecName('CSSOM View', '#extensions-to-the-element-interface', 'Element')}} | {{Spec2('CSSOM View')}} | Aggiunte le seguenti proprietà: scrollTop , scrollLeft , scrollWidth , scrollHeight , clientTop , clientLeft , clientWidth , and clientHeight .Aggiunti i seguenti metodi: getClientRects() , getBoundingClientRect() , scroll() , scrollBy() , scrollTo() and scrollIntoView() . |
{{SpecName('Element Traversal', '#ecmascript-bindings', 'Element')}} | {{Spec2('Element Traversal')}} | Aggiunta ereditarietà dell'interfaccia {{DOMxRef("ElementTraversal")}}. |
{{SpecName('DOM WHATWG', '#interface-element', 'Element')}} | {{Spec2('DOM WHATWG')}} | Aggiunti i seguenti metodi: closest() , insertAdjacentElement() and insertAdjacentText() .Spostato hasAttributes() dall'interfaccia Node a questa. |
{{SpecName("DOM4", "#interface-element", "Element")}} | {{Spec2("DOM4")}} | Rimossi i seguenti metodi: setIdAttribute() , setIdAttributeNS() , and setIdAttributeNode() .Modificato il valore di ritorno di getElementsByTagName() e getElementsByTagNameNS() .Rimossa la proprietà schemaTypeInfo . |
{{SpecName('DOM3 Core', 'core.html#ID-745549614', 'Element')}} | {{Spec2('DOM3 Core')}} | Aggiunti i seguenti metodi: setIdAttribute() , setIdAttributeNS() , and setIdAttributeNode() . Questi metodi non sono mai stati implementati e sono stati rimossi nelle specifiche successive.Aggiunta la proprietà schemaTypeInfo . Questa proprietà non è mai stata implementata ed è stata rimossa nelle specifiche successive. |
{{SpecName('DOM2 Core', 'core.html#ID-745549614', 'Element')}} | {{Spec2('DOM2 Core')}} | Il metodo normalize() è stato spostato su {{DOMxRef("Node")}}. |
{{SpecName('DOM1', 'level-one-core.html#ID-745549614', 'Element')}} | {{Spec2('DOM1')}} | Definizione iniziale. |
{{Compat("api.Element")}}