Browser compatibility is the most important part that is easily overlooked in actual development. Before we talk about the compatibility issues of older versions of browsers, we must first understand what capability detection is. It is used to detect whether the browser has this capability, that is, to determine whether the current browser supports the properties or methods to be called. Some brief introductions are given below. 1. innerText and innerContent JavaScript CodeCopy content to clipboard
2. Compatibility issues in obtaining sibling nodes/elements 1) Brother nodes, supported by all browsers ①nextSibling The next sibling node, which may be a non-element node; the text node will be obtained ②previousSibling The previous sibling node, which may be a non-element node; the text node will be obtained 2) Brother elements, not supported before IE8 ①previousElementSibling gets the previous adjacent sibling element, ignoring blank spaces ②nextElementSibling gets the next adjacent sibling element, ignoring blanks JavaScript CodeCopy content to clipboard
JavaScript CodeCopy content to clipboard
JavaScript CodeCopy content to clipboard
JavaScript CodeCopy content to clipboard
JavaScript CodeCopy content to clipboard
3. array.filter(); JavaScript CodeCopy content to clipboard
// Traverse the array JavaScript CodeCopy content to clipboard
JavaScript CodeCopy content to clipboard
JavaScript CodeCopy content to clipboard
6. Event Object 1) Event parameter e is the event object, which is obtained in a standard way btn.onclick = function(e) { } 2) e.eventPhase event phase, not supported before IE8 3) e.target is always the object that triggered the event (the button that was clicked) i) srcElement before IE8 ii) Browser compatibility var target = e.target || window.event.srcElement; JavaScript CodeCopy content to clipboard
7. Get the mouse position on the page ① Position in the visible area: e.clientX e.clientY ②Position in the document: ii) Browser compatibility JavaScript CodeCopy content to clipboard
8. Get the page scroll distance JavaScript CodeCopy content to clipboard
9. Deselect text JavaScript CodeCopy content to clipboard
The above brief discussion on browser compatibility issues in JavaScript is all the content that the editor shares with you. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM. |
<<: How to display and format json data on html page
1. Download, install and activate CLion Just foll...
There are many versions of the Java language. In ...
Sometimes we need to control whether HTML elements...
Table of contents 2. Tried methods 2.1 keep-alive...
What is a table? It is composed of cell cells. In...
Achieve results step 1. Initial index.html To bui...
Table of contents Preface introduce 1. Mechanism ...
A simple record of the database startup problems ...
Table of contents 1. Bootstrap5 breakpoints 1.1 M...
[LeetCode] 183.Customers Who Never Order Suppose ...
yum or rpm? The yum installation method is very c...
Effect picture: 1. Introduction Your own applet n...
Detailed Analysis of Iframe Usage <iframe frame...
Preface Before leaving get off work, the author r...
Table of contents Docker deployment Always on clu...