you might not need jquery

What's the oldest version of IE you need to support? IE10

 1 /**json**/
 2 var request = new XMLHttpRequest();
 3 request.open('GET', '/my/url', true);
 4 
 5 request.onload = function() {
 6   if (this.status >= 200 && this.status < 400) {
 7     // Success!
 8     var data = JSON.parse(this.response);
 9   } else {
10     // We reached our target server, but it returned an error
11 
12   }
13 };
14 
15 request.onerror = function() {
16   // There was a connection error of some sort
17 };
18 
19 request.send();
 1 /**request**/
 2 var request = new XMLHttpRequest();
 3 request.open('GET', '/my/url', true);
 4 
 5 request.onload = function() {
 6   if (this.status >= 200 && this.status < 400) {
 7     // Success!
 8     var resp = this.response;
 9   } else {
10     // We reached our target server, but it returned an error
11 
12   }
13 };
14 
15 request.onerror = function() {
16   // There was a connection error of some sort
17 };
18 
19 request.send();
1 /**post**/
2 var request = new XMLHttpRequest();
3 request.open('POST', '/my/url', true);
4 request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
5 request.send(data);
/**hide**/
el.style.display = 'none';
 1 /**fade in**/
 2 /**javascript**/
 3 <script>
 4     el.classList.add('show');
 5     el.classList.remove('hide');
 6 </script>
 7 <style>
 8     .show {
 9       transition: opacity 400ms;
10     }
11     .hide {
12       opacity: 0;
13     }
14 </style>
/**show**/
el.style.display = '';
/**add class**/
el.classList.add(className);
/**after**/
el.insertAdjacentHTML('afterend', htmlString);
/**append**/
parent.appendChild(el);
/**before**/
el.insertAdjacentHTML('beforebegin', htmlString);
/**clone**/
el.cloneNode(true);
/**contains**/
el !== child && el.contains(child);
/**children**/
el.children
/**Contains Selector**/
el.querySelector(selector) !== null
/**Each**/
var elements = document.querySelectorAll(selector);
Array.prototype.forEach.call(elements, function(el, i){

});
/**Empty**/
el.innerHTML = '';
业精于勤荒于嬉,行成于思毁于随
原文地址:https://www.cnblogs.com/qixianchuan/p/11308792.html