From 7b62bb5ff89b08820f56df666c8d9616c8c57489 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 16 Jan 2013 13:42:16 +0000 Subject: implement document.compatmode --- javascript/jsapi/htmldocument.bnd | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'javascript') diff --git a/javascript/jsapi/htmldocument.bnd b/javascript/jsapi/htmldocument.bnd index 8d5c69eb5..c948e2dbb 100644 --- a/javascript/jsapi/htmldocument.bnd +++ b/javascript/jsapi/htmldocument.bnd @@ -52,6 +52,9 @@ binding document { /** location instantiated on first use */ property unshared location; + /* compatability mode instantiated on first use */ + property unshared compatMode; + /* events through a single interface */ property unshared type EventHandler; } @@ -66,7 +69,7 @@ api finalise %{ getter location %{ - if (!JSVAL_IS_VOID(JSAPI_PROP_RVAL(cx,vp))) { + if (!JSVAL_IS_VOID(JSAPI_PROP_RVAL(cx, vp))) { /* already created - return it */ return JS_TRUE; } @@ -95,6 +98,32 @@ getter documentURI %{ jsret = JSVAL_TO_STRING(jsstr); %} + +getter compatMode %{ + /* Returns the string "CSS1Compat" if document is in no-quirks + * mode or limited-quirks mode, and "BackCompat", if document + * is in quirks mode. + */ + if (!JSVAL_IS_VOID(JSAPI_PROP_RVAL(cx, vp))) { + /* already created, just use it */ + return JS_TRUE; + } + if (private->htmlc->quirks == DOM_DOCUMENT_QUIRKS_MODE_FULL) { + jsret = JS_NewStringCopyN(cx, "BackCompat", SLEN("BackCompat")); + } else { + jsret = JS_NewStringCopyN(cx, "CSS1Compat", SLEN("CSS1Compat")); + } + +%} + +/* +getter characterSet %{ +%} + +getter contentType %{ +%} +*/ + getter cookie %{ char *cookie_str; cookie_str = urldb_get_cookie(llcache_handle_get_url(private->htmlc->base.llcache), false); -- cgit v1.2.3