KHtml

html_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 HTML_ELEMENT_H
30 #define HTML_ELEMENT_H
31 
32 #include <khtml_export.h>
33 #include <dom/dom_element.h>
34 
35 class KHTMLView;
36 
37 namespace DOM
38 {
39 
40 class HTMLElementImpl;
41 class DOMString;
42 class Element;
43 class HTMLCollection;
44 
45 /**
46  * All HTML element interfaces derive from this class. Elements that
47  * only expose the HTML core attributes are represented by the base
48  * \c HTMLElement interface. These elements are as
49  * follows:
50  *
51  * \li \c HEAD
52  *
53  * \li special: <tt> SUB, SUP, SPAN, BDO </tt>
54  *
55  * \li font: <tt> TT, I, B, U, S, STRIKE, BIG, SMALL </tt>
56  *
57  * \li phrase: <tt> EM, STRONG, DFN, CODE, SAMP, KBD, VAR,
58  * CITE, ACRONYM, ABBR</tt>
59  *
60  * \li list: <tt> DD, DT </tt>
61  *
62  * \li <tt> NOFRAMES, NOSCRIPT </tt>
63  *
64  * \li <tt> ADDRESS, CENTER </tt>
65  *
66  * Note: The \c style attribute for this
67  * interface is reserved for future usage.
68  *
69  */
70 class KHTML_EXPORT HTMLElement : public Element
71 {
72  friend class HTMLDocument;
73  friend class ::KHTMLView;
74  friend class HTMLTableElement;
75  friend class HTMLTableRowElement;
76  friend class HTMLTableSectionElement;
77 
78 public:
79  HTMLElement();
80  HTMLElement(const HTMLElement &other);
81  HTMLElement(const Node &other) : Element()
82  {
83  (*this) = other;
84  }
85 
86 protected:
87  HTMLElement(HTMLElementImpl *impl);
88 public:
89 
90  HTMLElement &operator = (const HTMLElement &other);
91  HTMLElement &operator = (const Node &other);
92 
93  ~HTMLElement();
94 
95  /**
96  * The element's identifier. See the <a
97  * href="https://www.w3.org/TR/REC-html40/struct/global.html#adef-id">
98  * id attribute definition </a> in HTML 4.0.
99  *
100  */
101  DOMString id() const;
102 
103  /**
104  * see id
105  */
106  void setId(const DOMString &);
107 
108  /**
109  * The element's advisory title. See the <a
110  * href="https://www.w3.org/TR/REC-html40/struct/global.html#adef-title">
111  * title attribute definition </a> in HTML 4.0.
112  *
113  */
114  DOMString title() const;
115 
116  /**
117  * see title
118  */
119  void setTitle(const DOMString &);
120 
121  /**
122  * Language code defined in RFC 1766. See the <a
123  * href="https://www.w3.org/TR/REC-html40/struct/dirlang.html#adef-lang">
124  * lang attribute definition </a> in HTML 4.0.
125  *
126  */
127  DOMString lang() const;
128 
129  /**
130  * see lang
131  */
132  void setLang(const DOMString &);
133 
134  /**
135  * Specifies the base direction of directionally neutral text and
136  * the directionality of tables. See the <a
137  * href="https://www.w3.org/TR/REC-html40/struct/dirlang.html#adef-dir">
138  * dir attribute definition </a> in HTML 4.0.
139  *
140  */
141  DOMString dir() const;
142 
143  /**
144  * see dir
145  */
146  void setDir(const DOMString &);
147 
148  /**
149  * The class attribute of the element. This attribute has been
150  * renamed due to conflicts with the "class" keyword exposed by
151  * many languages. See the <a
152  * href="https://www.w3.org/TR/REC-html40/struct/global.html#adef-class">
153  * class attribute definition </a> in HTML 4.0.
154  *
155  */
156  DOMString className() const;
157 
158  /**
159  * see className
160  */
161  void setClassName(const DOMString &);
162 
163  /**
164  * The HTML code contained in this element.
165  * This function is not part of the DOM specifications as defined by the w3c.
166  */
167  DOMString innerHTML() const;
168 
169  /**
170  * Set the HTML content of this node.
171  *
172  * @exception DOMException
173  * NO_MODIFICATION_ALLOWED_ERR: Raised if there is the element does not allow
174  * children.
175  */
176  void setInnerHTML(const DOMString &html);
177 
178  /**
179  * The text contained in this element.
180  * This function is not part of the DOM specifications as defined by the w3c.
181  */
182  DOMString innerText() const;
183 
184  /**
185  * Set the text content of this node.
186  *
187  * @exception DOMException
188  * NO_MODIFICATION_ALLOWED_ERR: Raised if there is the element does not allow
189  * children.
190  */
191  void setInnerText(const DOMString &text);
192 
193  /**
194  * Retrieves a collection of nodes that are direct descendants of this node.
195  * IE-specific extension.
196  */
197  HTMLCollection children() const;
198 
199  /**
200  * Retrieves a collection of all nodes that descend from this node.
201  * IE-specific extension.
202  */
203  HTMLCollection all() const;
204 
205  /**
206  * Returns whether this element is editable.
207  *
208  * This function is not part of the DOM specifications as defined by the w3c.
209  */
210  bool isContentEditable() const;
211 
212  /**
213  * Returns the kind of editability that applies to this element.
214  *
215  * The returned string is one of:
216  * \li true: This element has been set to be editable.
217  * \li false: This element has been set not to be editable.
218  * \li inherit: This element inherits its editability from the parent.
219  *
220  * This function is not part of the DOM specifications as defined by the w3c.
221  */
222  DOMString contentEditable() const;
223 
224  /**
225  * Sets the editability of this element.
226  *
227  * This function is not part of the DOM specifications as defined by the w3c.
228  * @param enabled may be one of:
229  * \li true: make element editable
230  * \li false: make element not editable
231  * \li inherit: make element inherit editability from parent.
232  */
233  void setContentEditable(const DOMString &enabled);
234 
235  /*
236  * @internal
237  */
238  void removeCSSProperty(const DOMString &property);
239 
240  /*
241  * @internal
242  */
243  void addCSSProperty(const DOMString &property, const DOMString &value);
244 
245 protected:
246  /*
247  * @internal
248  */
249  void assignOther(const Node &other, int elementId);
250 };
251 
252 } //namespace
253 
254 #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 THEAD , TFOOT , and TBODY elements.
Definition: html_table.h:906
Renders and displays HTML in a QScrollArea.
Definition: khtmlview.h:97
An HTMLCollection is a list of nodes.
Definition: html_misc.h:133
By far the vast majority of objects (apart from text) that authors encounter when traversing a docume...
Definition: dom_element.h:212
This class implements the basic string we use in the DOM.
Definition: dom_string.h:44
This library provides a full-featured HTML parser and widget.
A row in a table.
Definition: html_table.h:734
The create* and delete* methods on the table allow authors to construct and modify tables...
Definition: html_table.h:448
All HTML element interfaces derive from this class.
Definition: html_element.h:70
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Tue Mar 2 2021 23:43:26 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.