Document#

Document.implementation#

Właściwość implementation zwraca implementację DOM skojarzoną z danym dokumentem. Właściwość jest tylko do odczytu.

Opis działania#

Samo wywołanie i poszczególne jego części najlepiej objaśnić na zapisie składniowym:

  1. —
  2. L
  3. K
  4. T'
  5. T
  6. A
  7. O
  8. Z'
  9. Z
  10. #
var imp_obj = document.implementation;

gdzie poszczególne człony oznaczają:

Obiekt zwracany przez właściwość implementation implementuje interfejs DOMImplementation, dlatego ma dostęp do wszystkich poleceń z tego interfejsu (oraz z kolejnych interfejsów w łańcuchu dziedziczenia).

Prosty przykład:

  1. —
  2. L
  3. K
  4. T'
  5. T
  6. A
  7. O
  8. Z'
  9. Z
  10. #
<script>

	document.write(document.implementation); // [object DOMImplementation]
	document.write("<br>");
	document.write(document.implementation.constructor); // function DOMImplementation() { [native code] }
	document.write("<br>");
	document.write(typeof document.implementation); // object

	document.write("<br><br>");

	document.write(document.implementation.createDocument(null, null, null)); // [object XMLDocument]
	document.write("<br>");
	document.write(document.implementation.createHTMLDocument("test")); // [object HTMLDocument]

</script>

Składnia Web IDL#

  1. —
  2. L
  3. K
  4. T'
  5. T
  6. A
  7. O
  8. Z'
  9. Z
  10. #
interface Document : Node {
	[SameObject] readonly attribute DOMImplementation implementation;
};

Specyfikacje i inne materiały#

Pasek społecznościowy

SPIS TREŚCI AKTUALNEJ STRONY

Document (H1) Document.implementation (H2) Opis działania (H3) Składnia Web IDL (H3) Specyfikacje i inne materiały (H3)