ckeditor/_source/core/dom/walker.js

(开头部分) 13KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/

(function()
{
	// This function is to be called under a "walker" instance scope.
	function iterate( rtl, breakOnFalse )
	{
		// Return null if we have reached the end.
		if ( this._.end )
			return null;

		var node,
			range = this.range,
			guard,
			userGuard = this.guard,
			type = this.type,
			getSourceNodeFn = ( rtl ? 'getPreviousSourceNode' : 'getNextSourceNode' );

		// This is the first call. Initialize it.
		if ( !this._.start )
		{
			this._.start = 1;

			// Trim text nodes and optmize the range boundaries. DOM changes
			// may happen at this point.
			range.trim();

			// A collapsed range must return null at first call.
			if ( range.collapsed )
			{
				this.end();
				return null;
			}
		}

		// Create the LTR guard function, if necessary.
		if ( !rtl && !this._.guardLTR )
		{
			// Gets the node that stops the walker when going LTR.
			var limitLTR = range.endContainer,
				blockerLTR = limitLTR.getChild( range.endOffset );

			this._.guardLTR = function( node, movingOut )
			{
				return ( ( !movingOut || !limitLTR.equals( node ) )
					&& ( !blockerLTR || !node.equals( blockerLTR ) )
					&& ( node.type != CKEDITOR.NODE_ELEMENT || !movingOut || node.getName() != 'body' ) );
			};
		}

		// Create the RTL guard function, if necessary.
		if ( rtl && !this._.guardRTL )
		{
			// Gets the node that stops the walker when going LTR.
			var limitRTL = range.startContainer,
				blockerRTL = ( range.startOffset > 0 ) && limitRTL.getChild( range.startOffset - 1 );

后面还有 402 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。