浏览代码

Other: Remove `env.isEdge`. Closes ckeditor/ckeditor5#6202.

Remove some special cases for Edge, as since it's Chromium-based now, it behaves closer to others.

BREAKING CHANGE: `env.isEdge` is no longer available in utils API, see #6202.
Tomek Wytrębowicz 5 年之前
父节点
当前提交
76c627a1f4
共有 2 个文件被更改,包括 2 次插入55 次删除
  1. 1 19
      packages/ckeditor5-utils/src/env.js
  2. 1 36
      packages/ckeditor5-utils/tests/env.js

+ 1 - 19
packages/ckeditor5-utils/src/env.js

@@ -26,14 +26,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).
 	 *
 	 * @static
@@ -88,16 +80,6 @@ export function isMac( userAgent ) {
 }
 
 /**
- * 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).
  *
  * @param {String} userAgent **Lowercase** `navigator.userAgent` string.
@@ -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 {

+ 1 - 36
packages/ckeditor5-utils/tests/env.js

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