⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 core.web.js

📁 echo3 很炫的ajax框架技术 js 演示demo ajax j2ee 里面有jsp演示代码
💻 JS
📖 第 1 页 / 共 5 页
字号:
            // not in DOM tree            return;        }        if (Core.Web.Env.QUIRK_PERFORMANCE_LARGE_DOM_REMOVE) {            this._removeNodeRecursive(node);        } else {            parentNode.removeChild(node);        }    },        /**     * Removes the specified DOM node from the DOM tree in a recursive manner, i.e. all descendants     * of the given node are removed individually. This alleviates slow performance when removing large     * DOM trees.     *     * @param {Node} node the node which should be deleted    */    _removeNodeRecursive: function(node) {        var childNode = node.firstChild;        while (childNode) {            var nextChildNode = childNode.nextSibling;            this._removeNodeRecursive(childNode);            childNode = nextChildNode;        }        node.parentNode.removeChild(node);    },        /**     * Stops an event from propagating ("bubbling") to parent nodes in the DOM,      * using the client's supported event model.     * On clients which support the W3C DOM Level 2 event specification,     * the stopPropagation() method of the event is invoked.     * On clients which support only the Internet Explorer event model,     * the 'cancelBubble' property of the event is set to true.     *     * @param {Event} e the event     */    stopEventPropagation: function(e) {        if (e.stopPropagation) {            e.stopPropagation();        } else {            e.cancelBubble = true;        }    }};/** * Provides information about the web browser environment. * @class */Core.Web.Env = {    /**     * User-agent string, in lowercase.     */    _ua: null,        /**     * The user agent string with all non-alpha character sequences replaced with single slashes and with      * leading/trailing slashes appended.  This string can be searched for whole words using indexOf("/example/")     */    _uaAlpha: null,        /**     * Performs initial analysis of environment.     * Automatically invoked when Core.Web module is initialized.     */    _init: function() {        var browserVersion = null,             engineVersion = null,             engineId = false;        this._ua = navigator.userAgent.toLowerCase();        this._uaAlpha = "/" + this._ua.replace(/[^a-z]+/g, "/") + "/";                // Parse version string for known major browsers, in reverse order of which they are imitated,        // i.e., Chrome imitates Safari and Gecko, while Mozilla imitates nothing.        if (this._testUAString("opera")) {            this.BROWSER_OPERA = engineId = this.ENGINE_PRESTO = true;            browserVersion = this._parseVersionInfo("opera/");        } else if (this._testUAString("chrome")) {            this.BROWSER_CHROME = engineId = this.ENGINE_WEBKIT = true;            browserVersion = this._parseVersionInfo("chrome/");        } else if (this._testUAString("safari")) {            this.BROWSER_SAFARI = engineId = this.ENGINE_WEBKIT = true;            browserVersion = this._parseVersionInfo("version/");        } else if (this._testUAString("konqueror")) {            this.BROWSER_KONQUEROR = engineId = this.ENGINE_KHTML = true;            browserVersion = this._parseVersionInfo("konqueror/");        } else if (this._testUAString("firefox")) {            this.BROWSER_FIREFOX = this.BROWSER_MOZILLA = engineId = this.ENGINE_GECKO = true;            browserVersion = this._parseVersionInfo("firefox/");        } else if (this._testUAString("msie")) {            this.BROWSER_INTERNET_EXPLORER = engineId = this.ENGINE_MSHTML = true;            // Set engine version to browser version for MSIE/MSHTML.  Unfortunately "Trident" versioning            // is unpredictable, with the MSIE8 UA string reporting "Trident/4.0" but MSIE6 supposedly using "Trident IV"            // and MSIE7 supposedly using "Trident V".  We thus go by the suspected MSHTML DLL version, which is equivalent to            // the IE version.            engineVersion = browserVersion = this._parseVersionInfo("msie ");        }                if (!engineId) {            // Browser/engine not yet identified, attempt to identify by engine.            if (this._testUAString("presto")) {                this.ENGINE_PRESTO = true;            } else if (this._testUAString("webkit")) {                this.ENGINE_WEBKIT = true;            } else if (this._testUAString("khtml")) {                this.ENGINE_KHTML = true;            } else if (this._testUAString("trident")) {                this.ENGINE_MSHTML = true;            } else if (this._testUAString("gecko")) {                this.BROWSER_MOZILLA = this.ENGINE_GECKO = true;            }        }                if (!engineVersion) {            if (this.ENGINE_PRESTO) {                engineVersion = this._parseVersionInfo("presto/");            } else if (this.ENGINE_WEBKIT) {                engineVersion = this._parseVersionInfo("webkit/");            } else if (this.ENGINE_GECKO) {                engineVersion = this._parseVersionInfo("rv:");                if (!browserVersion) {                    browserVersion = engineVersion;                }            }        }                if (browserVersion) {            this.BROWSER_VERSION_MAJOR = browserVersion.major;            this.BROWSER_VERSION_MINOR = browserVersion.minor;        }        if (engineVersion) {            this.ENGINE_VERSION_MAJOR = engineVersion.major;            this.ENGINE_VERSION_MINOR = engineVersion.minor;        }                this.CSS_FLOAT = "cssFloat";            // Note deceptive user agent fields:        // - Konqueror and Safari UA fields contain "like Gecko"        // - Opera UA field typically contains "MSIE"        // If this flag is set, browser is not GECKO/MSHTML        this.DECEPTIVE_USER_AGENT = this.BROWSER_OPERA || this.BROWSER_SAFARI || this.BROWSER_CHROME || this.BROWSER_KONQUEROR;                this.MEASURE_OFFSET_EXCLUDES_BORDER = false;                        // Set IE Quirk Flags        if (this.BROWSER_INTERNET_EXPLORER) {            // Internet Explorer Flags (all versions).            this.PROPRIETARY_EVENT_MOUSE_ENTER_LEAVE_SUPPORTED = true;            this.PROPRIETARY_EVENT_SELECT_START_SUPPORTED = true;            this.QUIRK_IE_KEY_DOWN_EVENT_REPEAT = true;            this.CSS_FLOAT = "styleFloat";            this.QUIRK_DELAYED_FOCUS_REQUIRED = true;            this.QUIRK_UNLOADED_IMAGE_HAS_SIZE = true;            this.MEASURE_OFFSET_EXCLUDES_BORDER = true;                        if (this.BROWSER_VERSION_MAJOR < 8) {                // Internet Explorer 6 and 7 Flags.                this.QUIRK_TABLE_CELL_WIDTH_EXCLUDES_PADDING = true;                this.NOT_SUPPORTED_RELATIVE_COLUMN_WIDTHS = true;                this.QUIRK_IE_REPAINT = true;                this.QUIRK_TEXTAREA_CONTENT = true;                this.QUIRK_IE_TEXTAREA_NEWLINE_OBLITERATION = true;                this.QUIRK_CSS_BORDER_COLLAPSE_INSIDE = true;                this.QUIRK_CSS_BORDER_COLLAPSE_FOR_0_PADDING = true;                this.NOT_SUPPORTED_CSS_OPACITY = true;                this.PROPRIETARY_IE_OPACITY_FILTER_REQUIRED = true;                this.QUIRK_IE_TABLE_PERCENT_WIDTH_SCROLLBAR_ERROR = true;                this.QUIRK_IE_SELECT_PERCENT_WIDTH = true;                                if (this.BROWSER_VERSION_MAJOR < 7) {                    // Internet Explorer 6 Flags.                    this.QUIRK_IE_SELECT_LIST_DOM_UPDATE = true;                    this.QUIRK_CSS_POSITIONING_ONE_SIDE_ONLY = true;                    this.PROPRIETARY_IE_PNG_ALPHA_FILTER_REQUIRED = true;                    this.QUIRK_CSS_BACKGROUND_ATTACHMENT_USE_FIXED = true;                    this.QUIRK_IE_SELECT_Z_INDEX = true;                    this.NOT_SUPPORTED_CSS_MAX_HEIGHT = true;                                        // Enable 'garbage collection' on large associative arrays to avoid memory leak.                    Core.Arrays.LargeMap.garbageCollectEnabled = true;                }            }        } else if (this.ENGINE_GECKO) {            this.MEASURE_OFFSET_EXCLUDES_BORDER = true;            this.QUIRK_MEASURE_OFFSET_HIDDEN_BORDER = true;            if (this.BROWSER_FIREFOX) {                if (this.BROWSER_VERSION_MAJOR < 2) {                    this.QUIRK_DELAYED_FOCUS_REQUIRED = true;                }            } else {                this.QUIRK_PERFORMANCE_LARGE_DOM_REMOVE = true;                this.QUIRK_DELAYED_FOCUS_REQUIRED = true;            }        } else if (this.ENGINE_PRESTO) {            if (this.BROWSER_VERSION_MAJOR == 9 && this.BROWSER_VERSION_MINOR >= 50) {                this.QUIRK_OPERA_WINDOW_RESIZE_POSITIONING = true;            }            this.NOT_SUPPORTED_RELATIVE_COLUMN_WIDTHS = true;        } else if (this.ENGINE_WEBKIT) {            this.MEASURE_OFFSET_EXCLUDES_BORDER = true;            this.QUIRK_SAFARI_DOM_TEXT_ESCAPE = true;        }    },        /**     * Parses version information from user agent string. The text argument specifies     * the string that prefixes the version info in the ua string (ie 'version/' for Safari for example).     * <p>     * The major version is retrieved by getting the int between text and the first dot. The minor version     * is retrieved by getting the int between the first dot and the first non-numeric character that appears     * after the dot, or the end of the ua string (whichever comes first).     * If the ua string does not supply a minor version, the minor version is assumed to be 0.     *     * @param ua the lower cased user agent string     * @param searchString the text that prefixes the version info (version info must be the first appearance of      *          this text in the ua string)     */    _parseVersionInfo: function(searchString) {        var version = { };                var ix1 = this._ua.indexOf(searchString);        if (ix1 == -1) {            return;        }                var ix2 = this._ua.indexOf(".", ix1);        var ix3 = this._ua.length;                if (ix2 == -1) {            ix2 = this._ua.length;        } else {            // search for the first non-number character after the dot            for (var i = ix2 + 1; i < this._ua.length; i++) {                var c = this._ua.charAt(i);                if (isNaN(c)) {                    ix3 = i;                    break;                }            }        }                version.major = parseInt(this._ua.substring(ix1 + searchString.length, ix2), 10);        if (ix2 == this._ua.length) {            version.minor = 0;        } else {            version.minor = parseInt(this._ua.substring(ix2 + 1, ix3), 10);        }                return version;    },        _testUAString: function(browser) {        return this._uaAlpha.indexOf("/" + browser + "/") != -1;    }};/** * Event Processing System namespace. * The static methods in this object provide a standard framework for handling * DOM events across incompatible browser platforms. * <p> * <b>Capturing/Bubbling Listeners:</b> * This implementation additionally allows for the registration of capturing and bubbling event  * listeners that work even on Internet Explorer platforms, where they are not natively supported. * This implementation relies on the fact that all event listeners will be registered * through it. * @class */Core.Web.Event = {        /**     * Provides utilities for restricting selection of DOM elements.  These are necessary as double click and drag     * events will cause/begin undesired selections.     */    Selection: {        /**         * Adds a listener to an element that will prevent text selection / highlighting as a result of mouse clicks.         * The disable() method should be invoked when the element is to be disposed.         * The event is registered using the event processor, so invoking Core.Web.Event.removeAll() on its         * element will also dispose it.         *         * @param {Element} element the element on which to forbid text selection         * @see Core.Web.Event.Selection#enable         */        disable: function(element) {            Core.Web.Event.add(element, "mousedown", Core.Web.Event.Selection._disposeEvent, false);            if (Core.Web.Env.PROPRIETARY_EVENT_SELECT_START_SUPPORTED) {                Core.Web.Event.add(element, "selectstart", Core.Web.Event.Selection._disposeEvent, false);            }        },                /**         * Selection denial listener implementation.         *          * @param e the selection/click event         */        _disposeEvent: function(e) {            Core.Web.DOM.preventEventDefault(e);        },            /**         * Removes a selection denial listener.         *          * @param element the element from which to remove the selection denial listener         * @see Core.Web.Event.Selection#enable         */        enable: function(element) {            Core.Web.Event.remove(element, "mousedown", Core.Web.Event.Selection._disposeEvent, false);            if (Core.Web.Env.PROPRIETARY_EVENT_SELECT_START_SUPPORTED) {                Core.Web.Event.remove(element, "selectstart", Core.Web.Event.Selection._disposeEvent, false);            }        }    },        /**     * Next available sequentially assigned element identifier.     * Elements are assigned unique identifiers to enable mapping between      * elements and lists of registered event listeners.     *     * @type Integer     */    _nextId: 0,        /**     * Current listener count.     */    _listenerCount: 0,        /**     * Flag to display listener count every time an event is fired.  Enable this flag to check for listener leaks.     */    debugListenerCount: false,        /**     * Mapping between element ids and ListenerLists containing listeners to invoke during capturing phase.     * @type Core.Arrays.LargeMap     */    _capturingListenerMap: new Core.Arrays.LargeMap(),    

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -