diff --git a/tns-core-modules/application/application.android.ts b/tns-core-modules/application/application.android.ts index 25e04594bd..22c7f7c54a 100644 --- a/tns-core-modules/application/application.android.ts +++ b/tns-core-modules/application/application.android.ts @@ -177,11 +177,13 @@ export function run(entry?: NavigationEntry | string) { _start(entry); } -export function addCss(cssText: string): void { +export function addCss(cssText: string, attributeScoped?: boolean): void { notify({ eventName: "cssChanged", object: androidApp, cssText: cssText }); - const rootView = getRootView(); - if (rootView) { - rootView._onCssStateChange(); + if (!attributeScoped) { + const rootView = getRootView(); + if (rootView) { + rootView._onCssStateChange(); + } } } diff --git a/tns-core-modules/application/application.d.ts b/tns-core-modules/application/application.d.ts index 48217c411b..c64f5102e0 100644 --- a/tns-core-modules/application/application.d.ts +++ b/tns-core-modules/application/application.d.ts @@ -171,8 +171,9 @@ export function loadAppCss(); /** * Adds new values to the application styles. * @param cssText - A valid styles which will be added to the current application styles. +* @param attributeScoped - Whether the styles are attribute scoped. Adding attribute scoped styles will not perform a full application styling refresh. */ -export function addCss(cssText: string): void; +export function addCss(cssText: string, attributeScoped?: boolean): void; /** * This event is raised when application css is changed. diff --git a/tns-core-modules/application/application.ios.ts b/tns-core-modules/application/application.ios.ts index 60fd1fda89..84179f9435 100644 --- a/tns-core-modules/application/application.ios.ts +++ b/tns-core-modules/application/application.ios.ts @@ -370,11 +370,13 @@ export function run(entry?: string | NavigationEntry) { _start(entry); } -export function addCss(cssText: string): void { +export function addCss(cssText: string, attributeScoped?: boolean): void { notify({ eventName: "cssChanged", object: iosApp, cssText: cssText }); - const rootView = getRootView(); - if (rootView) { - rootView._onCssStateChange(); + if (!attributeScoped) { + const rootView = getRootView(); + if (rootView) { + rootView._onCssStateChange(); + } } }