Releases: byteface/domonic
FrackOverflow
Adds polygon fixes in d3 module by FrackOverlow
Adds cssselect lib
parsers
isort
- used isort on everything. broke a bunch of stuff. fixed it. you may get issues. geom package a little in flux.
- runs black on main moving forward.
- update readme with info about xpath
- wont need to build repo docs as often as should get built by readthedocs anyway
- add contributers to md
- fix dev requirement update from dependabot
- make use of xpath as a command line util
- adds fixes to xpath so you dont need underscore for attribute. and upgrades strings to Text nodes
xpath
Kind of a pre-release. Still undocumented and thoroughly tested...
domonic now includes a lib for xpath: https://pypi.org/project/elementpath/
early days but lots of unit tests just seem to be working out of the box.
gotchas : attributes require underscore... thinking about how to solve that atm.
for usage examples see /tests/test_webapi.test_xpath... i.e.
import requests
r = requests.get("http://eventual.technology")
page = domonic.parseString(r.content.decode("utf-8")) # NOTE - requires install html5lib
evaluator = XPathEvaluator()
expression = evaluator.createExpression("//h1")
result = expression.evaluate(page, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE)
print(str(result.nodes[0]))
css
more css props and parser added. inspired by happy dom (a js dom alternative to jsdom)
screen class added to window module but only for default values.
i think regex.exec in js needs redoing but d3 format uses it. need to check that.
will need to start increasing css tests.
document.stylesheets
from domonic.window import *
window.location = "https://www.facebook.com"
window.document.stylesheets
made a start on cssom. well. not really just loading the style sheets. been on my todo for a while as that could trigger some growth there.
remove() had a bug which was causing double bodies if using the += operators on body. that was fixed. hopefully this time.
DOMException
fixes a few buggy methods on Document that needed sorting and added a few more tests.
Used it as an opprotunity to throw a DOMException.
dom is king (breaking changes)
This one could cause a lot of breaking changes. pin your version to an older one if you are not ready for it.
basically tag is gone... (well It's now just pointer to dom.Node as a legacy helper.) . which means dom module is now king and the html module is just a wrapper.
This is great for lots of reasons. tag used the be the main class. but as the DOM evolved a wierd multi inheritence thing was starting to happen with overrides for all the init methods to be able to call super on each parent. anyway that's all gone. Now that DOM is mature I figured I could just extend node. Then decided to drop tag altogether. However there's still work to do and this is just the first step on the ladder.
On plus side logging will be nicer and it should be more optimal.
Also dom now has all the proper tag names for classes and html is just a wrapper around those. which changes how the classes were created before. The destruction of tag allowed for them to be easier created as base classes.
however there is some vestigal non standard methods now on Node as remains of tag. I'd rather hide these away. i.e. the 'content' method and some others. also 'name' instead of tagName is being used.
But it should be an improvement and make it easier to dev on. As always moving towards a more standard DOM.
Hope you enjoy it.
HTMLCollection
Made a start on HTMLCollection.
JSON class is gone in favour of just using the module. so you can use it with out doing JSON.JSON. (tho i doubt it gets much use anyway)
modified some internal methods. In long run will need to reverse some of them out from depending on querySelectorAll.