• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

KHTML

html_element.cpp

Go to the documentation of this file.
00001 
00022 #include "dom/dom_exception.h"
00023 #include "dom/html_misc.h"
00024 #include "css/css_base.h"
00025 #include "html/html_miscimpl.h" // HTMLCollectionImpl
00026 
00027 #include "misc/htmlhashes.h"
00028 
00029 using namespace DOM;
00030 
00031 HTMLElement::HTMLElement() : Element()
00032 {
00033 }
00034 
00035 HTMLElement::HTMLElement(const HTMLElement &other) : Element(other)
00036 {
00037 }
00038 
00039 HTMLElement::HTMLElement(HTMLElementImpl *impl) : Element(impl)
00040 {
00041 }
00042 
00043 HTMLElement &HTMLElement::operator = (const HTMLElement &other)
00044 {
00045     Element::operator = (other);
00046     return *this;
00047 }
00048 
00049 HTMLElement &HTMLElement::operator = (const Node &other)
00050 {
00051     NodeImpl* ohandle = other.handle();
00052     if (!ohandle || !ohandle->isHTMLElement()) {
00053         if (impl) impl->deref();
00054     impl = 0;
00055     return *this;
00056     }
00057     Node::operator = (other);
00058     return *this;
00059 }
00060 
00061 HTMLElement::~HTMLElement()
00062 {
00063 }
00064 
00065 DOMString HTMLElement::id() const
00066 {
00067     if(!impl) return DOMString();
00068     return ((ElementImpl *)impl)->getAttribute(ATTR_ID);
00069 }
00070 
00071 void HTMLElement::setId( const DOMString &value )
00072 {
00073     if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ID, value);
00074 }
00075 
00076 DOMString HTMLElement::title() const
00077 {
00078     if(!impl) return DOMString();
00079     return ((ElementImpl *)impl)->getAttribute(ATTR_TITLE);
00080 }
00081 
00082 void HTMLElement::setTitle( const DOMString &value )
00083 {
00084     if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_TITLE, value);
00085 }
00086 
00087 DOMString HTMLElement::lang() const
00088 {
00089     if(!impl) return DOMString();
00090     return ((ElementImpl *)impl)->getAttribute(ATTR_LANG);
00091 }
00092 
00093 void HTMLElement::setLang( const DOMString &value )
00094 {
00095     if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_LANG, value);
00096 }
00097 
00098 DOMString HTMLElement::dir() const
00099 {
00100     if(!impl) return DOMString();
00101     return ((ElementImpl *)impl)->getAttribute(ATTR_DIR);
00102 }
00103 
00104 void HTMLElement::setDir( const DOMString &value )
00105 {
00106     if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_DIR, value);
00107 }
00108 
00109 DOMString HTMLElement::className() const
00110 {
00111     if(!impl) return DOMString();
00112     return ((ElementImpl *)impl)->getAttribute(ATTR_CLASS);
00113 }
00114 
00115 void HTMLElement::setClassName( const DOMString &value )
00116 {
00117     if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_CLASS, value);
00118 }
00119 
00120 void HTMLElement::removeCSSProperty( const DOMString &property )
00121 {
00122     int id = getPropertyID(property.string().lower().ascii(), property.length());
00123     if(id && impl)
00124         static_cast<HTMLElementImpl*>(impl)->removeCSSProperty(id);
00125 }
00126 
00127 void HTMLElement::addCSSProperty( const DOMString &property, const DOMString &value )
00128 {
00129     int id = getPropertyID(property.string().lower().ascii(), property.length());
00130     if(id && impl)
00131         static_cast<HTMLElementImpl*>(impl)->addCSSProperty(id, value);
00132 }
00133 
00134 DOMString HTMLElement::innerHTML() const
00135 {
00136     if ( !impl ) return DOMString();
00137     return ((HTMLElementImpl *)impl)->innerHTML();
00138 }
00139 
00140 void HTMLElement::setInnerHTML( const DOMString &html )
00141 {
00142     if( !impl )
00143         return;
00144     int exceptioncode = 0;
00145     ((HTMLElementImpl *)impl)->setInnerHTML( html, exceptioncode );
00146     if ( exceptioncode )
00147         throw DOMException( exceptioncode );
00148 }
00149 
00150 DOMString HTMLElement::innerText() const
00151 {
00152     if ( !impl ) return DOMString();
00153     return ((HTMLElementImpl *)impl)->innerText();
00154 }
00155 
00156 void HTMLElement::setInnerText( const DOMString &text )
00157 {
00158     if( !impl )
00159         return;
00160     int exceptioncode = 0;
00161     ((HTMLElementImpl *)impl)->setInnerText( text, exceptioncode );
00162     if ( exceptioncode )
00163     throw DOMException( exceptioncode );
00164 }
00165 
00166 HTMLCollection HTMLElement::children() const
00167 {
00168     if(!impl) return HTMLCollection();
00169     return HTMLCollection(impl, HTMLCollectionImpl::NODE_CHILDREN);
00170 }
00171 
00172 HTMLCollection HTMLElement::all() const
00173 {
00174     if(!impl) return HTMLCollection();
00175     return HTMLCollection(impl, HTMLCollectionImpl::DOC_ALL /*it's called "doc" but it works from any node */);
00176 }
00177 
00178 void HTMLElement::assignOther( const Node &other, int elementId )
00179 {
00180     if (other.elementId() != static_cast<Q_UINT32>(elementId)) {
00181     if ( impl ) impl->deref();
00182     impl = 0;
00183     } else {
00184     Node::operator = (other);
00185     }
00186 }

KHTML

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

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal