Exploring powerful JavaScript Functions of IE8

Source: Internet
Author: User

This article is from http://q.yesky.com/group/review-17634017.html, and provides some technical links.

Offline events (online and offline events ):

Https://developer.mozilla.org/En/Online_and_offline_events

Https://bug336359.bugzilla.mozilla.org/attachment.cgi? Id = 220609

Http://ejohn.org/blog/offline-events/

Postmessage:

The http://msdn.microsoft.com/en-us/library/cc197015 (vs.85). aspx

Http://ejohn.org/blog/postmessage-api-changes/

Http://hi.baidu.com/bdui/blog/item/eedf91509c6ab2591038c2fb.html

 

========================================================== ======================================

 

 

 

The improvement in CSS programming in IE 7 brings a fresh feeling to many developers, but it is not flattering in Javascript. In fact, in this regard, we only see some new bugs. Fortunately, Microsoft has already seen this point. In IE 8, JavaScript has become the focus of its development. Let's take a look at some features of IE 8 from the developer's perspective.
Download: Internet Explorer 8.0 (IE8) Chinese Version
IE8 began to support some new W3C specifications, including the queryselector and queryselectorall functions. Queryselector is a quick implementation of CSS selector's search principle. IE 8 is the second browser that implements selectors API (another browser is WebKit ).
In short, it implements the amazing CSS selector function in jquery. Example: (only IE8 can be run, and FF and IE7 will all encounter errors)

 

Innerspanclassspan

 

It should be noted that any selectors depends entirely on the native selector of the browser. IE8 supports css2.1, so developers no longer need to wait for the launch of CSS 3 selectors.
Support for more HTML 5 Functions
I have always hoped to add some HTML 5 compatibility functions in IE 8. in IE 8, we have seen four complete functions in this regard, which is great!
1. html 5: window. Location. Hash
This function has been well supported by most browsers. In IE8 standard mode, the changes in window. Location. Hash are used as the navigation bar and the URL of the previous document is saved. You can simulate the "back" button effect in Ajax applications. IE8 improved it to broadcast the hashchanged time. As far as I know, this is the first browser to adopt this processing method.
2. html 5: Dom Storage
With this function, data can be stored locally continuously, which replaces the original cookie storage mechanism. We have seen this feature in Firefox browsers later than Version 2.0, but it is not supported in opera and safari.
3. html 5: postmessage
IE8 now supports cross-file message communication (cross-document messaging-xdm )! Through the onmessage event and postmessage methods, two webpages from different domains can communicate.
Currently, IE 8, opera 9, Firefox 3, and WebKit nightlies support this function. That is to say, this function has been supported by almost all the latest browsers.
4. html 5: offline events
In IE 8, there are some offline events to detect network interruptions. Through this, we can write wonderful offline Ajax applications. Currently, browsers that support this function include Firefox 3 and IE 8.

Internet Explorer 8 introduces the xdomainrequest Cross-Site Data Acquisition Function
Download: Internet Explorer 8.0 (IE8) Chinese Version
This is a very interesting feature for Cross-site data acquisition, but it works differently with cross-site XMLHttpRequest in Firefox 3. Its cross-origin is not unrestricted. The server must return an HTTP header containing xdomainrequestallowed = 1 to enable cross-origin. Otherwise, the request fails.
Xmlrequest cannot be a cross-site attack that has always been a severe injury to a multi-subdomain server. In many cases, we have to consider the most primitive dynamic script and JSON methods. However, the IE8 Team intends to solve the problem of cross-site data access, which is an improvement of IE8.
In addition, XMLHttpRequest in IE8 adds a very important attribute timeout and ontimeout methods, which are extremely important in program optimization.
Dom vulnerability repair
In IE 8, getattribute/setattribute has been significantly improved. To put it simply, they can now complete their own tasks. there is no gap between IE8 and other browsers in this regard. The notorious accessing relative/absolute href/src attribute problem has also been solved, which is a great improvement. In addition, hasattribute is added.
Other additions and fixes include:
•. Ownerelement and. ownerdocument. Now we finally have a unified method to process the sub-framework.
• Getelementbyid can be used to return objects. This is a long-awaited feature.
• Getattribute ("checked") returns "checked" instead of "true.
• The radio button for dynamic creation (or modification) can now be selected.
I'm so happy and angry with these fixes. I'm glad that Microsoft finally made the correct changes to them. What's so angry is that Microsoft took so long to make the correct changes.
W3C: Event
This feature is completely missing from IE 8. We still need to continue using the IE attachevent system, and we cannot see the arrival of addeventlistener. I don't know how much the lack of this function will affect the acid3 support of IE 8. However, acid3 already includes the addeventlistener test, therefore, Microsoft may have begun to consider adding support for it.
To some extent, I can understand that Microsoft wants to retain its existing APIs, but I cannot understand why they are not interested and support addeventlistener. I guess the reason may be that Microsoft has to support concepts like event capture.
I am very disappointed with this. I think this is an urgent need for correction in the next version.
Javascript Language
The IE team has made significant improvements to improve garbage collection, memory management, and performance. These improvements are significant to the development of many of our applications.
However, I still need to correct it. Although IE 8 is a great browser for JavaScript developers, if you are more accurate, you may just be happy with the "javascript + DOM" developer. For JavaScript alone, IE 8 is quite disappointing: no new pure JavaScript functionality is available in browsers of this version. I can only hope to add more improvements in the next version.

Aria support
Download: Internet Explorer 8.0 (IE8) Chinese Version
This is a change that I am very satisfied. Aria is an amazing specification that enables web applications to communicate clearly with readers. Before that, ie lacked support for it, but now this defect has been compensated in IE 8. Currently, Firefox, ie, and opera all support Aria. The WebKit team does not seem to be interested in supporting this feature, which is really incomprehensible.
Embedded SVG
Currently, support for Embedded naming elements has been added to IE 8. This means that you can inline tag SVG and methyl. From this point of view, ie is expected to add native support for SVG in the future.
IE Web Developer: firebug for IE
In IE browser, we finally saw this firebug-like tool. In the original words of firebug creator joe hewitt, "I am very happy that Microsoft has completely copied the firebug feature in IE8 ." I have to admit that similar tools have existed for a long time and are very popular with developers.
IE Web Developer allows you to check and edit your HTML Dom, Display Error information and log information, display website source code, and monitor DHTML events and HTTP traffic.
Browse mode switch
At first glance, because of this function, you can check whether your IE 7 web page can be displayed in IE 8. In fact, its real purpose is, developers can develop a standard compatible web page (IE8, Firefox, Safari, and opera) and view the Display Effect in IE 7. For developers, this is a very useful function, because we do not need to use other versions of Internet Explorer in the virtual machine to test the web page effect.
Bug feedback
The IE team collects feedback from testers and then publishes the vulnerability to a publicly accessible website. This is a wise improvement for Microsoft. Here, you can see Microsoft's vulnerability improvement information.
Conclusion
In general, although IE 8 has its own shortcomings, I still have a positive view on this new version of IE browser. Functions such as queryselector, Aria, and postmessage are very helpful to developers.
For those shortcomings, such as the absence of new JavaScript Functions, W3C event support, and css3 selectors, I think they will be improved in future versions.
If the Microsoft IE team can continue to follow this correct direction, I think what IE will leave us is no longer just disappointment.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.