Releases: byteface/domonic
dialog
🌎
- added a package to make the dom universal . so you can import tags from other languages.
i.e.
from domonic.i18n.sw import *
- fixed domonic entry point. This means phasing out the old project bash script or having to set a domonic alias. not yet tested on windows.
means you can now do...
domonic -p someproject
window module fixes
window module was broken. not sure why. looks like a branch merge had gone wrong during reduction of modules in webapi.
fixed now. so if you have html5lib installed you can do...
from domonic.window import *
window.location = "https://www.somesite.com"
print(window.document.title)
querySelectorAll fix
noticed a bug on this when trying some css queries with spaces in. so sorted
Fix hasChildNodes
this should have been a method not a property.
querySelector and __pyml__
querySelectorAll has been limited for ages. Then I started a few css parsers. the most basic one i got working was called getElementsBySelector but that for some reason would only work if a tag was present. So I have now re-directed any queries that are complex to that. making querySelectorAll appear to work. so anyways. now that domonic is compatible with a few html5 parsers I figured I'd just patch that to work properly for now. until some other time.
calling __pyml__
can now create the data attributes the way domonic whats them. which is as variable keyword argument syntax for custom data-tags. Which also makes it clear when you are using a non standard or special attribute.
html5lib
So there's now an 'undocumented' html5lib integration. which helped me figure out how to integrate parts of minidom that exist i.e NameNodeMap. Only just started so won't render to pyml yet but should have all the DOM methods available.
You will also have to pip install html5lib to use it. im created an ext lib for libraries I interface with but don't include in reqs. i.e. later on may do a namespace for django or a filter for jinja or a pdfkit integration or css minifier so these kind of things could go in there.
Here's an example... seems to run fine for several websites til i killed it.
import requests
import html5lib
from domonic.ext.html5lib_ import getTreeBuilder
for SITE in sites:
r = requests.get("https://"+SITE)
parser = html5lib.HTMLParser(tree=getTreeBuilder())
page = parser.parse(r.content.decode("utf-8"))
links = page.getElementsByTagName('a')
for l in links:
try:
print(l.href)
except Exception as e:
# no href on this tag
pass
EntityReference
So EntityReference is 404 missing from mdn. and the createEntityReference method on the dom is dropped from spec.
So... does that mean EntityReference also dropped?. I thought that was a mapping from entities so required?
Doesn't appear to be from other online specs. So having to cross reference specs to see what's going on there.
It would appear as long as we start returning HTMLCollecitons and NodeLists were compliant to a good decent amount of lvl1-5 specs. The hard part would be taking into account changes between specs if I'm not settling on one and just reading them randomly as I do each method. As tbf I'm working backwards from tests and use cases rather than building directly from a spec. Then only referencing the spec.
I'm not against have legacy methods avaiallable if they don't affect anything. And need to understand some parts better.
There now overlap between my DOM stuff and the xm.dom... i.e. NodeFilter exists as identitcal... so i can likely import and reference that. It also has a raiseNotImplemented which was as I expected from the spec and shim Id been working with have it so you set that function rule as you build the treewalker.
Anyways. This DOM is reall really huge. It can often feel like the mandala effect (i've said this before) . So if you want to help just fork and start anywhere. It doesn't belong to me which is why I opened sourced it. And it far too much for 1 person to dev. Tests are really far behind as are docs.
append
kthy
Fixes a render bug that was causing self closing tags to have a closing tag. Very grateful to kthy for picking this up.
Also adds a new feature boolean attributes.
i.e.
#40
s = script(_src="foo.js", _async="")
<script src="foo.js" async></script>there's a new undocumented package called templates with a status_page template for when prototyping.