X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=_source%2Fcore%2Fenv.js;h=dab70d9a572dda54c0f0bccafbb07616ef372ce0;hb=4e90e78dc97789709ee7404359a5517540c27553;hp=2e6a0ff5eddf13d614775278dfb6cde2192bacda;hpb=941b0a9ba4e673e292510d80a5a86806994b8ea6;p=ckeditor.git
diff --git a/_source/core/env.js b/_source/core/env.js
index 2e6a0ff..dab70d9 100644
--- a/_source/core/env.js
+++ b/_source/core/env.js
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
@@ -11,9 +11,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
if ( !CKEDITOR.env )
{
/**
- * Environment and browser information.
- * @namespace
- * @example
+ * @namespace Environment and browser information.
*/
CKEDITOR.env = (function()
{
@@ -69,11 +67,42 @@ if ( !CKEDITOR.env )
*/
mac : ( agent.indexOf( 'macintosh' ) > -1 ),
+ /**
+ * Indicates that CKEditor is running on a quirks mode environemnt.
+ * @type Boolean
+ * @example
+ * if ( CKEDITOR.env.quirks )
+ * alert( "Nooooo!" );
+ */
quirks : ( document.compatMode == 'BackCompat' ),
+ /**
+ * Indicates that CKEditor is running on a mobile like environemnt.
+ * @type Boolean
+ * @example
+ * if ( CKEDITOR.env.mobile )
+ * alert( "I'm running with CKEditor today!" );
+ */
+ mobile : ( agent.indexOf( 'mobile' ) > -1 ),
+
+ /**
+ * Indicates that the browser has a custom domain enabled. This has
+ * been set with "document.domain".
+ * @returns {Boolean} "true" if a custom domain is enabled.
+ * @example
+ * if ( CKEDITOR.env.isCustomDomain() )
+ * alert( "I'm in a custom domain!" );
+ */
isCustomDomain : function()
{
- return this.ie && document.domain != window.location.hostname;
+ if ( !this.ie )
+ return false;
+
+ var domain = document.domain,
+ hostname = window.location.hostname;
+
+ return domain != hostname &&
+ domain != ( '[' + hostname + ']' ); // IPv6 IP support (#5434)
}
};
@@ -96,19 +125,44 @@ if ( !CKEDITOR.env )
version = parseFloat( agent.match( /msie (\d+)/ )[1] );
/**
- * Indicate IE8 browser.
+ * Indicates that CKEditor is running on Internet Explorer 8.
+ * @name CKEDITOR.env.ie8
+ * @type Boolean
+ * @example
+ * if ( CKEDITOR.env.ie8 )
+ * alert( "I'm on IE8!" );
*/
env.ie8 = !!document.documentMode;
/**
- * Indicte IE8 document mode.
+ * Indicates that CKEditor is running on Internet Explorer 8 on
+ * standards mode.
+ * @name CKEDITOR.env.ie8Compat
+ * @type Boolean
+ * @example
+ * if ( CKEDITOR.env.ie8Compat )
+ * alert( "Now I'm on IE8, for real!" );
*/
env.ie8Compat = document.documentMode == 8;
/**
+ * Indicates that CKEditor is running on Internet Explorer 9's standards mode.
+ * @name CKEDITOR.env.ie9Compat
+ * @type Boolean
+ * @example
+ * if ( CKEDITOR.env.ie9Compat )
+ * alert( "IE9, the beauty of the web!" );
+ */
+ env.ie9Compat = document.documentMode == 9;
+
+ /**
* Indicates that CKEditor is running on an IE7-like environment, which
* includes IE7 itself and IE8's IE7 document mode.
+ * @name CKEDITOR.env.ie7Compat
* @type Boolean
+ * @example
+ * if ( CKEDITOR.env.ie8Compat )
+ * alert( "I'm on IE7 or on an IE7 like IE8!" );
*/
env.ie7Compat = ( ( version == 7 && !document.documentMode )
|| document.documentMode == 7 );
@@ -116,13 +170,13 @@ if ( !CKEDITOR.env )
/**
* Indicates that CKEditor is running on an IE6-like environment, which
* includes IE6 itself and IE7 and IE8 quirks mode.
+ * @name CKEDITOR.env.ie6Compat
* @type Boolean
* @example
* if ( CKEDITOR.env.ie6Compat )
* alert( "I'm on IE6 or quirks mode!" );
*/
env.ie6Compat = ( version < 7 || env.quirks );
-
}
// Gecko.
@@ -151,12 +205,12 @@ if ( !CKEDITOR.env )
version = parseFloat( agent.match( / applewebkit\/(\d+)/ )[1] );
/**
- * Contains the browser version.
- *
+ * Contains the browser version.
+ *
* For gecko based browsers (like Firefox) it contains the revision
* number with first three parts concatenated with a padding zero
- * (e.g. for revision 1.9.0.2 we have 10900).
- *
+ * (e.g. for revision 1.9.0.2 we have 10900).
+ *
* For webkit based browser (like Safari and Chrome) it contains the
* WebKit build version (e.g. 522).
* @name CKEDITOR.env.version
@@ -176,21 +230,27 @@ if ( !CKEDITOR.env )
* alert( "Your browser is pretty cool!" );
*/
env.isCompatible =
+ !env.mobile && (
( env.ie && version >= 6 ) ||
( env.gecko && version >= 10801 ) ||
( env.opera && version >= 9.5 ) ||
( env.air && version >= 1 ) ||
( env.webkit && version >= 522 ) ||
- false;
+ false );
- // The CSS class to be appended on the main UI containers, making it
- // easy to apply browser specific styles to it.
+ /**
+ * The CSS class to be appended on the main UI containers, making it
+ * easy to apply browser specific styles to it.
+ * @name CKEDITOR.env.cssClass
+ * @type String
+ * @example
+ * myDiv.className = CKEDITOR.env.cssClass;
+ */
env.cssClass =
'cke_browser_' + (
env.ie ? 'ie' :
env.gecko ? 'gecko' :
env.opera ? 'opera' :
- env.air ? 'air' :
env.webkit ? 'webkit' :
'unknown' );
@@ -201,7 +261,7 @@ if ( !CKEDITOR.env )
{
env.cssClass += ' cke_browser_ie' + (
env.version < 7 ? '6' :
- env.version >= 8 ? '8' :
+ env.version >= 8 ? document.documentMode:
'7' );
if ( env.quirks )
@@ -211,6 +271,9 @@ if ( !CKEDITOR.env )
if ( env.gecko && version < 10900 )
env.cssClass += ' cke_browser_gecko18';
+ if ( env.air )
+ env.cssClass += ' cke_browser_air';
+
return env;
})();
}