When developers need to use a new version of jQuery in code, they can use this plug-in version 1.9 or 2.0 to detect which features have been discarded or removed, and restore these features as necessary. For more information, see README.
Based on previous versions, jQuery Migrate 1.1 has made some improvements, including:
• Supports console. trace () to track warning information, making it easier to diagnose errors.
• If the JSON format is invalid, a warning is returned.
• The message "Logging is active" is prompted to indicate that the plug-in is running.
• For security reasons, jQuery 1.9 limits string processing. You can use the new Migrate plug-in to restore this function. However, we recommend that you use $. parseHTML () to process HTML.
• An error warning is displayed for $ ("<button>", {type: "button "}).
Finally, you must note that you can use this plug-in to restore jQuery to any version after jQuery 1.6.4.
Note:
Last month, we noticed that jQuery released Versions 1.9 and 2.0. The official team also released jQuery Migrate Plugin 1.0.0, Which is used together with jQuery 1.9 or 2.0, detects that jQuey has been removed or will be removed, so that the jQuey feature you have developed can be used continuously. However, it seems that many users do not know the usefulness of this plug-in and directly upgrade jQuey to 1.9 or 2.0, migrate plugin is not loaded, causing many official messages about feed back which are unavailable for some old functions. After half a month, jQuery officially received many migrate plugin return issues. This time, it can be loaded through jQuuery CDN. The program code is as follows.
Copy codeThe Code is as follows:
<Script src = "http://code.jquery.com/jquery-1.9.0.js"> </script>
<Script src = "http://code.jquery.com/jquery-migrate-1.1.0.js"> </script>
Compressed version
Copy codeThe Code is as follows:
<Script src = "http://code.jquery.com/jquery-1.9.0.min.js"> </script>
<Script src = "http://code.jquery.com/jquery-migrate-1.1.0.min.js"> </script>
Migrate plugin is not required for a perfect jQuery upgrade. However, in order to make some removed functions available, the team develops migrate plugin for developers to use. This migrate plugin revision mainly adds the debug mode and opens it by default, so that developers can know which programs must be modified before they can be used normally in jQuery 1.9 or later versions. The new features of version 1.1.0 are listed below.
1. by default, the Trace function is enabled. If all browsers support console. trace () and migrate are displayed directly on the console interface by default. If the online website does not want to use this function, you can use jQuery. migrateTrace = false disable the function.
2. "Logging is active" message: If this message is displayed, it indicates that the migrate plugin has been loaded on the webpage, but the developer is notified that the migrate plugin has been correctly loaded. Www.it165.net
3. before jQuery 1.9.0 $. parseJSON () supports invalid JSON values, such as "" or undefined. return null instead of error message. The Migrate 1.1.0 also supports this function and displays error messages.
4. $ ("<button>", {type: "button"}) is written in 1.9 and does not support IE6/7/8. Migrate 1.1.0 also supports this function, and an error message is displayed.
5. You can see Migrate Plugin on the jQuery plugin website, or find it on Github.