diff options
author | bptato <nincsnevem662@gmail.com> | 2022-02-09 15:56:29 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2022-02-09 15:57:45 +0100 |
commit | 2edbb7b07d1b82e18e1dbe5eb58a3fcce659f783 (patch) | |
tree | d75e4c249ed6c9491c59165fd06555f68c5b428e /src/io/buffer.nim | |
parent | acfa008840bbd9fcdafcee4197a3a776db2d348d (diff) | |
download | chawan-2edbb7b07d1b82e18e1dbe5eb58a3fcce659f783.tar.gz |
Some loader polishing
Diffstat (limited to 'src/io/buffer.nim')
-rw-r--r-- | src/io/buffer.nim | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/io/buffer.nim b/src/io/buffer.nim index 7356b084..8592b98f 100644 --- a/src/io/buffer.nim +++ b/src/io/buffer.nim @@ -736,7 +736,7 @@ proc loadResources(buffer: Buffer, document: Document) = if url.get.scheme == buffer.location.scheme: let res = buffer.loader.getPage(url.get) if res.s != nil and res.contenttype == "text/css": - let sheet = parseStylesheet(res.s.readAll()) + let sheet = parseStylesheet(res.s) elem.parentElement.sheets.add(sheet) for i in countdown(elem.children.high, 0): @@ -747,14 +747,10 @@ proc load*(buffer: Buffer) = case buffer.contenttype of "text/html": if not buffer.streamclosed: - #TODO not sure what to do with this. - #Ideally we could just throw away the source data after parsing but then - #source view won't work. Well we could still generate it... best would be a - #config option like a) store source b) generate source - buffer.source = buffer.istream.readAll() - buffer.istream.close() + buffer.document = parseHtml(buffer.istream, buffer.source) buffer.streamclosed = true - buffer.document = parseHtml(newStringStream(buffer.source)) + else: + buffer.document = parseHtml(newStringStream(buffer.source)) buffer.document.location = buffer.location buffer.loadResources(buffer.document) else: |