summaryrefslogtreecommitdiff
path: root/javascript/jsapi
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2013-01-16 13:42:16 +0000
committerVincent Sanders <vince@netsurf-browser.org>2013-01-17 19:58:15 +0000
commit7b62bb5ff89b08820f56df666c8d9616c8c57489 (patch)
treebde0782a2e3d55aabba8f1edc5f62e263f1a2b71 /javascript/jsapi
parent3f1c2a831536cb4b89db52162460f25ecaf9d4c8 (diff)
downloadnetsurf-7b62bb5ff89b08820f56df666c8d9616c8c57489.tar.gz
netsurf-7b62bb5ff89b08820f56df666c8d9616c8c57489.tar.bz2
implement document.compatmode
Diffstat (limited to 'javascript/jsapi')
-rw-r--r--javascript/jsapi/htmldocument.bnd31
1 files changed, 30 insertions, 1 deletions
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);