Summary on compatibility of Javascript in event listening

Source: Internet
Author: User

1. ie uses the attachevent/detachevent method to add and delete event listeners. W3C uses the addeventlistener/removeeventlistener method.

2. ie uses the onevent naming method for its events, while W3C uses the event naming method.

3. the IE event listener uses a global event object, while W3C passes the event object as a parameter to the listener.

4. To avoid triggering default event behaviors, ie requiresProgramThe property value of returnvalue In the event object is set to false, while W3C implements the preventdefault method.

5. ie does not support the event capture phase.

6. To stop event transfer, ie sets the cancelbubble of the event object to true, while W3C sets the stoppropagation method.

7. ie calls the event listener as an independent function, while W3C calls the listener as an object method, this indicates that the this keyword in the event listener in IE points to a useless Global Object (window object) instead of an event occurrence object ).

8. Memory leakage occurs in IE when using event listeners. In IE, if you want to create an event listener for an element and use it in the listener, before the user enters other pages, the memory occupied by the listener and related DOM nodes will not be released.

Related Article

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.