Closed byteface closed 2 years ago
I looked into this a little bit. I can't remember fully. But it might only be the class selector that fails when not provided a tag.
getElementsBySelector('.someclass') < not works getElementsBySelector('div.someclass') < works
pos = str.find(element, ".") # Class
if(pos + 1 and not(pos > left_bracket and pos < right_bracket)):
# print('IM A CLASS')
parts = str.split(element, '.')
tag = parts[0]
class_name = parts[1]
# print(tag)
# print(class_name)
found = getElements(context, tag)
# found = document.getElementsByClassName(class_name
I noticed if there's a '.' then it will have no tag to reference. So making that part work could be the key to swapping that in as the querySelectorAll replacement.
Frustratingly at the moment. The getElementsBySelector fails if not tag is provided. but can do slighly more complex css selectors.
this bug was fixed. so closing until this whole lot is revisited. functional but not pretty. will need to fixup on a refactor push some point.
we have a new replacement method that can do complex css queries but for some reason it doesn't do simple ones i.e. single tags. so they needed to be merged however an issue arose as the new one used getElementByID which was using querySelctor. fuck. So I losts a ton of fucking time and broke a branch (that had my an attempt at dict setters for attribs in it). anyways. will have another attempts at merging these together to work properly again another time. Or unless someone really really complains.