Skip to content

Commit

Permalink
Merge pull request #333 from ckeditor/i/6202-remove-env.isEdge
Browse files Browse the repository at this point in the history
Other: Removed `env.isEdge` as Edge is now detected and treated as Chrome. Closes #6202.

BREAKING CHANGE: `env.isEdge` is no longer available. See #6202.
  • Loading branch information
Reinmar authored Apr 20, 2020
2 parents f8a9363 + b5d663e commit bfe923a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 55 deletions.
20 changes: 1 addition & 19 deletions packages/ckeditor5-utils/src/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,6 @@ const env = {
*/
isMac: isMac( userAgent ),

/**
* Indicates that the application is running in Microsoft Edge.
*
* @static
* @type {Boolean}
*/
isEdge: isEdge( userAgent ),

/**
* Indicates that the application is running in Firefox (Gecko).
*
Expand Down Expand Up @@ -87,16 +79,6 @@ export function isMac( userAgent ) {
return userAgent.indexOf( 'macintosh' ) > -1;
}

/**
* Checks if User Agent represented by the string is Microsoft Edge.
*
* @param {String} userAgent **Lowercase** `navigator.userAgent` string.
* @returns {Boolean} Whether User Agent is Edge or not.
*/
export function isEdge( userAgent ) {
return !!userAgent.match( /edge\/(\d+.?\d*)/ );
}

/**
* Checks if User Agent represented by the string is Firefox (Gecko).
*
Expand Down Expand Up @@ -137,7 +119,7 @@ export function isAndroid( userAgent ) {
export function isRegExpUnicodePropertySupported() {
let isSupported = false;

// Feature detection for Unicode properties. Added in ES2018. Currently Firefox and Edge do not support it.
// Feature detection for Unicode properties. Added in ES2018. Currently Firefox does not support it.
// See https://github.com/ckeditor/ckeditor5-mention/issues/44#issuecomment-487002174.

try {
Expand Down
37 changes: 1 addition & 36 deletions packages/ckeditor5-utils/tests/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

import env, { isEdge, isMac, isGecko, isSafari, isAndroid, isRegExpUnicodePropertySupported } from '../src/env';
import env, { isMac, isGecko, isSafari, isAndroid, isRegExpUnicodePropertySupported } from '../src/env';

function toLowerCase( str ) {
return str.toLowerCase();
Expand All @@ -20,12 +20,6 @@ describe( 'Env', () => {
} );
} );

describe( 'isEdge', () => {
it( 'is a boolean', () => {
expect( env.isEdge ).to.be.a( 'boolean' );
} );
} );

describe( 'isGecko', () => {
it( 'is a boolean', () => {
expect( env.isGecko ).to.be.a( 'boolean' );
Expand Down Expand Up @@ -74,35 +68,6 @@ describe( 'Env', () => {
} );
} );

describe( 'isEdge()', () => {
it( 'returns true for Edge UA strings', () => {
expect( isEdge( 'edge/12' ) ).to.be.true;
expect( isEdge( 'foo edge/12 bar' ) ).to.be.true;

expect( isEdge( toLowerCase(
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) ' +
'Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393'
) ) ).to.be.true;
} );

it( 'returns false for non–Edge UA strings', () => {
expect( isEdge( '' ) ).to.be.false;
expect( isEdge( 'mac' ) ).to.be.false;
expect( isEdge( 'foo' ) ).to.be.false;
expect( isEdge( 'ledge' ) ).to.be.false;
expect( isEdge( 'foo edge bar' ) ).to.be.false;

// Chrome
expect( isEdge( toLowerCase(
'Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36'
) ) ).to.be.false;
// IE11
expect( isEdge( toLowerCase(
'Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko'
) ) ).to.be.false;
} );
} );

describe( 'isGecko()', () => {
it( 'returns true for Firefox UA strings', () => {
expect( isGecko( 'gecko/42' ) ).to.be.true;
Expand Down

0 comments on commit bfe923a

Please sign in to comment.