add tab support by having separate renderers and http clients, make link clicking open a new tab, add better default headers, fix style elements showing as text, fix crash if there are no needs but needs_render is True, fix view-source scheme not working,

This commit is contained in:
csd4ni3l
2025-07-27 16:38:56 +02:00
parent c77b067d08
commit 31b67c9dfd
5 changed files with 163 additions and 98 deletions

View File

@@ -36,7 +36,8 @@ class HTML():
for c in self.raw_html:
if c == "<":
in_tag = True
if text: self.add_text(text) # start of new tag means before everything was content/text
if (not self.unfinished or not self.unfinished[-1].tag == "style") and text:
self.add_text(text) # start of new tag means before everything was content/text
text = ""
elif c == ">":
in_tag = False
@@ -173,6 +174,9 @@ def get_inline_styles(node):
for node in node.children:
if isinstance(node, Element) and node.tag == "style":
if not node.children:
continue
if isinstance(node.children[0], Text):
all_rules.extend(CSSParser(node.children[0].text).parse()) # node's first children will just be a text element that contains the css