Summary of the front-end development section [compatibility, DOM operations, cross-origin, etc.] (continuous update) _ jquery

Source: Internet
Author: User
I have been working on this project in the company for more than six months. To sum up some questions, I hope more friends can share some tips. Project Background:. Net 3.5 + MySQL + jQuery + WebService
I have been working on this project in my company for more than six months. To sum up some questions, I hope more friends in the garden can share some tips.
1. the return value of the WebService method cannot be void.
When the returned value of the WebService method is void, FF and Chrome will continue to wait and think that the request is not over, and everything in IE is normal.
2. When the input type = "button" or the button is used, clicking it triggers the form submit.
At that time, the problem of page refresh was found for a long time, and the final result was that the button automatically triggers the form submit, resulting in the refresh of the current page.
3. Set document. domain in js only from second-level domain name to top-level domain name.
For example, if you access moozi.cnblogs.com, you can write document on this page. domain = 'cnblogs. com '; if you set the domain to cnblogs.com, you cannot use document. domain = 'moozi .cnblogs.com ';.
4. Use DOM fragments to create iframe. When cross-origin is used, you cannot use js to write the iframe domain.
For example, you can set the domain document. domain = 'cnblogs. com' in the export ifrm = createElement ('iframe') example '.
5. When you modify the front domain, CKEditor is normal, and tinyMCE needs to reset the domain.
CKEditor can automatically identify the current domain without errors. TinyMCE must be set manually. At the same time, if you use CKFinder to upload a file and you need to modify its input code, otherwise there will be an error message indicating no permission due to different domains.
6. When tinyMCE is used, although your initialization code has only one sentence, it may appear as early as possible. The cause is unknown. This BUG may occur if you are not sure.
7. When developing js components, always pay attention to the reference of closures and this, which has suffered a lot of losses.
8. When converting a string to a jQuery object, pay attention to the closed tag of the string html code.
For example, var html = 'test' var jqEl = $ (html); in this case, jqEl will discard ''in html.
9. jQuery1.2.6 and jQuery1.3 differ in details.
JQuery1.2.6 fails to process hasClass ('. classname'), but jQuery1.3 does not.
10. Use jQuery's each as little as possible, and use JavaScript native code for high performance.
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.