mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-16 01:52:19 +08:00
fix(angular): avoid forEach in classList
This commit is contained in:

committed by
Manu MA

parent
723296e9b2
commit
359bdcf8ec
@ -54,10 +54,15 @@ function setIonicClasses(element: ElementRef) {
|
||||
'ion-pristine'
|
||||
);
|
||||
|
||||
classList.forEach((cls: string) => {
|
||||
if (cls.startsWith('ng-')) {
|
||||
classList.add(`ion-${cls.substr(3)}`);
|
||||
for (let i = 0; i < classList.length; i++) {
|
||||
const item = classList.item(i);
|
||||
if (item && startsWith(item, 'ng-')) {
|
||||
classList.add(`ion-${item.substr(3)}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function startsWith(input: string, search: string): boolean {
|
||||
return input.substr(0, search.length) === search;
|
||||
}
|
||||
|
Reference in New Issue
Block a user