• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdehtml
 

tdehtml

  • tdehtml
  • dom
html_element.cpp
1
22#include "dom/dom_exception.h"
23#include "dom/html_misc.h"
24#include "css/css_base.h"
25#include "html/html_miscimpl.h" // HTMLCollectionImpl
26
27#include "misc/htmlhashes.h"
28
29using namespace DOM;
30
31HTMLElement::HTMLElement() : Element()
32{
33}
34
35HTMLElement::HTMLElement(const HTMLElement &other) : Element(other)
36{
37}
38
39HTMLElement::HTMLElement(HTMLElementImpl *impl) : Element(impl)
40{
41}
42
43HTMLElement &HTMLElement::operator = (const HTMLElement &other)
44{
45 Element::operator = (other);
46 return *this;
47}
48
49HTMLElement &HTMLElement::operator = (const Node &other)
50{
51 NodeImpl* ohandle = other.handle();
52 if (!ohandle || !ohandle->isHTMLElement()) {
53 if (impl) impl->deref();
54 impl = 0;
55 return *this;
56 }
57 Node::operator = (other);
58 return *this;
59}
60
61HTMLElement::~HTMLElement()
62{
63}
64
65DOMString HTMLElement::id() const
66{
67 if(!impl) return DOMString();
68 return ((ElementImpl *)impl)->getAttribute(ATTR_ID);
69}
70
71void HTMLElement::setId( const DOMString &value )
72{
73 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ID, value);
74}
75
76DOMString HTMLElement::title() const
77{
78 if(!impl) return DOMString();
79 return ((ElementImpl *)impl)->getAttribute(ATTR_TITLE);
80}
81
82void HTMLElement::setTitle( const DOMString &value )
83{
84 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_TITLE, value);
85}
86
87DOMString HTMLElement::lang() const
88{
89 if(!impl) return DOMString();
90 return ((ElementImpl *)impl)->getAttribute(ATTR_LANG);
91}
92
93void HTMLElement::setLang( const DOMString &value )
94{
95 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_LANG, value);
96}
97
98DOMString HTMLElement::dir() const
99{
100 if(!impl) return DOMString();
101 return ((ElementImpl *)impl)->getAttribute(ATTR_DIR);
102}
103
104void HTMLElement::setDir( const DOMString &value )
105{
106 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_DIR, value);
107}
108
109DOMString HTMLElement::className() const
110{
111 if(!impl) return DOMString();
112 return ((ElementImpl *)impl)->getAttribute(ATTR_CLASS);
113}
114
115void HTMLElement::setClassName( const DOMString &value )
116{
117 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_CLASS, value);
118}
119
120void HTMLElement::removeCSSProperty( const DOMString &property )
121{
122 int id = getPropertyID(property.string().lower().ascii(), property.length());
123 if(id && impl)
124 static_cast<HTMLElementImpl*>(impl)->removeCSSProperty(id);
125}
126
127void HTMLElement::addCSSProperty( const DOMString &property, const DOMString &value )
128{
129 int id = getPropertyID(property.string().lower().ascii(), property.length());
130 if(id && impl)
131 static_cast<HTMLElementImpl*>(impl)->addCSSProperty(id, value);
132}
133
134DOMString HTMLElement::innerHTML() const
135{
136 if ( !impl ) return DOMString();
137 return ((HTMLElementImpl *)impl)->innerHTML();
138}
139
140void HTMLElement::setInnerHTML( const DOMString &html )
141{
142 if( !impl )
143 return;
144 int exceptioncode = 0;
145 ((HTMLElementImpl *)impl)->setInnerHTML( html, exceptioncode );
146 if ( exceptioncode )
147 throw DOMException( exceptioncode );
148}
149
150DOMString HTMLElement::innerText() const
151{
152 if ( !impl ) return DOMString();
153 return ((HTMLElementImpl *)impl)->innerText();
154}
155
156void HTMLElement::setInnerText( const DOMString &text )
157{
158 if( !impl )
159 return;
160 int exceptioncode = 0;
161 ((HTMLElementImpl *)impl)->setInnerText( text, exceptioncode );
162 if ( exceptioncode )
163 throw DOMException( exceptioncode );
164}
165
166HTMLCollection HTMLElement::children() const
167{
168 if(!impl) return HTMLCollection();
169 return HTMLCollection(impl, HTMLCollectionImpl::NODE_CHILDREN);
170}
171
172HTMLCollection HTMLElement::all() const
173{
174 if(!impl) return HTMLCollection();
175 return HTMLCollection(impl, HTMLCollectionImpl::DOC_ALL /*it's called "doc" but it works from any node */);
176}
177
178void HTMLElement::assignOther( const Node &other, int elementId )
179{
180 if (other.elementId() != static_cast<TQ_UINT32>(elementId)) {
181 if ( impl ) impl->deref();
182 impl = 0;
183 } else {
184 Node::operator = (other);
185 }
186}
DOM::DOMException
DOM operations only raise exceptions in "exceptional" circumstances, i.e., when an operation is impos...
Definition: dom_exception.h:58
DOM::DOMString
This class implements the basic string we use in the DOM.
Definition: dom_string.h:44
DOM::Element
By far the vast majority of objects (apart from text) that authors encounter when traversing a docume...
Definition: dom_element.h:211
DOM::HTMLCollection
An HTMLCollection is a list of nodes.
Definition: html_misc.h:127
DOM::HTMLElement
All HTML element interfaces derive from this class.
Definition: html_element.h:70
DOM::HTMLElement::setLang
void setLang(const DOMString &)
see lang
Definition: html_element.cpp:93
DOM::HTMLElement::id
DOMString id() const
The element's identifier.
Definition: html_element.cpp:65
DOM::HTMLElement::innerText
DOMString innerText() const
The text contained in this element.
Definition: html_element.cpp:150
DOM::HTMLElement::setId
void setId(const DOMString &)
see id
Definition: html_element.cpp:71
DOM::HTMLElement::setInnerHTML
void setInnerHTML(const DOMString &html)
Set the HTML content of this node.
Definition: html_element.cpp:140
DOM::HTMLElement::className
DOMString className() const
The class attribute of the element.
Definition: html_element.cpp:109
DOM::HTMLElement::setClassName
void setClassName(const DOMString &)
see className
Definition: html_element.cpp:115
DOM::HTMLElement::dir
DOMString dir() const
Specifies the base direction of directionally neutral text and the directionality of tables.
Definition: html_element.cpp:98
DOM::HTMLElement::lang
DOMString lang() const
Language code defined in RFC 1766.
Definition: html_element.cpp:87
DOM::HTMLElement::all
HTMLCollection all() const
Retrieves a collection of all nodes that descend from this node.
Definition: html_element.cpp:172
DOM::HTMLElement::setInnerText
void setInnerText(const DOMString &text)
Set the text content of this node.
Definition: html_element.cpp:156
DOM::HTMLElement::title
DOMString title() const
The element's advisory title.
Definition: html_element.cpp:76
DOM::HTMLElement::setTitle
void setTitle(const DOMString &)
see title
Definition: html_element.cpp:82
DOM::HTMLElement::setDir
void setDir(const DOMString &)
see dir
Definition: html_element.cpp:104
DOM::HTMLElement::children
HTMLCollection children() const
Retrieves a collection of nodes that are direct descendants of this node.
Definition: html_element.cpp:166
DOM::HTMLElement::innerHTML
DOMString innerHTML() const
The HTML code contained in this element.
Definition: html_element.cpp:134
DOM::Node
The Node interface is the primary datatype for the entire Document Object Model.
Definition: dom_node.h:275
DOM
The Document Object Model (DOM) is divided into two parts, the COREDOM core DOM, specifying some core...
Definition: design.h:57

tdehtml

Skip menu "tdehtml"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdehtml

Skip menu "tdehtml"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdehtml by doxygen 1.9.4
This website is maintained by Timothy Pearson.