From a6ab03dcb4c97ec152b79f7806f28ab239533b96 Mon Sep 17 00:00:00 2001 From: Hepheir Date: Mon, 31 May 2021 19:45:09 +0900 Subject: [PATCH 1/4] Create DOMImplementation.py --- w3/python/core/fundamental_interface/DOMImplementation.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 w3/python/core/fundamental_interface/DOMImplementation.py diff --git a/w3/python/core/fundamental_interface/DOMImplementation.py b/w3/python/core/fundamental_interface/DOMImplementation.py new file mode 100644 index 0000000..e69de29 From fc13453628a12fce8a04efdf7f60ac9767fa4da7 Mon Sep 17 00:00:00 2001 From: Hepheir Date: Mon, 31 May 2021 19:45:57 +0900 Subject: [PATCH 2/4] Create interface `DOMImplementation` --- w3/python/core/fundamental_interface/DOMImplementation.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/w3/python/core/fundamental_interface/DOMImplementation.py b/w3/python/core/fundamental_interface/DOMImplementation.py index e69de29..6e73f13 100644 --- a/w3/python/core/fundamental_interface/DOMImplementation.py +++ b/w3/python/core/fundamental_interface/DOMImplementation.py @@ -0,0 +1,8 @@ +class DOMImplementation: + """Interface DOMImplementation + + The `DOMImplementation` interface provides a number of methods for performing operations that are independent of any particular instance of the document object model. + + The DOM Level 1 does not specify a way of creating a document instance, and hence document creation is an operation specific to an implementation. Future Levels of the DOM specification are expected to provide methods for creating documents directly. + """ + pass From a1f2bcc8b942640f19826fde54e5dc52cde571b4 Mon Sep 17 00:00:00 2001 From: Hepheir Date: Mon, 31 May 2021 19:47:36 +0900 Subject: [PATCH 3/4] Create `has_feature` method but not fully implemented --- .../DOMImplementation.py | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/w3/python/core/fundamental_interface/DOMImplementation.py b/w3/python/core/fundamental_interface/DOMImplementation.py index 6e73f13..906763c 100644 --- a/w3/python/core/fundamental_interface/DOMImplementation.py +++ b/w3/python/core/fundamental_interface/DOMImplementation.py @@ -1,3 +1,8 @@ +from __future__ import absolute_import + +from w3.python.core.type import DOMString + + class DOMImplementation: """Interface DOMImplementation @@ -5,4 +10,21 @@ class DOMImplementation: The DOM Level 1 does not specify a way of creating a document instance, and hence document creation is an operation specific to an implementation. Future Levels of the DOM specification are expected to provide methods for creating documents directly. """ - pass + + # TODO + def has_feature(self, + feature: DOMString, + version: DOMString) -> bool: + """ + Test if the DOM implementation implements a specific feature. + + Args: + feature: The package name of the feature to test. In Level 1, the legal values are "HTML" and "XML" (case-insensitive). + version: This is the version number of the package name to test. In Level 1, this is the string "1.0". If the version is not specified, supporting any version of the feature will cause the method to return true. + + Returns: + `True` if the feature is implemented in the specified version, `False` otherwise. + + This method raises no exceptions. + """ + raise NotImplementedError From 11691c148aab6dc75bb6b7161f218b3337e2af93 Mon Sep 17 00:00:00 2001 From: Hepheir Date: Mon, 31 May 2021 19:48:49 +0900 Subject: [PATCH 4/4] Bind `DOMImplementation` to `w3.python.dom` --- w3/python/core/__init__.py | 1 + w3/python/core/fundamental_interface/__init__.py | 1 + w3/python/dom.py | 1 + 3 files changed, 3 insertions(+) diff --git a/w3/python/core/__init__.py b/w3/python/core/__init__.py index 4a270a5..acb568b 100644 --- a/w3/python/core/__init__.py +++ b/w3/python/core/__init__.py @@ -2,3 +2,4 @@ """ from w3.python.core.fundamental_interface import DOMException +from w3.python.core.fundamental_interface import DOMImplementation diff --git a/w3/python/core/fundamental_interface/__init__.py b/w3/python/core/fundamental_interface/__init__.py index d5bb492..9d1c31c 100644 --- a/w3/python/core/fundamental_interface/__init__.py +++ b/w3/python/core/fundamental_interface/__init__.py @@ -6,3 +6,4 @@ from __future__ import absolute_import from w3.python.core.fundamental_interface.DOMException import DOMException +from w3.python.core.fundamental_interface.DOMImplementation import DOMImplementation diff --git a/w3/python/dom.py b/w3/python/dom.py index 1d5ec41..30e48f5 100644 --- a/w3/python/dom.py +++ b/w3/python/dom.py @@ -3,3 +3,4 @@ # Bring in subpackages. from w3.python.core import DOMException +from w3.python.core import DOMImplementation