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

Function jqLiteOff

test/angular/1.6/angular.js:3273–3309  ·  view source on GitHub ↗
(element, type, fn, unsupported)

Source from the content-addressed store, hash-verified

3271}
3272
3273function jqLiteOff(element, type, fn, unsupported) {
3274 if (isDefined(unsupported)) throw jqLiteMinErr('offargs', 'jqLite#off() does not support the `selector` argument');
3275
3276 var expandoStore = jqLiteExpandoStore(element);
3277 var events = expandoStore && expandoStore.events;
3278 var handle = expandoStore && expandoStore.handle;
3279
3280 if (!handle) return; //no listeners registered
3281
3282 if (!type) {
3283 for (type in events) {
3284 if (type !== '$destroy') {
3285 element.removeEventListener(type, handle);
3286 }
3287 delete events[type];
3288 }
3289 } else {
3290
3291 var removeHandler = function(type) {
3292 var listenerFns = events[type];
3293 if (isDefined(fn)) {
3294 arrayRemove(listenerFns || [], fn);
3295 }
3296 if (!(isDefined(fn) && listenerFns && listenerFns.length > 0)) {
3297 element.removeEventListener(type, handle);
3298 delete events[type];
3299 }
3300 };
3301
3302 forEach(type.split(' '), function(type) {
3303 removeHandler(type);
3304 if (MOUSE_EVENT_MAP[type]) {
3305 removeHandler(MOUSE_EVENT_MAP[type]);
3306 }
3307 });
3308 }
3309}
3310
3311function jqLiteRemoveData(element, name) {
3312 var expandoId = element.ng339;

Callers 1

jqLiteRemoveDataFunction · 0.70

Calls 4

isDefinedFunction · 0.70
jqLiteExpandoStoreFunction · 0.70
forEachFunction · 0.70
removeHandlerFunction · 0.70

Tested by

no test coverage detected