Skip to content

Commit 384147f

Browse files
committed
Merge branch 't/13316' into major
2 parents 2c45c76 + 8fa2c1c commit 384147f

File tree

3 files changed

+51
-21
lines changed

3 files changed

+51
-21
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ Other Changes:
4545
* Toolbar configurators:
4646
* [#13147](http://dev.ckeditor.com/ticket/13147): Add buttons to the sticky toolbar.
4747
* [#13207](http://dev.ckeditor.com/ticket/13207): Use modal window to display help in toolbar configurator.
48+
* [#13316](http://dev.ckeditor.com/ticket/13316): Made [`CKEDITOR.env.isCompatible`](http://docs.ckeditor.com/#!/api/CKEDITOR.env-property-isCompatible) a blacklist rather than a whitelist. More about the change in the [Browser Compatibility](http://docs.ckeditor.com/#!/guide/dev_browsers) guide.
4849

4950
## CKEditor 4.5 Beta
5051

core/env.js

Lines changed: 39 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ if ( !CKEDITOR.env ) {
1717
*/
1818
CKEDITOR.env = ( function() {
1919
var agent = navigator.userAgent.toLowerCase(),
20-
spartan = agent.match( /edge[ \/](\d+.?\d*)/ ),
20+
edge = agent.match( /edge[ \/](\d+.?\d*)/ ),
2121
trident = agent.indexOf( 'trident/' ) > -1,
22-
ie = !!( spartan || trident );
22+
ie = !!( edge || trident );
2323

2424
var env = {
2525
/**
@@ -28,12 +28,29 @@ if ( !CKEDITOR.env ) {
2828
* if ( CKEDITOR.env.ie )
2929
* alert( 'I\'m running in IE!' );
3030
*
31+
* **Note:** This property is also set to `true` if CKEditor is running
32+
* in {@link #edge Microsoft Edge}.
33+
*
3134
* @property {Boolean}
3235
*/
3336
ie: ie,
3437

3538
/**
36-
* Indicates that CKEditor is running in a WebKit-based browser, like Safari.
39+
* Indicates that CKEditor is running in Microsoft Edge.
40+
*
41+
* if ( CKEDITOR.env.edge )
42+
* alert( 'I\'m running in Edge!' );
43+
*
44+
* See also {@link #ie}.
45+
*
46+
* @since 4.5
47+
* @property {Boolean}
48+
*/
49+
edge: !!edge,
50+
51+
/**
52+
* Indicates that CKEditor is running in a WebKit-based browser, like Safari,
53+
* or Blink-based browser, like Blink.
3754
*
3855
* if ( CKEDITOR.env.webkit )
3956
* alert( 'I\'m running in a WebKit browser!' );
@@ -144,7 +161,7 @@ if ( !CKEDITOR.env ) {
144161
env.gecko = ( navigator.product == 'Gecko' && !env.webkit && !env.ie );
145162

146163
/**
147-
* Indicates that CKEditor is running in Chrome.
164+
* Indicates that CKEditor is running in Blink-based browsers like Chrome.
148165
*
149166
* if ( CKEDITOR.env.chrome )
150167
* alert( 'I\'m running in Chrome!' );
@@ -172,8 +189,8 @@ if ( !CKEDITOR.env ) {
172189
// Internet Explorer 6.0+
173190
if ( env.ie ) {
174191
// We use env.version for feature detection, so set it properly.
175-
if ( spartan ) {
176-
version = parseFloat( spartan[ 1 ] );
192+
if ( edge ) {
193+
version = parseFloat( edge[ 1 ] );
177194
} else if ( env.quirks || !document.documentMode ) {
178195
version = parseFloat( agent.match( /msie (\d+)/ )[ 1 ] );
179196
} else {
@@ -258,26 +275,28 @@ if ( !CKEDITOR.env ) {
258275
env.version = version;
259276

260277
/**
261-
* Indicates that CKEditor is running in a compatible browser.
278+
* Since CKEditor 4.5.0 this property is a blacklist of browsers incompatible with CKEditor. It means that it is
279+
* set to `false` only in browsers that are known to be incompatible. Before CKEditor 4.5.0 this
280+
* property was a whitelist of browsers that were known to be compatible with CKEditor.
262281
*
263-
* if ( CKEDITOR.env.isCompatible )
264-
* alert( 'Your browser is pretty cool!' );
282+
* The reason for this change is the rising fragmentation of the browsers market (especially the mobile segment).
283+
* It became too complicated to check on which new environments CKEditor is going to work.
265284
*
266-
* See the [Enabling CKEditor in Unsupported Environments](#!/guide/dev_unsupported_environments)
267-
* article for more information.
285+
* In order to enable CKEditor 4.4.x and below in unsupported environment see the
286+
* [Enabling CKEditor in Unsupported Environments](#!/guide/dev_unsupported_environments) article.
287+
*
288+
* if ( CKEDITOR.env.isCompatible )
289+
* alert( 'Your browser is not known to be incompatible with CKEditor!' );
268290
*
269291
* @property {Boolean}
270292
*/
271293
env.isCompatible =
272-
// White list of mobile devices that CKEditor supports.
273-
env.iOS && version >= 534 ||
274-
!env.mobile && (
275-
( env.ie && version > 6 ) ||
276-
( env.gecko && version >= 20000 ) ||
277-
( env.air && version >= 1 ) ||
278-
( env.webkit && version >= 522 ) ||
279-
false
280-
);
294+
// IE 7+ (IE 7 is not supported, but IE Compat Mode is and it is recognized as IE7).
295+
!( env.ie && version < 7 ) &&
296+
// Firefox 4.0+.
297+
!( env.gecko && version < 40000 ) &&
298+
// Chrome 6+, Safari 5.1+, iOS 5+.
299+
!( env.webkit && version < 534 );
281300

282301
/**
283302
* Indicates that CKEditor is running in the HiDPI environment.

tests/core/env.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,22 @@ bender.test( {
2121
},
2222

2323
'test safari and chrome are webkit': function() {
24-
if ( !( CKEDITOR.env.safari || CKEDITOR.env.chrome ) )
24+
if ( !( CKEDITOR.env.safari || CKEDITOR.env.chrome ) ) {
2525
assert.ignore();
26+
}
2627

2728
assert.isTrue( CKEDITOR.env.webkit );
2829
},
2930

31+
'test edge is ie12+': function() {
32+
if ( !CKEDITOR.env.edge ) {
33+
assert.ignore();
34+
}
35+
36+
assert.isTrue( CKEDITOR.env.ie, 'is ie' );
37+
assert.isTrue( CKEDITOR.env.version >= 12, 'version >= 12' );
38+
},
39+
3040
'test isCompatible': function() {
3141
assert.isTrue( CKEDITOR.env.isCompatible );
3242
}

0 commit comments

Comments
 (0)