Skip to content

Commit 769a4b0

Browse files
committed
Reorganize types
1 parent 804bde0 commit 769a4b0

10 files changed

+4007
-726
lines changed

package-lock.json

-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
"@playwright/test": "^1.44.0",
2727
"@rollup/plugin-commonjs": "latest",
2828
"@rollup/plugin-node-resolve": "latest",
29-
"@types/angular": "latest",
3029
"@types/jasmine": "latest",
3130
"@types/node": "latest",
3231
"eslint": "latest",

src/index.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
import { Angular, allowAutoBootstrap, confGlobal, angularInit } from "./loader";
1+
import { Angular, angularInit } from "./loader";
22
import { publishExternalAPI } from "./public";
33

4-
// Current script not available in submodule
5-
confGlobal.isAutoBootstrapAllowed =
6-
window.AUTOBOOTSTRAP || allowAutoBootstrap(document.currentScript);
74
/**
85
* @type {angular.IAngularStatic}
96
*/

src/jqLite.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1260,7 +1260,7 @@ export function startingTag(element) {
12601260

12611261
/**
12621262
* Return the DOM siblings between the first and last node in the given array.
1263-
* @param {Array} array like object
1263+
* @param {Array} nodes An array-like object
12641264
* @returns {Array} the inputted object or a jqLite collection containing the nodes
12651265
*/
12661266
export function getBlockNodes(nodes) {

src/loader.js

+2-58
Original file line numberDiff line numberDiff line change
@@ -666,62 +666,6 @@ export class Angular {
666666

667667
/// //////////////////////////////////////////////
668668

669-
export function allowAutoBootstrap(currentScript) {
670-
const script = currentScript;
671-
672-
// If the `currentScript` property has been clobbered just return false, since this indicates a probable attack
673-
if (
674-
!(
675-
script instanceof window.HTMLScriptElement ||
676-
script instanceof window.SVGScriptElement
677-
)
678-
) {
679-
return false;
680-
}
681-
682-
const { attributes } = script;
683-
const srcs = [
684-
attributes.getNamedItem("src"),
685-
attributes.getNamedItem("href"),
686-
attributes.getNamedItem("xlink:href"),
687-
];
688-
689-
return srcs.every((src) => {
690-
if (!src) {
691-
return true;
692-
}
693-
if (!src.value) {
694-
return false;
695-
}
696-
697-
const link = document.createElement("a");
698-
link.href = src.value;
699-
700-
if (document.location.origin === link.origin) {
701-
// Same-origin resources are always allowed, even for banned URL schemes.
702-
return true;
703-
}
704-
// Disabled bootstrapping unless angular.js was loaded from a known scheme used on the web.
705-
// This is to prevent angular.js bundled with browser extensions from being used to bypass the
706-
// content security policy in web pages and other browser extensions.
707-
switch (link.protocol) {
708-
case "http:":
709-
case "https:":
710-
case "ftp:":
711-
case "blob:":
712-
case "file:":
713-
case "data:":
714-
return true;
715-
default:
716-
return false;
717-
}
718-
});
719-
}
720-
721-
export const confGlobal = {
722-
isAutoBootstrapAllowed: false,
723-
};
724-
725669
/**
726670
* @ngdoc directive
727671
* @name ngApp
@@ -869,15 +813,15 @@ export function angularInit(element) {
869813
const config = {};
870814

871815
// The element `element` has priority over any other element.
872-
forEach(ngAttrPrefixes, (prefix) => {
816+
ngAttrPrefixes.forEach((prefix) => {
873817
const name = `${prefix}app`;
874818

875819
if (!appElement && element.hasAttribute && element.hasAttribute(name)) {
876820
appElement = element;
877821
module = element.getAttribute(name);
878822
}
879823
});
880-
forEach(ngAttrPrefixes, (prefix) => {
824+
ngAttrPrefixes.forEach((prefix) => {
881825
const name = `${prefix}app`;
882826
let candidate;
883827

0 commit comments

Comments
 (0)