On Wed, Sep 23, 2015 at 21:43:13 +0100, Dave Higton wrote: > Second version using SLEN() instead of strlen(). > > This patch to Document/bnd makes the Javascript writeln() function > work as well as write().
>From my reading of the spec, it inserts a newline, not a line break. Also, you could chain through Document.write to reduce code duplication (untested) method Document::writeln() %{ duk_push_this(ctx); duk_insert(ctx, 0); duk_push_lstring(ctx, "write", SLEN("write")); duk_insert(ctx, 1); duk_push_lstring(ctx, "\n", SLEN("\n")); duk_call_prop(ctx, 0, duk_get_top(ctx) - 1); return 0; %} This has the advantage that if we change how Document::write functions then we don't need to remember to change that in writeln. Also it gives us an example in the codebase of how to invoke a method on an object in our bindings which may be of use later. I don't object to your previous approach, just think this might be cleaner. Opinions? D. -- Daniel Silverstone http://www.netsurf-browser.org/ PGP mail accepted and encouraged. Key Id: 3CCE BABE 206C 3B69