Guest User

Untitled

a guest
Mar 24th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. // this is some vile monkey patching, think of it what you will, I find it useful
  2.  
  3. if('undefined' === typeof window.qs) {
  4. window.qs = document.querySelector.bind(document);
  5. }
  6.  
  7. if('undefined' === typeof window.qsa) {
  8. window.qsa = document.querySelectorAll.bind(document);
  9. }
  10.  
  11. if('undefined' === typeof Element.prototype.qs) {
  12. Element.prototype.qs = Element.prototype.querySelector;
  13. }
  14.  
  15. if('undefined' === typeof Element.prototype.qsa) {
  16. Element.prototype.qsa = Element.prototype.querySelectorAll;
  17. }
  18.  
  19. if('undefined' === typeof Element.prototype.on) {
  20. Element.prototype.on = Element.prototype.addEventListener;
  21. }
  22.  
  23. if('undefined' === typeof document.on) {
  24. document.on = document.addEventListener;
  25. }
Add Comment
Please, Sign In to add comment