File tree Expand file tree Collapse file tree 6 files changed +27
-26
lines changed
Expand file tree Collapse file tree 6 files changed +27
-26
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,6 @@ export class SanitizeUriProvider implements ServiceProvider {
3535 /**
3636 * @returns {import("./interface").SanitizerFn }
3737 */
38- $get ( ) : any ;
38+ $get : ( string | ( ( $window : ng . WindowService ) => any ) ) [ ] ;
3939}
4040export type ServiceProvider = import ( "../../interface.ts" ) . ServiceProvider ;
Original file line number Diff line number Diff line change 11import { createElementFromHTML , dealoc } from "../shared/dom.js" ;
22import { Angular } from "../angular.js" ;
3- import { isObject , mergeClasses } from "../shared/utils.js" ;
3+ import { isObject } from "../shared/utils.js" ;
44import { isFunction , wait } from "../shared/utils.js" ;
55import { createInjector } from "../core/di/injector.js" ;
66
@@ -496,8 +496,4 @@ describe("$animate", () => {
496496 } ) ;
497497 } ) ;
498498 } ) ;
499-
500- describe ( "mergeClasses" , ( ) => {
501- expect ( mergeClasses ) ;
502- } ) ;
503499} ) ;
Original file line number Diff line number Diff line change 11import { isDefined } from "../../shared/utils.js" ;
2- import { urlResolve } from "../../shared/url-utils/url-utils.js" ;
32
43/** @typedef {import('../../interface.ts').ServiceProvider } ServiceProvider */
54
@@ -55,21 +54,27 @@ export class SanitizeUriProvider {
5554 /**
5655 * @returns {import("./interface").SanitizerFn }
5756 */
58- $get ( ) {
59- return ( uri , isMediaUrl ) => {
60- if ( ! uri ) return uri ;
57+ $get = [
58+ "$window" ,
59+ /** @param {ng.WindowService } $window */
60+ ( $window ) => {
61+ return /** @type {import("./interface").SanitizerFn } */ (
62+ ( uri , isMediaUrl ) => {
63+ if ( ! uri ) return uri ;
6164
62- /** @type {RegExp } */
63- const regex = isMediaUrl
64- ? this . _imgSrcSanitizationTrustedUrlList
65- : this . _aHrefSanitizationTrustedUrlList ;
65+ /** @type {RegExp } */
66+ const regex = isMediaUrl
67+ ? this . _imgSrcSanitizationTrustedUrlList
68+ : this . _aHrefSanitizationTrustedUrlList ;
6669
67- const normalizedVal = urlResolve ( uri . trim ( ) ) . href ;
70+ const normalizedVal = new URL ( uri . trim ( ) , $window . location . href ) . href ;
6871
69- if ( normalizedVal !== "" && ! normalizedVal . match ( regex ) ) {
70- return `unsafe:${ normalizedVal } ` ;
71- }
72- return uri ;
73- } ;
74- }
72+ if ( normalizedVal !== "" && ! normalizedVal . match ( regex ) ) {
73+ return `unsafe:${ normalizedVal } ` ;
74+ }
75+ return uri ;
76+ }
77+ ) ;
78+ } ,
79+ ] ;
7580}
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ describe("sanitizeUri", () => {
88 let $$sanitizeUri ;
99 beforeEach ( ( ) => {
1010 sanitizeUriProvider = new SanitizeUriProvider ( ) ;
11- $$sanitizeUri = sanitizeUriProvider . $get ( ) ;
11+ $$sanitizeUri = sanitizeUriProvider . $get [ 1 ] ( window ) ;
1212
1313 sanitizeHref = function ( uri ) {
1414 return $$sanitizeUri ( uri , false ) ;
Original file line number Diff line number Diff line change @@ -107,7 +107,7 @@ describe("Scope", () => {
107107 } ) ;
108108
109109 describe ( "$nonscope" , ( ) => {
110- it ( "should ignore objects with $nonscope propercoty " , ( ) => {
110+ it ( "should ignore objects with $nonscope property " , ( ) => {
111111 const res = createScope ( { $nonscope : true } ) ;
112112 expect ( res . $id ) . toBeUndefined ( ) ;
113113 } ) ;
@@ -592,7 +592,7 @@ describe("Scope", () => {
592592 expect ( scope . counter ) . toBe ( 4 ) ;
593593 } ) ;
594594
595- it ( "calls only the listeners registerred at the moment the watched value changes" , async ( ) => {
595+ it ( "calls only the listeners registered at the moment the watched value changes" , async ( ) => {
596596 scope . someValue = "a" ;
597597 scope . counter = 0 ;
598598
@@ -823,7 +823,7 @@ describe("Scope", () => {
823823 expect ( scope . $$watchersCount ) . toEqual ( scope . $handler . watchers . size ) ;
824824 } ) ;
825825
826- it ( "should fire upon $watch registration on initial registeration " , async ( ) => {
826+ it ( "should fire upon $watch registration on initial registration " , async ( ) => {
827827 logs = "" ;
828828 scope . a = 1 ;
829829 scope . $watch ( "a" , ( ) => {
Original file line number Diff line number Diff line change @@ -118,7 +118,7 @@ describe("$state", () => {
118118 expect ( $stateProvider ) . toBeDefined ( ) ;
119119 } ) ;
120120
121- it ( "should should not allow states that are already registerred " , ( ) => {
121+ it ( "should should not allow states that are already registered " , ( ) => {
122122 expect ( ( ) => {
123123 $stateProvider . state ( { name : "toString" , url : "/to-string" } ) ;
124124 } ) . not . toThrow ( ) ;
You can’t perform that action at this time.
0 commit comments