diff --git a/tns-core-modules/application/application.android.ts b/tns-core-modules/application/application.android.ts index 8f1b29dd05..e7c1592837 100644 --- a/tns-core-modules/application/application.android.ts +++ b/tns-core-modules/application/application.android.ts @@ -195,11 +195,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 8573af625a..d297665d50 100644 --- a/tns-core-modules/application/application.d.ts +++ b/tns-core-modules/application/application.d.ts @@ -181,8 +181,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 722af4176f..600724ddd5 100644 --- a/tns-core-modules/application/application.ios.ts +++ b/tns-core-modules/application/application.ios.ts @@ -419,11 +419,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(); + } } }