Просмотр исходного кода

TSLCore: Use `node.nodeType` instead of `safeGetNodeType()` (#31328)

sunag 6 месяцев назад
Родитель
Сommit
e9a17272a3
1 измененных файлов с 1 добавлено и 15 удалено
  1. 1 15
      src/nodes/tsl/TSLCore.js

+ 1 - 15
src/nodes/tsl/TSLCore.js

@@ -554,20 +554,6 @@ const getConstNode = ( value, type ) => {
 
 };
 
-const safeGetNodeType = ( node ) => {
-
-	try {
-
-		return node.getNodeType();
-
-	} catch ( _ ) {
-
-		return undefined;
-
-	}
-
-};
-
 const ConvertType = function ( type, cacheMap = null ) {
 
 	return ( ...params ) => {
@@ -587,7 +573,7 @@ const ConvertType = function ( type, cacheMap = null ) {
 		if ( params.length === 1 ) {
 
 			const node = getConstNode( params[ 0 ], type );
-			if ( safeGetNodeType( node ) === type ) return nodeObject( node );
+			if ( node.nodeType === type ) return nodeObject( node );
 			return nodeObject( new ConvertNode( node, type ) );
 
 		}

粤ICP备19079148号