MCPcopy
hub / github.com/angular-ui/ui-router / jqLiteOff

Function jqLiteOff

test/angular/1.7/angular.js:3300–3338  ·  view source on GitHub ↗
(element, type, fn, unsupported)

Source from the content-addressed store, hash-verified

3298}
3299
3300function jqLiteOff(element, type, fn, unsupported) {
3301 if (isDefined(unsupported)) throw jqLiteMinErr('offargs', 'jqLite#off() does not support the `selector` argument');
3302
3303 var expandoStore = jqLiteExpandoStore(element);
3304 var events = expandoStore && expandoStore.events;
3305 var handle = expandoStore && expandoStore.handle;
3306
3307 if (!handle) return; //no listeners registered
3308
3309 if (!type) {
3310 for (type in events) {
3311 if (type !== '$destroy') {
3312 element.removeEventListener(type, handle);
3313 }
3314 delete events[type];
3315 }
3316 } else {
3317
3318 var removeHandler = function(type) {
3319 var listenerFns = events[type];
3320 if (isDefined(fn)) {
3321 arrayRemove(listenerFns || [], fn);
3322 }
3323 if (!(isDefined(fn) && listenerFns && listenerFns.length > 0)) {
3324 element.removeEventListener(type, handle);
3325 delete events[type];
3326 }
3327 };
3328
3329 forEach(type.split(' '), function(type) {
3330 removeHandler(type);
3331 if (MOUSE_EVENT_MAP[type]) {
3332 removeHandler(MOUSE_EVENT_MAP[type]);
3333 }
3334 });
3335 }
3336
3337 removeIfEmptyData(element);
3338}
3339
3340function jqLiteRemoveData(element, name) {
3341 var expandoId = element.ng339;

Callers 1

angular.jsFile · 0.70

Calls 5

removeIfEmptyDataFunction · 0.85
isDefinedFunction · 0.70
jqLiteExpandoStoreFunction · 0.70
forEachFunction · 0.70
removeHandlerFunction · 0.70

Tested by

no test coverage detected