KHtml

dom_element.h
1 /*
2  * This file is part of the DOM implementation for KDE.
3  *
4  * Copyright 1999 Lars Knoll ([email protected])
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public License
17  * along with this library; see the file COPYING.LIB. If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  *
21  * This file includes excerpts from the Document Object Model (DOM)
22  * Level 1 Specification (Recommendation)
23  * https://www.w3.org/TR/REC-DOM-Level-1/
24  * Copyright © World Wide Web Consortium , (Massachusetts Institute of
25  * Technology , Institut National de Recherche en Informatique et en
26  * Automatique , Keio University ). All Rights Reserved.
27  *
28  */
29 #ifndef _DOM_ELEMENT_h_
30 #define _DOM_ELEMENT_h_
31 
32 #include <khtml_export.h>
33 #include <dom/dom_node.h>
34 #include <dom/css_value.h>
35 
36 namespace DOM
37 {
38 
39 class DOMString;
40 class AttrImpl;
41 class Element;
42 class ElementImpl;
43 class NamedAttrMapImpl;
44 class DocumentImpl;
45 
89 class KHTML_EXPORT Attr : public Node
90 {
91  friend class Element;
92  friend class Document;
93  friend class DocumentImpl;
94  friend class HTMLDocument;
95  friend class ElementImpl;
96  friend class NamedAttrMapImpl;
97  friend class AttrImpl;
98 
99 public:
100  Attr();
101  Attr(const Node &other) : Node()
102  {
103  (*this) = other;
104  }
105  Attr(const Attr &other);
106 
107  Attr &operator = (const Node &other);
108  Attr &operator = (const Attr &other);
109 
110  ~Attr();
111 
116  DOMString name() const;
117 
149  bool specified() const;
150 
160  DOMString value() const;
161 
165  void setValue(const DOMString &);
166 
173  Element ownerElement() const;
174 
175 protected:
176 
177  Attr(AttrImpl *_impl);
178 };
179 
180 class NodeList;
181 class Attr;
182 class DOMString;
183 
212 class KHTML_EXPORT Element : public Node
213 {
214  friend class Document;
215  friend class DocumentFragment;
216  friend class HTMLDocument;
217 // friend class AttrImpl;
218  friend class Attr;
219 
220 public:
221  Element();
222  Element(const Node &other) : Node()
223  {
224  (*this) = other;
225  }
226  Element(const Element &other);
227 
228  Element &operator = (const Node &other);
229  Element &operator = (const Element &other);
230 
231  ~Element();
232 
243  DOMString tagName() const;
244 
255  DOMString getAttribute(const DOMString &name);
256 
284  void setAttribute(const DOMString &name, const DOMString &value);
285 
298  void removeAttribute(const DOMString &name);
299 
310  Attr getAttributeNode(const DOMString &name);
311 
337  Attr setAttributeNode(const Attr &newAttr);
338 
355  Attr removeAttributeNode(const Attr &oldAttr);
356 
369  NodeList getElementsByTagName(const DOMString &name);
370 
385  NodeList getElementsByTagNameNS(const DOMString &namespaceURI,
386  const DOMString &localName);
387 
405  NodeList getElementsByClassName(const DOMString &className);
406 
422  DOMString getAttributeNS(const DOMString &namespaceURI,
423  const DOMString &localName);
424 
463  void setAttributeNS(const DOMString &namespaceURI,
464  const DOMString &qualifiedName,
465  const DOMString &value);
466 
484  void removeAttributeNS(const DOMString &namespaceURI,
485  const DOMString &localName);
486 
500  Attr getAttributeNodeNS(const DOMString &namespaceURI,
501  const DOMString &localName);
502 
528  Attr setAttributeNodeNS(const Attr &newAttr);
529 
540  bool hasAttribute(const DOMString &name);
541 
556  bool hasAttributeNS(const DOMString &namespaceURI,
557  const DOMString &localName);
558 
565  CSSStyleDeclaration style();
566 
574  Element firstElementChild() const;
575 
583  Element lastElementChild() const;
584 
593  Element previousElementSibling() const;
594 
603  Element nextElementSibling() const;
604 
612  unsigned long childElementCount() const;
613 
622  Element querySelector(const DOMString &query) const;
623 
634  NodeList querySelectorAll(const DOMString &query) const;
635 
647  bool contentEditable() const;
648 
664  void setContentEditable(bool enabled);
665 
670  bool isHTMLElement() const;
671 
678  Element form() const;
679 
680  static bool khtmlValidAttrName(const DOMString &name);
681  static bool khtmlValidPrefix(const DOMString &name);
682  static bool khtmlValidQualifiedName(const DOMString &name);
683 
684  static bool khtmlMalformedQualifiedName(const DOMString &name);
685  static bool khtmlMalformedPrefix(const DOMString &name);
686 protected:
687  Element(ElementImpl *_impl);
688 };
689 
690 } //namespace
691 #endif
The Node interface is the primary datatype for the entire Document Object Model.
Definition: dom_node.h:278
An HTMLDocument is the root of the HTML hierarchy and holds the entire content.
Definition: html_document.h:74
The CSSStyleDeclaration interface represents a single CSS declaration block .
Definition: css_value.h:59
DocumentFragment is a "lightweight" or "minimal" Document object.
Definition: dom_doc.h:1042
By far the vast majority of objects (apart from text) that authors encounter when traversing a docume...
Definition: dom_element.h:212
The Attr interface represents an attribute in an Element object.
Definition: dom_element.h:89
This class implements the basic string we use in the DOM.
Definition: dom_string.h:44
The Document interface represents the entire HTML or XML document.
Definition: dom_doc.h:246
The NodeList interface provides the abstraction of an ordered collection of nodes, without defining or constraining how this collection is implemented.
Definition: dom_node.h:976
This library provides a full-featured HTML parser and widget.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat Jul 4 2020 22:46:18 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.