Skip to content

Instantly share code, notes, and snippets.

@sposmen
Last active July 15, 2016 16:13
Show Gist options
  • Save sposmen/762b8ae244e1c50d21e76531e7159e8d to your computer and use it in GitHub Desktop.
Save sposmen/762b8ae244e1c50d21e76531e7159e8d to your computer and use it in GitHub Desktop.
var attrsToRemove = {
'[ng-bind]': 'ng-bind',
'[ng-repeat]': 'ng-repeat',
'[ng-bind-html]': 'ng-bind-html',
'[ng-controller]': 'ng-controller',
'[ng-if]': 'ng-if',
'[ng-class]': 'ng-class',
'[ng-click]': 'ng-click',
'[ng-show]': 'ng-show',
'[ng-hide]': 'ng-hide',
'[ng-model]': 'ng-model',
'[ng-switch-when]': 'ng-switch-when',
'[ng-switch-default]': 'ng-switch-default',
'[ng-switch]': 'ng-switch',
'[ng-include]': 'ng-include',
'[ng-style]': 'ng-style',
'[ng-change]': 'ng-change',
'[ng-href]': 'ng-href',
'[ng-src]': 'ng-src',
'[ng-keydown]': 'ng-keydown',
'[ng-blur]': 'ng-blur',
'[ng-disabled]': 'ng-disabled',
'[ng-submit]': 'ng-submit',
'[ng-transclude]': 'ng-transclude',
'[go-to]': 'go-to',
'[bo-if]': 'bo-if',
'[bo-title]': 'bo-title',
'[bo-bind]': 'bo-bind',
'[bo-html]': 'bo-html',
'[bo-show]': 'bo-show',
'[badge-type]': ['badge-type', 'badge-popover'],
'[bindonce]': 'bindonce',
'[toggle-cover]': 'toggle-cover',
'[fulltext-banner]': 'fulltext-banner',
'[slider]': 'slider',
'[document]': ['document', 'document-summary', 'saveable'],
'[springshare-v2]': 'springshare-v2',
'[search-box]': 'search-box',
'[call-close-menu]': 'call-close-menu',
'[custom-links]': 'custom-links',
'[back-to-top]': ['back-to-top', 'ancestor-selector'],
'[vpn-banner]': 'vpn-banner',
'[home-view]': 'home-view',
'[facet-datepickers]': 'facet-datepickers',
'[datepicker]': ['format-year', 'format-month', 'format-day', 'show-weeks', 'year-range', 'datepicker', 'max-date', 'datepicker-mode', 'datepicker-options'],
'[aria-pressed]': 'aria-pressed',
'[flash-tooltip]': ['flash-tooltip','tooltip-animation','tooltip-trigger'],
'[tooltip]': ['tooltip-placement'],
'[saved-items-folder]': 'saved-items-folder',
'[scroll-to-top]': 'scroll-to-top',
'[ellipsis]': ['ellipsis', 'ellipsis-height', 'ellipsis-after'],
'[facet-field]':'facet-field',
'[focus-me]':'focus-me',
'[language-switcher]':'language-switcher',
'[chat-widget-link]':'chat-widget-link',
'[availability]':['availability', 'av-doc', 'limit', 'open-detail-page', 'open-click-track-link'],
'body': ['layout', 'when-scrolled','key-events','idle-timer'],
'aside[refinements]':'refinements',
'div[quick-filters]':'quick-filters',
'div[on]':'on',
'div[facet-fields]':'facet-fields',
'div[rollup-image]':['rollup-image', 'image','author-search','open-link'],
'div[authors]':['linked-author-list', 'authors','limit','hide-prefix','author-search'],
'form[click-track-link-form]':'click-track-link-form',
'form[flow-toggle-form]':'flow-toggle-form',
'span[doc]':['doc', 'hide-less-than']
};
$.fn.removeAttrs = function () {
// Convert all passed arguments to an array
var args = Array.prototype.slice.call(arguments),
attr;
// Handle passing arrays or space-separated strings
if (args.length == 1)
args = $.isArray(args[0]) ? args[0] : args[0].split(" ");
// Loop, removing the first array item on each iteration
while (attr = args.shift())
this.removeAttr(attr);
// Return the jQuery object for chaining
return this;
};
Object.keys(attrsToRemove).forEach(function(selector){
$(selector).removeAttrs(attrsToRemove[selector])
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment