KHtml

dom_doc.cpp
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  */
22 
23 #include "dom/dom_exception.h"
24 #include "dom/dom_xml.h"
25 #include "dom/dom2_range.h"
26 #include "dom/dom2_events.h"
27 #include "dom/dom2_views.h"
28 #include "dom/dom2_traversal.h"
29 #include "dom/html_document.h"
30 #include "html/html_documentimpl.h"
31 
32 #include "xml/dom_docimpl.h"
33 #include "xml/dom_elementimpl.h"
34 
35 #include "khtml_debug.h"
36 
37 namespace DOM
38 {
39 
40 DOMImplementation::DOMImplementation()
41 {
42  impl = nullptr;
43 }
44 
45 DOMImplementation::DOMImplementation(const DOMImplementation &other)
46 {
47  impl = other.impl;
48  if (impl) {
49  impl->ref();
50  }
51 }
52 
53 DOMImplementation::DOMImplementation(DOMImplementationImpl *i)
54 {
55  impl = i;
56  if (impl) {
57  impl->ref();
58  }
59 }
60 
61 DOMImplementation &DOMImplementation::operator = (const DOMImplementation &other)
62 {
63  if (impl != other.impl) {
64  if (impl) {
65  impl->deref();
66  }
67  impl = other.impl;
68  if (impl) {
69  impl->ref();
70  }
71  }
72  return *this;
73 }
74 
75 DOMImplementation::~DOMImplementation()
76 {
77  if (impl) {
78  impl->deref();
79  }
80 }
81 
82 bool DOMImplementation::hasFeature(const DOMString &feature, const DOMString &version)
83 {
84  if (!impl) {
85  return false; // ### enable throw DOMException(DOMException::NOT_FOUND_ERR);
86  }
87 
88  return impl->hasFeature(feature, version);
89 }
90 
92  const DOMString &publicId,
93  const DOMString &systemId)
94 {
95  if (!impl) {
96  throw DOMException(DOMException::NOT_FOUND_ERR);
97  }
98 
99  int exceptioncode = 0;
100  DocumentTypeImpl *r = impl->createDocumentType(qualifiedName, publicId, systemId, exceptioncode);
101  if (exceptioncode) {
102  throw DOMException(exceptioncode);
103  }
104  return r;
105 }
106 
108  const DOMString &qualifiedName,
109  const DocumentType &doctype)
110 {
111  if (!impl) {
112  throw DOMException(DOMException::NOT_FOUND_ERR);
113  }
114 
115  int exceptioncode = 0;
116  DocumentImpl *r = impl->createDocument(namespaceURI, qualifiedName,
117  (DocumentTypeImpl *)doctype.handle(),
118  nullptr, exceptioncode);
119  if (exceptioncode) {
120  throw DOMException(exceptioncode);
121  }
122  return r;
123 }
124 
126 {
127  if (!impl) {
128  throw DOMException(DOMException::NOT_FOUND_ERR);
129  }
130  return static_cast<DOMImplementationImpl *>(impl)->createHTMLDocument(title);
131 }
132 
134 {
135  if (!impl) {
136  throw DOMException(DOMException::NOT_FOUND_ERR);
137  }
138 
139  // This method is a no-op for us.
140  return impl;
141 }
142 
144 {
145  if (!impl) {
146  throw DOMException(DOMException::NOT_FOUND_ERR);
147  }
148 
149  int exceptioncode = 0;
150  CSSStyleSheetImpl *r = impl->createCSSStyleSheet(title.implementation(), media.implementation(),
151  exceptioncode);
152  if (exceptioncode) {
153  throw DOMException(exceptioncode);
154  }
155  return r;
156 }
157 
158 DOMImplementationImpl *DOMImplementation::handle() const
159 {
160  return impl;
161 }
162 
163 bool DOMImplementation::isNull() const
164 {
165  return (impl == nullptr);
166 }
167 
168 // ----------------------------------------------------------------------------
169 
170 Document::Document()
171  : Node()
172 {
173  // we always want an implementation
174  impl = DOMImplementationImpl::createDocument();
175  impl->ref();
176 }
177 
178 Document::Document(bool create)
179  : Node()
180 {
181  if (create) {
182  impl = DOMImplementationImpl::createDocument();
183  impl->ref();
184  } else {
185  impl = nullptr;
186  }
187 // qCDebug(KHTML_LOG) << "Document::Document(bool)";
188 }
189 
190 Document::Document(const Document &other) : Node(other)
191 {
192 // qCDebug(KHTML_LOG) << "Document::Document(Document &)";
193 }
194 
195 Document::Document(DocumentImpl *i) : Node(i)
196 {
197 // qCDebug(KHTML_LOG) << "Document::Document(DocumentImpl)";
198 }
199 
200 Document &Document::operator = (const Node &other)
201 {
202  NodeImpl *ohandle = other.handle();
203  if (impl != ohandle) {
204  if (!ohandle || ohandle->nodeType() != DOCUMENT_NODE) {
205  if (impl) {
206  impl->deref();
207  }
208  impl = nullptr;
209  } else {
210  Node::operator =(other);
211  }
212  }
213  return *this;
214 }
215 
216 Document &Document::operator = (const Document &other)
217 {
218  Node::operator =(other);
219  return *this;
220 }
221 
222 Document::~Document()
223 {
224 // qCDebug(KHTML_LOG) << "Document::~Document\n";
225 }
226 
228 {
229  if (impl) {
230  return ((DocumentImpl *)impl)->doctype();
231  }
232  return nullptr;
233 }
234 
236 {
237  if (impl) {
238  return ((DocumentImpl *)impl)->implementation();
239  }
240  return nullptr;
241 }
242 
244 {
245  if (impl) {
246  return ((DocumentImpl *)impl)->documentElement();
247  }
248  return nullptr;
249 }
250 
252 {
253  if (!impl) {
254  throw DOMException(DOMException::NOT_FOUND_ERR);
255  }
256 
257  int exceptioncode = 0;
258  ElementImpl *r = ((DocumentImpl *)impl)->createElement(tagName, &exceptioncode);
259  if (exceptioncode) {
260  throw DOMException(exceptioncode);
261  }
262  return r;
263 }
264 
265 Element Document::createElementNS(const DOMString &namespaceURI, const DOMString &qualifiedName)
266 {
267  if (!impl) {
268  throw DOMException(DOMException::NOT_FOUND_ERR);
269  }
270 
271  int exceptioncode = 0;
272  ElementImpl *r = ((DocumentImpl *)impl)->createElementNS(namespaceURI, qualifiedName, &exceptioncode);
273  if (exceptioncode) {
274  throw DOMException(exceptioncode);
275  }
276  return r;
277 }
278 
280 {
281  if (impl) {
282  return ((DocumentImpl *)impl)->createDocumentFragment();
283  }
284  return nullptr;
285 }
286 
288 {
289  if (impl) {
290  return ((DocumentImpl *)impl)->createTextNode(data.implementation());
291  }
292  return nullptr;
293 }
294 
296 {
297  if (impl) {
298  return ((DocumentImpl *)impl)->createComment(data.implementation());
299  }
300  return nullptr;
301 }
302 
304 {
305  if (!impl) {
306  return nullptr;
307  }
308  int exceptioncode = 0;
309  CDATASectionImpl *d = ((DocumentImpl *)impl)->createCDATASection(data.implementation(), exceptioncode);
310  if (exceptioncode) {
311  throw DOMException(exceptioncode);
312  }
313  return d;
314 }
315 
317 {
318  if (impl) {
319  return ((DocumentImpl *)impl)->createProcessingInstruction(target, data.implementation());
320  }
321  return nullptr;
322 }
323 
325 {
326  if (!impl) {
327  throw DOMException(DOMException::NOT_FOUND_ERR);
328  }
329  if (name.isNull()) {
330  throw DOMException(DOMException::NOT_FOUND_ERR);
331  }
332  int exceptioncode = 0;
333  AttrImpl *a = impl->document()->createAttribute(name, &exceptioncode);
334  if (exceptioncode) {
335  throw DOMException(exceptioncode);
336  }
337  return a;
338 }
339 
340 Attr Document::createAttributeNS(const DOMString &namespaceURI, const DOMString &qualifiedName)
341 {
342  if (!impl) {
343  throw DOMException(DOMException::NOT_FOUND_ERR);
344  }
345  if (qualifiedName.isNull()) {
346  throw DOMException(DOMException::NAMESPACE_ERR);
347  }
348  int exceptioncode = 0;
349  AttrImpl *a = impl->document()->createAttributeNS(namespaceURI, qualifiedName, &exceptioncode);
350  if (exceptioncode) {
351  throw DOMException(exceptioncode);
352  }
353  return a;
354 }
355 
357 {
358  if (!impl) {
359  return nullptr;
360  }
361  int exceptioncode = 0;
362  EntityReferenceImpl *er = ((DocumentImpl *)impl)->createEntityReference(name, exceptioncode);
363  if (exceptioncode) {
364  throw DOMException(exceptioncode);
365  }
366  return er;
367 }
368 
370 {
371  if (impl) {
372  return ((DocumentImpl *)impl)->getElementById(elementId);
373  }
374  return nullptr;
375 }
376 
378 {
379  if (!impl) {
380  return nullptr;
381  }
382  return impl->getElementsByTagName(tagName);
383 }
384 
385 NodeList Document::getElementsByTagNameNS(const DOMString &namespaceURI, const DOMString &localName)
386 {
387  if (!impl) {
388  return nullptr;
389  }
390  return impl->getElementsByTagNameNS(namespaceURI, localName);
391 }
392 
394 {
395  if (!impl) {
396  return nullptr;
397  }
398  return impl->getElementsByClassName(className);
399 }
400 
401 Node Document::importNode(const Node &importedNode, bool deep)
402 {
403  if (!impl) {
404  throw DOMException(DOMException::INVALID_STATE_ERR);
405  }
406 
407  int exceptioncode = 0;
408  NodeImpl *r = static_cast<DocumentImpl *>(impl)->importNode(importedNode.handle(), deep, exceptioncode);
409  if (exceptioncode) {
410  throw DOMException(exceptioncode);
411  }
412  return r;
413 }
414 
416 {
417  if (impl) {
418  return ((DocumentImpl *)impl)->isHTMLDocument();
419  }
420  return 0;
421 }
422 
424 {
425  if (impl) {
426  return ((DocumentImpl *)impl)->createRange();
427  }
428  return nullptr;
429 }
430 
431 NodeIterator Document::createNodeIterator(Node root, unsigned long whatToShow,
432  NodeFilter filter, bool entityReferenceExpansion)
433 {
434  if (!impl) {
435  throw DOMException(DOMException::INVALID_STATE_ERR);
436  }
437 
438  int exceptioncode = 0;
439  NodeIteratorImpl *r = static_cast<DocumentImpl *>(impl)->createNodeIterator(root.handle(),
440  whatToShow, filter.handle(), entityReferenceExpansion, exceptioncode);
441  if (exceptioncode) {
442  throw DOMException(exceptioncode);
443  }
444  return r;
445 }
446 
447 TreeWalker Document::createTreeWalker(Node root, unsigned long whatToShow, NodeFilter filter,
448  bool entityReferenceExpansion)
449 {
450  if (!impl) {
451  throw DOMException(DOMException::INVALID_STATE_ERR);
452  }
453 
454  int exceptioncode = 0;
455 
456  TreeWalkerImpl *tw = static_cast<DocumentImpl *>(impl)->createTreeWalker(
457  root.handle(), whatToShow, filter.handle(), entityReferenceExpansion, exceptioncode);
458  if (exceptioncode) {
459  throw DOMException(exceptioncode);
460  }
461 
462  return tw;
463 }
464 
466 {
467  if (!impl) {
468  throw DOMException(DOMException::INVALID_STATE_ERR);
469  }
470 
471  int exceptioncode = 0;
472  EventImpl *r = ((DocumentImpl *)impl)->createEvent(eventType, exceptioncode);
473  if (exceptioncode) {
474  throw DOMException(exceptioncode);
475  }
476  return r;
477 }
478 
480 {
481  if (!impl) {
482  throw DOMException(DOMException::INVALID_STATE_ERR);
483  }
484 
485  return static_cast<DocumentImpl *>(impl)->defaultView();
486 }
487 
489 {
490  if (!impl) {
491  throw DOMException(DOMException::INVALID_STATE_ERR);
492  }
493 
494  return static_cast<DocumentImpl *>(impl)->styleSheets();
495 }
496 
498 {
499  if (!impl) {
500  throw DOMException(DOMException::INVALID_STATE_ERR);
501  }
502 
503  return static_cast<DocumentImpl *>(impl)->preferredStylesheetSet();
504 }
505 
506 DOMString Document::selectedStylesheetSet()
507 {
508  if (!impl) {
509  throw DOMException(DOMException::INVALID_STATE_ERR);
510  }
511 
512  return static_cast<DocumentImpl *>(impl)->selectedStylesheetSet();
513 }
514 
515 void Document::setSelectedStylesheetSet(const DOMString &s)
516 {
517  if (!impl) {
518  throw DOMException(DOMException::INVALID_STATE_ERR);
519  }
520 
521  static_cast<DocumentImpl *>(impl)->setSelectedStylesheetSet(s);
522 }
523 
525 {
526  if (!impl) {
527  return nullptr;
528  }
529 
530  return static_cast<DocumentImpl *>(impl)->view();
531 }
532 
534 {
535  if (!impl) {
536  throw DOMException(DOMException::INVALID_STATE_ERR);
537  }
538 
539  CSSStyleDeclarationImpl *r = ((DocumentImpl *)impl)->getOverrideStyle(static_cast<ElementImpl *>(elt.handle()), pseudoElt.implementation());
540  return r;
541 }
542 
543 bool Document::execCommand(const DOMString &command, bool userInterface, const DOMString &value)
544 {
545  if (!impl) {
546  throw DOMException(DOMException::NOT_FOUND_ERR);
547  }
548 
549  return static_cast<DocumentImpl *>(impl)->execCommand(command, userInterface, value);
550 }
551 
552 bool Document::queryCommandEnabled(const DOMString &command)
553 {
554  if (!impl) {
555  throw DOMException(DOMException::NOT_FOUND_ERR);
556  }
557 
558  return static_cast<DocumentImpl *>(impl)->queryCommandEnabled(command);
559 }
560 
561 bool Document::queryCommandIndeterm(const DOMString &command)
562 {
563  if (!impl) {
564  throw DOMException(DOMException::NOT_FOUND_ERR);
565  }
566 
567  return static_cast<DocumentImpl *>(impl)->queryCommandIndeterm(command);
568 }
569 
570 bool Document::queryCommandState(const DOMString &command)
571 {
572  if (!impl) {
573  throw DOMException(DOMException::NOT_FOUND_ERR);
574  }
575 
576  return static_cast<DocumentImpl *>(impl)->queryCommandState(command);
577 }
578 
579 bool Document::queryCommandSupported(const DOMString &command)
580 {
581  if (!impl) {
582  throw DOMException(DOMException::NOT_FOUND_ERR);
583  }
584 
585  return static_cast<DocumentImpl *>(impl)->queryCommandSupported(command);
586 }
587 
588 DOMString Document::queryCommandValue(const DOMString &command)
589 {
590  if (!impl) {
591  throw DOMException(DOMException::NOT_FOUND_ERR);
592  }
593 
594  return static_cast<DocumentImpl *>(impl)->queryCommandValue(command);
595 }
596 
597 bool Document::async() const
598 {
599  if (!impl) {
600  throw DOMException(DOMException::INVALID_STATE_ERR);
601  }
602 
603  return static_cast<DocumentImpl *>(impl)->async();
604 }
605 
606 void Document::setAsync(bool b)
607 {
608  if (!impl) {
609  throw DOMException(DOMException::INVALID_STATE_ERR);
610  }
611 
612  static_cast<DocumentImpl *>(impl)->setAsync(b);
613 }
614 
616 {
617  if (!impl) {
618  throw DOMException(DOMException::INVALID_STATE_ERR);
619  }
620 
621  static_cast<DocumentImpl *>(impl)->abort();
622 }
623 
624 void Document::load(const DOMString &uri)
625 {
626  if (!impl) {
627  throw DOMException(DOMException::INVALID_STATE_ERR);
628  }
629 
630  static_cast<DocumentImpl *>(impl)->load(uri);
631 }
632 
633 void Document::loadXML(const DOMString &source)
634 {
635  if (!impl) {
636  throw DOMException(DOMException::INVALID_STATE_ERR);
637  }
638 
639  static_cast<DocumentImpl *>(impl)->loadXML(source);
640 }
641 
643 {
644  int ec = 0;
645  if (!impl) {
646  throw DOMException(DOMException::NOT_FOUND_ERR);
647  }
648  Element res = impl->querySelector(query, ec).get();
649  if (ec) {
650  throw DOMException(ec);
651  }
652  return res;
653 }
654 
656 {
657  int ec = 0;
658  if (!impl) {
659  throw DOMException(DOMException::NOT_FOUND_ERR);
660  }
661  NodeList res = impl->querySelectorAll(query, ec).get();
662  if (ec) {
663  throw DOMException(ec);
664  }
665  return res;
666 }
667 
669 {
670  if (!impl) {
671  throw DOMException(DOMException::INVALID_STATE_ERR);
672  }
673 
674  return static_cast<DocumentImpl *>(impl)->designMode();
675 }
676 
677 void Document::setDesignMode(bool enable)
678 {
679  if (!impl) {
680  throw DOMException(DOMException::INVALID_STATE_ERR);
681  }
682 
683  static_cast<DocumentImpl *>(impl)->setDesignMode(enable);
684 }
685 
687 {
688  if (!impl) {
689  return url;
690  }
691  return static_cast<DocumentImpl *>(impl)->completeURL(url.string());
692 }
693 
694 DOMString Document::toString() const
695 {
696  if (!impl) {
697  throw DOMException(DOMException::NOT_FOUND_ERR);
698  }
699 
700  return static_cast<DocumentImpl *>(impl)->toString();
701 }
702 
704 {
705  if (!impl) {
706  return;
707  }
708  static_cast<DocumentImpl *>(impl)->updateRendering();
709 }
710 
712 {
713  if (!impl || sheet.isNull()) {
714  throw DOMException(DOMException::INVALID_STATE_ERR);
715  }
716 
717  int exceptioncode;
718  static_cast<DocumentImpl *>(impl)->addStyleSheet(sheet.handle(), &exceptioncode);
719  if (exceptioncode) {
720  throw DOMException(exceptioncode);
721  }
722 }
723 
725 {
726  if (!impl || sheet.isNull()) {
727  throw DOMException(DOMException::INVALID_STATE_ERR);
728  }
729 
730  int exceptioncode;
731  static_cast<DocumentImpl *>(impl)->removeStyleSheet(sheet.handle(), &exceptioncode);
732  if (exceptioncode) {
733  throw DOMException(exceptioncode);
734  }
735 }
736 
737 // ----------------------------------------------------------------------------
738 
739 DocumentFragment::DocumentFragment() : Node()
740 {
741 }
742 
743 DocumentFragment::DocumentFragment(const DocumentFragment &other) : Node(other)
744 {
745 }
746 
747 DocumentFragment &DocumentFragment::operator = (const Node &other)
748 {
749  NodeImpl *ohandle = other.handle();
750  if (impl != ohandle) {
751  if (!ohandle || ohandle->nodeType() != DOCUMENT_FRAGMENT_NODE) {
752  if (impl) {
753  impl->deref();
754  }
755  impl = nullptr;
756  } else {
757  Node::operator =(other);
758  }
759  }
760  return *this;
761 }
762 
763 DocumentFragment &DocumentFragment::operator = (const DocumentFragment &other)
764 {
765  Node::operator =(other);
766  return *this;
767 }
768 
769 DocumentFragment::~DocumentFragment()
770 {
771 }
772 
774 {
775  int ec = 0;
776  if (!impl) {
777  throw DOMException(DOMException::NOT_FOUND_ERR);
778  }
779  Element res = impl->querySelector(query, ec).get();
780  if (ec) {
781  throw DOMException(ec);
782  }
783  return res;
784 }
785 
787 {
788  int ec = 0;
789  if (!impl) {
790  throw DOMException(DOMException::NOT_FOUND_ERR);
791  }
792  NodeList res = impl->querySelectorAll(query, ec).get();
793  if (ec) {
794  throw DOMException(ec);
795  }
796  return res;
797 }
798 
799 DocumentFragment::DocumentFragment(DocumentFragmentImpl *i) : Node(i)
800 {
801 }
802 
803 // ----------------------------------------------------------------------------
804 
805 DocumentType::DocumentType()
806  : Node()
807 {
808 }
809 
810 DocumentType::DocumentType(const DocumentType &other)
811  : Node(other)
812 {
813 }
814 
815 DocumentType::DocumentType(DocumentTypeImpl *impl) : Node(impl)
816 {
817 }
818 
819 DocumentType &DocumentType::operator = (const Node &other)
820 {
821  NodeImpl *ohandle = other.handle();
822  if (impl != ohandle) {
823  if (!ohandle || ohandle->nodeType() != DOCUMENT_TYPE_NODE) {
824  if (impl) {
825  impl->deref();
826  }
827  impl = nullptr;
828  } else {
829  Node::operator =(other);
830  }
831  }
832  return *this;
833 }
834 
835 DocumentType &DocumentType::operator = (const DocumentType &other)
836 {
837  Node::operator =(other);
838  return *this;
839 }
840 
841 DocumentType::~DocumentType()
842 {
843 }
844 
846 {
847  if (!impl) {
848  return DOMString(); // ### enable throw DOMException(DOMException::NOT_FOUND_ERR);
849  }
850 
851  return static_cast<DocumentTypeImpl *>(impl)->name();
852 }
853 
855 {
856  if (!impl) {
857  return nullptr; // ### enable throw DOMException(DOMException::NOT_FOUND_ERR);
858  }
859 
860  return static_cast<DocumentTypeImpl *>(impl)->entities();
861 }
862 
864 {
865  if (!impl) {
866  return nullptr; // ### enable throw DOMException(DOMException::NOT_FOUND_ERR);
867  }
868 
869  return static_cast<DocumentTypeImpl *>(impl)->notations();
870 }
871 
873 {
874  if (!impl) {
875  throw DOMException(DOMException::NOT_FOUND_ERR);
876  }
877 
878  return static_cast<DocumentTypeImpl *>(impl)->publicId();
879 }
880 
882 {
883  if (!impl) {
884  throw DOMException(DOMException::NOT_FOUND_ERR);
885  }
886 
887  return static_cast<DocumentTypeImpl *>(impl)->systemId();
888 }
889 
891 {
892  if (!impl) {
893  throw DOMException(DOMException::NOT_FOUND_ERR);
894  }
895 
896  return static_cast<DocumentTypeImpl *>(impl)->internalSubset();
897 }
898 
899 } // namespace
Element createElementNS(const DOMString &namespaceURI, const DOMString &qualifiedName)
Introduced in DOM Level 2 Creates an element of the given qualified name and namespace URI.
Definition: dom_doc.cpp:265
void setAsync(bool)
Introduced in DOM Level 3 This method is from the DocumentLS interface.
Definition: dom_doc.cpp:606
CDATASection createCDATASection(const DOMString &data)
Creates a CDATASection node whose value is the specified string.
Definition: dom_doc.cpp:303
EntityReference createEntityReference(const DOMString &name)
Creates an EntityReference object.
Definition: dom_doc.cpp:356
TreeWalker objects are used to navigate a document tree or subtree using the view of the document def...
void load(const DOMString &uri)
Introduced in DOM Level 3 This method is from the DocumentLS interface.
Definition: dom_doc.cpp:624
Element querySelector(const DOMString &query) const
Introduced in Selectors Level 1.
Definition: dom_doc.cpp:642
DOMString internalSubset() const
Introduced in DOM Level 2.
Definition: dom_doc.cpp:890
void updateRendering()
not part of the DOM
Definition: dom_doc.cpp:703
StyleSheetList styleSheets() const
Introduced in DOM Level 2 This method is from the DocumentStyle interface.
Definition: dom_doc.cpp:488
Element querySelector(const DOMString &query) const
Introduced in Selectors Level 1.
Definition: dom_doc.cpp:773
DOMImplementation getInterface(const DOMString &feature) const
Introduced in DOM Level 3 This method makes available a DOMImplementation's specialized interface.
Definition: dom_doc.cpp:133
quint32 elementId() const
Definition: dom_node.cpp:509
Introduced in DOM Level 2.
Definition: dom2_events.h:116
The CSSStyleDeclaration interface represents a single CSS declaration block .
Definition: css_value.h:59
Comment createComment(const DOMString &data)
Creates a Comment node given the specified string.
Definition: dom_doc.cpp:295
This represents the content of a comment, i.e., all the characters between the starting ' <!...
Definition: dom_text.h:225
By far the vast majority of objects (apart from text) that authors encounter when traversing a docume...
Definition: dom_element.h:212
Text createTextNode(const DOMString &data)
Creates a Text node given the specified string.
Definition: dom_doc.cpp:287
bool async() const
Introduced in DOM Level 3 This method is from the DocumentLS interface.
Definition: dom_doc.cpp:597
CSSStyleDeclaration getOverrideStyle(const Element &elt, const DOMString &pseudoElt)
Introduced in DOM Level 2 This method is from the DocumentCSS interface.
Definition: dom_doc.cpp:533
void setDesignMode(bool enable)
not part of the official DOM
Definition: dom_doc.cpp:677
The DOMImplementation interface provides a number of methods for performing operations that are indep...
Definition: dom_doc.h:78
This library provides a full-featured HTML parser and widget.
The Attr interface represents an attribute in an Element object.
Definition: dom_element.h:89
NamedNodeMap entities() const
A NamedNodeMap containing the general entities, both external and internal, declared in the DTD.
Definition: dom_doc.cpp:854
bool hasFeature(const DOMString &feature, const DOMString &version)
Test if the DOM implementation implements a specific feature.
Definition: dom_doc.cpp:82
void abort()
Introduced in DOM Level 3 This method is from the DocumentLS interface.
Definition: dom_doc.cpp:615
NodeIterators are used to step through a set of nodes, e.g.
The StyleSheet interface is the abstract base interface for any type of style sheet.
DOMImplementationImpl * handle() const
Definition: dom_doc.cpp:158
KHTMLView * view() const
Definition: dom_doc.cpp:524
NodeList querySelectorAll(const DOMString &query) const
Introduced in Selectors Level 1.
Definition: dom_doc.cpp:786
DOMString systemId() const
Introduced in DOM Level 2.
Definition: dom_doc.cpp:881
Renders and displays HTML in a QScrollArea.
Definition: khtmlview.h:97
DOMString publicId() const
Introduced in DOM Level 2.
Definition: dom_doc.cpp:872
An HTMLDocument is the root of the HTML hierarchy and holds the entire content.
Definition: html_document.h:74
Element documentElement() const
This is a convenience attribute that allows direct access to the child node that is the root element ...
Definition: dom_doc.cpp:243
The Text interface represents the textual content (termed character data in XML) of an Element or At...
Definition: dom_text.h:273
DOMImplementation implementation() const
The DOMImplementation object that handles this document.
Definition: dom_doc.cpp:235
DOM operations only raise exceptions in "exceptional" circumstances, i.e., when an operation is impos...
Definition: dom_exception.h:58
DOMString namespaceURI() const
Introduced in DOM Level 2.
Definition: dom_node.cpp:405
The Document interface represents the entire HTML or XML document.
Definition: dom_doc.h:246
The StyleSheetList interface provides the abstraction of an ordered collection of style sheets.
bool designMode() const
not part of the official DOM
Definition: dom_doc.cpp:668
bool isHTMLDocument() const
Definition: dom_doc.cpp:415
void removeStyleSheet(const StyleSheet &sheet)
Removes a style sheet to the list of style sheets.
Definition: dom_doc.cpp:724
AbstractView defaultView() const
Introduced in DOM Level 2 This method is from the DocumentView interface.
Definition: dom_doc.cpp:479
Node importNode(const Node &importedNode, bool deep)
Introduced in DOM Level 2.
Definition: dom_doc.cpp:401
Element getElementById(const DOMString &elementId) const
Moved from HTMLDocument in DOM Level 2 Returns the Element whose id is given by elementId.
Definition: dom_doc.cpp:369
void addStyleSheet(const StyleSheet &sheet)
Adds a new style sheet to the list of style sheets.
Definition: dom_doc.cpp:711
DocumentType doctype() const
The Document Type Declaration (see DocumentType ) associated with this document.
Definition: dom_doc.cpp:227
NodeList getElementsByTagName(const DOMString &tagname)
No Exceptions.
Definition: dom_doc.cpp:377
DocumentType createDocumentType(const DOMString &qualifiedName, const DOMString &publicId, const DOMString &systemId)
Introduced in DOM Level 2.
Definition: dom_doc.cpp:91
TreeWalker createTreeWalker(Node root, unsigned long whatToShow, NodeFilter filter, bool entityReferenceExpansion)
Introduced in DOM Level 2 This method is from the DocumentTraversal interface.
Definition: dom_doc.cpp:447
CDATA sections are used to escape blocks of text containing characters that would otherwise be regard...
Definition: dom_xml.h:65
Element createElement(const DOMString &tagName)
Creates an element of the type specified.
Definition: dom_doc.cpp:251
DOMString completeURL(const DOMString &url)
not part of the DOM
Definition: dom_doc.cpp:686
bool execCommand(const DOMString &command, bool userInterface, const DOMString &value)
not part of the DOM
Definition: dom_doc.cpp:543
NodeIterator createNodeIterator(Node root, unsigned long whatToShow, NodeFilter filter, bool entityReferenceExpansion)
Introduced in DOM Level 2 This method is from the DocumentTraversal interface.
Definition: dom_doc.cpp:431
Range createRange()
Introduced in DOM Level 2 This method is from the DocumentRange interface.
Definition: dom_doc.cpp:423
DocumentFragment is a "lightweight" or "minimal" Document object.
Definition: dom_doc.h:1042
The ProcessingInstruction interface represents a "processing instruction", used in XML as a way to ke...
Definition: dom_xml.h:264
The CSSStyleSheet interface is a concrete interface used to represent a CSS style sheet i....
This class implements the basic string we use in the DOM.
Definition: dom_string.h:44
DOMString localName() const
Introduced in DOM Level 2.
Definition: dom_node.cpp:433
Document createDocument(const DOMString &namespaceURI, const DOMString &qualifiedName, const DocumentType &doctype)
Introduced in DOM Level 2.
Definition: dom_doc.cpp:107
NamedNodeMap notations() const
A NamedNodeMap containing the notations declared in the DTD.
Definition: dom_doc.cpp:863
void loadXML(const DOMString &source)
Introduced in DOM Level 3 This method is from the DocumentLS interface.
Definition: dom_doc.cpp:633
NodeList getElementsByTagNameNS(const DOMString &namespaceURI, const DOMString &localName)
Introduced in DOM Level 2 No Exceptions.
Definition: dom_doc.cpp:385
Attr createAttributeNS(const DOMString &namespaceURI, const DOMString &qualifiedName)
Introduced in DOM Level 2 Creates an attribute of the given qualified name and namespace URI.
Definition: dom_doc.cpp:340
ProcessingInstruction createProcessingInstruction(const DOMString &target, const DOMString &data)
Creates a ProcessingInstruction node given the specified name and data strings.
Definition: dom_doc.cpp:316
HTMLDocument createHTMLDocument(const DOMString &title)
Introduced in DOM Level 2 This method is from the HTMLDOMImplementation interface.
Definition: dom_doc.cpp:125
The NodeList interface provides the abstraction of an ordered collection of nodes,...
Definition: dom_node.h:976
CSSStyleSheet createCSSStyleSheet(const DOMString &title, const DOMString &media)
Introduced in DOM Level 2 This method is from the DOMImplementationCSS interface.
Definition: dom_doc.cpp:143
Attr createAttribute(const DOMString &name)
Creates an Attr of the given name.
Definition: dom_doc.cpp:324
Objects implementing the NamedNodeMap interface are used to represent collections of nodes that can b...
Definition: dom_node.h:64
The Node interface is the primary datatype for the entire Document Object Model.
Definition: dom_node.h:278
NodeImpl * handle() const
Definition: dom_node.h:936
NodeList getElementsByClassName(const DOMString &className)
Introduced in HTML 5.
Definition: dom_doc.cpp:393
Filters are objects that know how to "filter out" nodes.
NodeList querySelectorAll(const DOMString &query) const
Introduced in Selectors Level 1.
Definition: dom_doc.cpp:655
DOMString preferredStylesheetSet()
CSS3 mechanism for selecting alternate stylesheets using the DOM.
Definition: dom_doc.cpp:497
DOMString name() const
The name of DTD; i.e., the name immediately following the DOCTYPE keyword.
Definition: dom_doc.cpp:845
Event createEvent(const DOMString &eventType)
Introduced in DOM Level 2 This method is from the DocumentEvent interface.
Definition: dom_doc.cpp:465
DocumentFragment createDocumentFragment()
Creates an empty DocumentFragment object.
Definition: dom_doc.cpp:279
DOMStringImpl * implementation() const
Definition: dom_string.h:145
Introduced in DOM Level 2.
Definition: dom2_views.h:42
EntityReference objects may be inserted into the structure model when an entity reference is in the s...
Definition: dom_xml.h:190
Each Document has a doctype attribute whose value is either null or a DocumentType object.
Definition: dom_doc.h:1102
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Wed Sep 27 2023 04:05:41 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.