Skip to content
This repository was archived by the owner on Apr 29, 2026. It is now read-only.
This repository was archived by the owner on Apr 29, 2026. It is now read-only.

_ready函数在DOMContentLoaded事件就绪后document.readyState === 'complete'没有执行readyFunc #346

Description

@GitHub-MXB
	function _ready(fn) {
		ieReadyStateFunc();   //应该执行这个
		if (_readyFinished) {  //替换此代码
			fn(KindEditor);
			return;
		}
		var loaded = false;
		function readyFunc() {
			if (!loaded) {
				loaded = true;
				fn(KindEditor);
				_readyFinished = true;
			}
		}
		function ieReadyFunc() {
			if (!loaded) {
				try {
					document.documentElement.doScroll('left');
				} catch (e) {
					setTimeout(ieReadyFunc, 100);
					return;
				}
				readyFunc();
			}
		}
		function ieReadyStateFunc() {
			if (document.readyState === 'complete') {
				readyFunc();
			}
		}
		if (document.addEventListener) {
			_bind(document, 'DOMContentLoaded', readyFunc);
		} else if (document.attachEvent) {
			_bind(document, 'readystatechange', ieReadyStateFunc);
			var toplevel = false;
			try {
				toplevel = window.frameElement == null;
			} catch (e) { }
			if (document.documentElement.doScroll && toplevel) {
				ieReadyFunc();
			}
		}
		_bind(window, 'load', readyFunc);
	}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions