Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

fix(*): do not break when modules are used with angular-loader #14794

Closed
wants to merge 7 commits into from
2 changes: 1 addition & 1 deletion src/ngSanitize/.jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"window": false,

"angular": false,
"htmlSanitizeWriter": false
"sanitizeText": false
}
}
11 changes: 6 additions & 5 deletions src/ngSanitize/filter/linky.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use strict';

/* global sanitizeText: false */

/**
* @ngdoc filter
* @name linky
Expand Down Expand Up @@ -135,15 +133,18 @@ angular.module('ngSanitize').filter('linky', ['$sanitize', function($sanitize) {
MAILTO_REGEXP = /^mailto:/i;

var linkyMinErr = angular.$$minErr('linky');
var isDefined = angular.isDefined;
var isFunction = angular.isFunction;
var isObject = angular.isObject;
var isString = angular.isString;

return function(text, target, attributes) {
if (text == null || text === '') return text;
if (!isString(text)) throw linkyMinErr('notstring', 'Expected string but received: {0}', text);

var attributesFn =
angular.isFunction(attributes) ? attributes :
angular.isObject(attributes) ? function getAttributesObject() {return attributes;} :
isFunction(attributes) ? attributes :
isObject(attributes) ? function getAttributesObject() {return attributes;} :
function getEmptyAttributesObject() {return {};};

var match;
Expand Down Expand Up @@ -181,7 +182,7 @@ angular.module('ngSanitize').filter('linky', ['$sanitize', function($sanitize) {
html.push(key + '="' + linkAttributes[key] + '" ');
}

if (angular.isDefined(target) && !('target' in linkAttributes)) {
if (isDefined(target) && !('target' in linkAttributes)) {
html.push('target="',
target,
'" ');
Expand Down
Loading