Home Web Front-end JS Tutorial Summary of front-end development [compatibility, DOM operations, cross-domain, etc.] (continuously updated)_jquery

Summary of front-end development [compatibility, DOM operations, cross-domain, etc.] (continuously updated)_jquery

May 16, 2016 pm 06:33 PM
Front-end development

Project background: .Net 3.5 MySQL jQuery WebService
I have been working on this project in the company for more than 6 months. To summarize some problems, it can be considered as a way to attract new ideas. I hope more friends in the garden can share some skills.
1. The return value of the WebService method cannot be void.
When the return value of the WebService method is void, FF and Chrome will continue to wait, thinking that the request has not ended, but everything is normal in IE.
2. When the input type="button" or when using button, the submit of the form will be triggered after clicking.
I searched for the problem of page refresh for a long time, and finally discovered that the button would automatically trigger the submit of the form, causing the current page to be refreshed.
3. The js setting document.domain can only be set from the second-level domain name to the top-level domain name.
For example, when visiting moozi.cnblogs.com, you can write document.domain='cnblogs.com' on this page; if you set the domain to cnblogs.com, you can no longer use document.domain='moozi.cnblogs.com. ';.
4. Use DOM fragments to create iframes. When crossing domains, you cannot use js to write the domain of the iframe.
For example, if you use js to set the domain to document.domain='cnblogs.com' on the moozi.cnblogs.com/test.html page, and then use var ifrm=createElement('iframe'), then The domain where iframe cannot be set using js is also 'cnblogs.com'. You can only set ifrm.src='test2.htm' and set the domain document.domain='cnblogs.com' in test2.htm.
5. When you have modified the current domain, CKEditor is normal, but tinyMCE needs to reset the domain.
CKEditor can automatically identify the current domain without making any mistakes. tinyMCE requires manual setup. At the same time, if you use CKFinder to upload files, you need to modify its input code, otherwise an error message of no permissions will appear due to different domains.
6. Using tinyMCE, even though your initialization code only has one sentence, initialization may occur multiple times. The cause is unknown, and this BUG occurs under uncertain circumstances.
7. When developing js components, you must always pay attention to the closure and this reference. You have suffered a lot in this regard before.
8. When converting a string into a jQuery object, pay attention to the closing tag of the string html code.
For example: var html='test 'var jqEl=$(html); At this time, jqEl will discard the ' ' in the html.
9. There are some differences in the details of jQuery1.2.6 and jQuery1.3.
jQuery1.2.6 will make an error when processing hasClass('.className'), but jQuery1.3 will not.
10. Use jQuery’s each as little as possible and use more native js code, which has higher performance.

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Learn some of the front-end development trends that will be highlighted in 2023! Learn some of the front-end development trends that will be highlighted in 2023! Mar 14, 2023 am 09:37 AM

Front-end development trends are always evolving, and some trends stay popular for a long time. This article summarizes some front-end development trends that will be highlighted in 2023 and shares them with you~

How to use PHP and Angular for front-end development How to use PHP and Angular for front-end development May 11, 2023 pm 04:04 PM

With the rapid development of the Internet, front-end development technology is also constantly improving and iterating. PHP and Angular are two technologies widely used in front-end development. PHP is a server-side scripting language that can handle tasks such as processing forms, generating dynamic pages, and managing access permissions. Angular is a JavaScript framework that can be used to develop single-page applications and build componentized web applications. This article will introduce how to use PHP and Angular for front-end development, and how to combine them

Flet: a cross-platform Flutter-based Python framework Flet: a cross-platform Flutter-based Python framework Apr 20, 2023 pm 05:46 PM

Yesterday I just posted a micro-headline about the complete collection of Python desktop development libraries, and my colleague discovered the Flet library. This is a very new library. The first version was only released in June this year. Although it is very new, it is backed by the giant Flutter and allows us to use Python to develop full-platform software. Although it does not currently support all platforms, According to the author’s plan, whatever Flutter supports, it will support in the future. I briefly studied it yesterday and it’s really great. I recommend it to everyone. We can use it to do a series of things later. What is FletFlet is a framework that allows building interactive multi-user web, desktop and mobile applications in your favorite language without having to have front-end development experience. host

Learn to use sessionstorage to improve front-end development efficiency Learn to use sessionstorage to improve front-end development efficiency Jan 13, 2024 am 11:56 AM

To master the role of sessionStorage and improve front-end development efficiency, specific code examples are required. With the rapid development of the Internet, the field of front-end development is also changing with each passing day. When doing front-end development, we often need to process large amounts of data and store it in the browser for subsequent use. SessionStorage is a very important front-end development tool that can provide us with temporary local storage solutions and improve development efficiency. This article will introduce the role of sessionStorage,

Summary of experience in JavaScript asynchronous requests and data processing in front-end development Summary of experience in JavaScript asynchronous requests and data processing in front-end development Nov 03, 2023 pm 01:16 PM

Summary of experience in JavaScript asynchronous requests and data processing in front-end development In front-end development, JavaScript is a very important language. It can not only achieve interactive and dynamic effects on the page, but also obtain and process data through asynchronous requests. In this article, I will summarize some experiences and tips when dealing with asynchronous requests and data. 1. Use the XMLHttpRequest object to make asynchronous requests. The XMLHttpRequest object is used by JavaScript to send

What is node.red What is node.red Nov 08, 2022 pm 03:53 PM

node.red refers to Node-RED, a flow-based low-code programming tool for connecting hardware devices, APIs, and online services in new and interesting ways; it provides a browser-based editor that enables We can easily connect flows together using various nodes in the edit panel and deploy them to their runtime with just a click.

The difference and connection between front-end and back-end development The difference and connection between front-end and back-end development Mar 26, 2024 am 09:24 AM

Front-end and back-end development are two essential aspects of building a complete web application. There are obvious differences between them, but they are closely related. This article will analyze the differences and connections between front-end and back-end development. First, let’s take a look at the specific definitions and tasks of front-end development and back-end development. Front-end development is mainly responsible for building the user interface and user interaction part, that is, what users see and operate in the browser. Front-end developers typically use technologies such as HTML, CSS, and JavaScript to implement the design and functionality of web pages

The key optimization mode to improve website speed, every front-end developer must master! The key optimization mode to improve website speed, every front-end developer must master! Feb 02, 2024 pm 05:36 PM

A must-have for front-end developers: master these optimization modes and make your website fly! With the rapid development of the Internet, websites have become one of the important channels for corporate promotion and communication. A well-performing, fast-loading website not only improves user experience, but also attracts more visitors. As a front-end developer, it is essential to master some optimization patterns. This article will introduce some commonly used front-end optimization techniques to help developers better optimize their websites. Compressed files In website development, commonly used file types include HTML, CSS and J

See all articles