Front-End development section summarizes [compatibility, Dom operations, Cross-domain, etc.] (continuous update) _jquery

Source: Internet
Author: User
Project background:. Net 3.5+mysql+jquery+webservice
In the company to do this project has been 6 months, summed up a number of questions, but also a discussion, I hope that more friends in the garden to share some skills.
1, the WebService method return value cannot be void.
When the WebService method returns a value of void, FF and chrome continue to wait, thinking that the request is not over, and that everything is normal in IE.
2, when the input of the type= "button" or Use button, click Will trigger the form of submit.
Looking for a page to refresh the problem for a long time, finally found that the button will automatically trigger the form of submit, resulting in the current page refresh.
3, JS set document.domain only from the level two domain name set to the top-level domain name.
For example, to visit moozi.cnblogs.com, you can write document.domain= ' cnblogs.com ' in this page, and if you set the field to cnblogs.com, you can't use document.domain= ' Moozi.cnblogs.com ';.
4, using the DOM fragment to create an IFRAME, when cross-domain, can not use JS to write the domain of the IFRAME.
For example, you use JS in the Moozi.cnblogs.com/test.html page to set the domain to document.domain= ' cnblogs.com ', and at this time you use var ifrm=createelement (' iframe '), At this time will not use JS set the domain of the IFRAME is also ' cnblogs.com ', only let ifrm.src= ' test2.htm ', and set the domain document.domain= ' cnblogs.com ' in test2.htm.
5, when you modify the current domain, CKEditor is normal, and TINYMCE need to reset the domain.
CKEditor can automatically identify the current domain without error. TinyMCE needs to be artificially set up. At the same time, if you are using Ckfinder upload file, and need to modify its input code, otherwise there will be no permissions due to the different domain error prompts.
6, the use of TINYMCE, although your initialization code only one sentence, but may appear many times as the first. The cause is unknown and this bug can occur in an indeterminate situation.
7, the development of JS components, we should always pay attention to closures and this refers to, this aspect before eating a lot of losses.
8. When converting a string into a jquery object, pay attention to the closed tag of the string HTML code.
For example: Var html= ' <span>test</span> ' var jqel=$ (HTML); At this point, Jqel will throw out the HTML.
9, jQuery1.2.6 and jQuery1.3 have some differences in the handling of details.
jQuery1.2.6 processing Hasclass ('. ClassName ') will go wrong, and jQuery1.3 will not.
10, as little as possible with jquery each, more with JS native code, higher performance.

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.