Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var adjacencyOperators, _fn;
- adjacencyOperators = {
- append: 'beforeEnd',
- prepend: 'afterBegin',
- before: 'beforeBegin',
- after: 'afterEnd'
- };
- _fn = function(key) {
- return $.fn[key] = function(html) {
- return this.each(function(element) {
- return element['insertAdjacent' + (html instanceof Element ? 'Element' : 'HTML')](operator, html);
- });
- };
- };
- for (key in adjacencyOperators) {
- _fn(key);
- }
Add Comment
Please, Sign In to add comment