mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
[js] document.write adds text at the end of document
It is not ok, but better than inserting code at the beginning.
This commit is contained in:
parent
2acfe70caa
commit
d237b06511
@ -290,7 +290,7 @@ render_encoded_document(struct cache_entry *cached, struct document *document)
|
||||
render_gemini_document(cached, document, &buffer);
|
||||
else
|
||||
#ifdef CONFIG_XML
|
||||
if (true) render_xhtml_document(cached, document, NULL);
|
||||
if (true) render_xhtml_document(cached, document, &buffer);
|
||||
else
|
||||
#endif
|
||||
render_html_document(cached, document, &buffer);
|
||||
|
@ -267,6 +267,15 @@ render_xhtml_document(struct cache_entry *cached, struct document *document, str
|
||||
struct html_context *html_context;
|
||||
struct part *part = NULL;
|
||||
|
||||
if (!document->dom) {
|
||||
document->dom = document_parse(document);
|
||||
}
|
||||
|
||||
if (!document->dom) {
|
||||
render_html_document(cached, document, buffer);
|
||||
return;
|
||||
}
|
||||
|
||||
part = mem_calloc(1, sizeof(*part));
|
||||
if (!part) {
|
||||
return;
|
||||
@ -294,16 +303,12 @@ render_xhtml_document(struct cache_entry *cached, struct document *document, str
|
||||
|
||||
if (cached->head) add_to_string(&head, cached->head);
|
||||
|
||||
if (!document->dom) {
|
||||
document->dom = document_parse(document);
|
||||
}
|
||||
|
||||
struct tag *saved_last_tag_to_move = renderer_context.last_tag_to_move;
|
||||
int saved_empty_format = renderer_context.empty_format;
|
||||
/// int saved_margin = html_context->margin;
|
||||
int saved_last_link_to_move = renderer_context.last_link_to_move;
|
||||
|
||||
|
||||
xmlpp::Document *doc = document->dom;
|
||||
|
||||
if (!buffer) {
|
||||
|
@ -471,6 +471,7 @@ check_for_rerender(struct ecmascript_interpreter *interpreter, const char* text)
|
||||
if (rel) {
|
||||
rel->cached = cached;
|
||||
rel->document = document;
|
||||
object_lock(document);
|
||||
register_bottom_half(delayed_reload, rel);
|
||||
}
|
||||
}
|
||||
|
@ -1099,7 +1099,7 @@ document_write_do(JSContext *ctx, unsigned int argc, JS::Value *rval, int newlin
|
||||
|
||||
if (f && f->length)
|
||||
{
|
||||
if (document->ecmascript_counter==0)
|
||||
if (false && document->ecmascript_counter==0)
|
||||
{
|
||||
add_fragment(cached,0,code.source,code.length);
|
||||
} else {
|
||||
@ -1108,8 +1108,6 @@ document_write_do(JSContext *ctx, unsigned int argc, JS::Value *rval, int newlin
|
||||
document->ecmascript_counter++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef CONFIG_LEDS
|
||||
set_led_value(interpreter->vs->doc_view->session->status.ecmascript_led, 'J');
|
||||
#endif
|
||||
|
@ -294,7 +294,7 @@ again:
|
||||
if ((a && get_gemini_code(rb, &h))
|
||||
|| ((h >= 40) || h < 10)) {
|
||||
gemini->code = h;
|
||||
mem_free_set(&conn->cached->content_type, stracpy("text/html"));
|
||||
mem_free_set(&conn->cached->head, stracpy("\nContent-Type: text/html\r\n"));
|
||||
read_gemini_data_done(conn);
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user