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
Analyze the execution process. Move the mouse int...
There is another tree structure Javascript object...
There are many seemingly true "rumors" ...
vue-cli uses stimulsoft.reports.js (nanny-level t...
1. First go to the official website https://www.p...
Preface For a long time, the application and lear...
Talk about the scene Send Email Embedding HTML in...
1. If MySQL is not started successfully, check th...
1. Edit the docker.service file vi /usr/lib/syste...
Table of contents Cause of the problem: Solution:...
mysql gets all dates or months in a time period 1...
Preface The project requirement is to determine w...
When the scale of Docker deployment becomes large...
Preface What is state We all say that React is a ...
For example: <u> This has no ending characte...