implement document.compatmode

This commit is contained in:
Vincent Sanders 2013-01-16 13:42:16 +00:00
parent 3f1c2a8315
commit 7b62bb5ff8
1 changed files with 30 additions and 1 deletions

View File

@ -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);