KHTML
dom_element.h
Go to the documentation of this file.
00001 /* 00002 * This file is part of the DOM implementation for KDE. 00003 * 00004 * Copyright 1999 Lars Knoll (knoll@kde.org) 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Library General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Library General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Library General Public License 00017 * along with this library; see the file COPYING.LIB. If not, write to 00018 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 * Boston, MA 02110-1301, USA. 00020 * 00021 * This file includes excerpts from the Document Object Model (DOM) 00022 * Level 1 Specification (Recommendation) 00023 * http://www.w3.org/TR/REC-DOM-Level-1/ 00024 * Copyright © World Wide Web Consortium , (Massachusetts Institute of 00025 * Technology , Institut National de Recherche en Informatique et en 00026 * Automatique , Keio University ). All Rights Reserved. 00027 * 00028 */ 00029 #ifndef _DOM_ELEMENT_h_ 00030 #define _DOM_ELEMENT_h_ 00031 00032 #include <khtml_export.h> 00033 #include <dom/dom_node.h> 00034 #include <dom/css_value.h> 00035 00036 namespace DOM { 00037 00038 class DOMString; 00039 class AttrImpl; 00040 class Element; 00041 class ElementImpl; 00042 class NamedAttrMapImpl; 00043 class DocumentImpl; 00044 00088 class KHTML_EXPORT Attr : public Node 00089 { 00090 friend class Element; 00091 friend class Document; 00092 friend class DocumentImpl; 00093 friend class HTMLDocument; 00094 friend class ElementImpl; 00095 friend class NamedAttrMapImpl; 00096 friend class AttrImpl; 00097 00098 public: 00099 Attr(); 00100 Attr(const Node &other) : Node() 00101 {(*this)=other;} 00102 Attr(const Attr &other); 00103 00104 Attr & operator = (const Node &other); 00105 Attr & operator = (const Attr &other); 00106 00107 ~Attr(); 00108 00113 DOMString name() const; 00114 00146 bool specified() const; 00147 00157 DOMString value() const; 00158 00162 void setValue( const DOMString & ); 00163 00170 Element ownerElement() const; 00171 00172 protected: 00173 00174 Attr( AttrImpl *_impl ); 00175 }; 00176 00177 class NodeList; 00178 class Attr; 00179 class DOMString; 00180 00209 class KHTML_EXPORT Element : public Node 00210 { 00211 friend class Document; 00212 friend class DocumentFragment; 00213 friend class HTMLDocument; 00214 // friend class AttrImpl; 00215 friend class Attr; 00216 00217 public: 00218 Element(); 00219 Element(const Node &other) : Node() 00220 {(*this)=other;} 00221 Element(const Element &other); 00222 00223 Element & operator = (const Node &other); 00224 Element & operator = (const Element &other); 00225 00226 ~Element(); 00227 00238 DOMString tagName() const; 00239 00250 DOMString getAttribute ( const DOMString &name ); 00251 00279 void setAttribute ( const DOMString &name, const DOMString &value ); 00280 00293 void removeAttribute ( const DOMString &name ); 00294 00305 Attr getAttributeNode ( const DOMString &name ); 00306 00332 Attr setAttributeNode ( const Attr &newAttr ); 00333 00350 Attr removeAttributeNode ( const Attr &oldAttr ); 00351 00364 NodeList getElementsByTagName ( const DOMString &name ); 00365 00380 NodeList getElementsByTagNameNS ( const DOMString &namespaceURI, 00381 const DOMString &localName ); 00382 00400 NodeList getElementsByClassName ( const DOMString &className ); 00401 00417 DOMString getAttributeNS ( const DOMString &namespaceURI, 00418 const DOMString &localName ); 00419 00458 void setAttributeNS ( const DOMString &namespaceURI, 00459 const DOMString &qualifiedName, 00460 const DOMString &value ); 00461 00479 void removeAttributeNS ( const DOMString &namespaceURI, 00480 const DOMString &localName ); 00481 00495 Attr getAttributeNodeNS ( const DOMString &namespaceURI, 00496 const DOMString &localName ); 00497 00523 Attr setAttributeNodeNS ( const Attr &newAttr ); 00524 00535 bool hasAttribute( const DOMString& name ); 00536 00551 bool hasAttributeNS ( const DOMString &namespaceURI, 00552 const DOMString &localName ); 00553 00560 CSSStyleDeclaration style ( ); 00561 00569 Element firstElementChild ( ) const; 00570 00578 Element lastElementChild ( ) const; 00579 00588 Element previousElementSibling ( ) const; 00589 00598 Element nextElementSibling ( ) const; 00599 00607 unsigned long childElementCount ( ) const; 00608 00617 Element querySelector(const DOMString& query) const; 00618 00629 NodeList querySelectorAll(const DOMString& query) const; 00630 00642 bool contentEditable() const; 00643 00659 void setContentEditable(bool enabled); 00660 00665 bool isHTMLElement() const; 00666 00673 Element form() const; 00674 00675 static bool khtmlValidAttrName(const DOMString &name); 00676 static bool khtmlValidPrefix(const DOMString &name); 00677 static bool khtmlValidQualifiedName(const DOMString &name); 00678 00679 static bool khtmlMalformedQualifiedName(const DOMString &name); 00680 static bool khtmlMalformedPrefix(const DOMString &name); 00681 protected: 00682 Element(ElementImpl *_impl); 00683 }; 00684 00685 } //namespace 00686 #endif
KDE 4.6 API Reference