Guest User

Untitled

a guest
Jul 16th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. var adjacencyOperators, _fn;
  2. adjacencyOperators = {
  3. append: 'beforeEnd',
  4. prepend: 'afterBegin',
  5. before: 'beforeBegin',
  6. after: 'afterEnd'
  7. };
  8. _fn = function(key) {
  9. return $.fn[key] = function(html) {
  10. return this.each(function(element) {
  11. return element['insertAdjacent' + (html instanceof Element ? 'Element' : 'HTML')](operator, html);
  12. });
  13. };
  14. };
  15. for (key in adjacencyOperators) {
  16. _fn(key);
  17. }
Add Comment
Please, Sign In to add comment