mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
SEE & SMJS: document.write(ln): use all arguments
Additionally add a test to test/ecmascript/document_write.html. Thanks to Kirk Reiser for observing that ELinks only printed the first.
This commit is contained in:
parent
7b092af628
commit
a464157d4d
@ -212,11 +212,17 @@ js_document_write_do(struct SEE_interpreter *interp, struct SEE_object *self,
|
|||||||
struct string *ret = g->ret;
|
struct string *ret = g->ret;
|
||||||
|
|
||||||
if (argc >= 1 && ret) {
|
if (argc >= 1 && ret) {
|
||||||
unsigned char *code = SEE_value_to_unsigned_char(interp, argv[0]);
|
int i = 0;
|
||||||
|
|
||||||
if (code) {
|
for (; i < argc; ++i) {
|
||||||
add_to_string(ret, code);
|
unsigned char *code;
|
||||||
mem_free(code);
|
|
||||||
|
code = SEE_value_to_unsigned_char(interp, argv[i]);
|
||||||
|
|
||||||
|
if (code) {
|
||||||
|
add_to_string(ret, code);
|
||||||
|
mem_free(code);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newline)
|
if (newline)
|
||||||
|
@ -212,9 +212,14 @@ document_write_do(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv,
|
|||||||
struct string *ret = interpreter->ret;
|
struct string *ret = interpreter->ret;
|
||||||
|
|
||||||
if (argc >= 1 && ret) {
|
if (argc >= 1 && ret) {
|
||||||
unsigned char *code = jsval_to_string(ctx, &argv[0]);
|
int i = 0;
|
||||||
|
|
||||||
|
for (; i < argc; ++i) {
|
||||||
|
unsigned char *code = jsval_to_string(ctx, &argv[i]);
|
||||||
|
|
||||||
|
add_to_string(ret, code);
|
||||||
|
}
|
||||||
|
|
||||||
add_to_string(ret, code);
|
|
||||||
if (newline)
|
if (newline)
|
||||||
add_char_to_string(ret, '\n');
|
add_char_to_string(ret, '\n');
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
<a href="history.html">history.html</a><br/>
|
<a href="history.html">history.html</a><br/>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
document.writeln('<a href="ontest.html">Test</a><br/>');
|
document.writeln('<a href="ontest.html">Test</a><br/>');
|
||||||
document.write('<a href="infinite2.html">infinite2.html</a><br/>');
|
document.writeln('<a href="infinite2.html">infinite2.html</a><br/>');
|
||||||
|
document.write(1,2,'3', '<br/>');
|
||||||
</script>
|
</script>
|
||||||
<a href="onload.html">onload.html</a><br/>
|
<a href="onload.html">onload.html</a><br/>
|
||||||
</body>
|
</body>
|
||||||
|
Loading…
Reference in New Issue
Block a user