Take a look at the methods and attributes provided for DOM elements in Javascript, and add those that are meaningful. It does not have to be complete, but in principle it should be possible to do everything you can in Javascript through the Python API. Things that have already been identified as useful include:
[x] Getting the parent of an element, wrapped in DOMWrapper.
[x] Getting the children of an element, as an iterator of elements wrapped in DOMWrapper.
[x] Getting all elements that match a query string, using e.g. document.query_all(q). This should return an iterator of elements.
[x] Getting and setting various object attributes of a DOM element, such as value. This is most easily handled using Python properties, with a setter and getter method. Probably, a generic method can be created, that takes a property name string, and adds the setter and getter.
[x] Also, the name of DOMWrapper's attribute dom_element should be changed to _dom_element.
[x] The API should support wrapping and unwrapping. This can be achieved by renaming the class dom to wrap and creating a function def unwrap(element): return element._dom_element. This can be used as a last resort if there are features of the javascript object that have not been provided. It can also be used by the library, e.g. by some of the functions listed above.
Take a look at the methods and attributes provided for DOM elements in Javascript, and add those that are meaningful. It does not have to be complete, but in principle it should be possible to do everything you can in Javascript through the Python API. Things that have already been identified as useful include:
DOMWrapper
.DOMWrapper
.document.query_all(q)
. This should return an iterator of elements.DOMWrapper
's attribute dom_element should be changed to_dom_element
.dom
towrap
and creating a functiondef unwrap(element): return element._dom_element
. This can be used as a last resort if there are features of the javascript object that have not been provided. It can also be used by the library, e.g. by some of the functions listed above.