If applications have <link rel="stylesheet" href="[theme CSS path]">,
loader skips putting new <link> tag for the theme.
This option only works with proper theme CSS path: if the <script> tag
loads "<path>/<version>/js/tizen-web-ui-fw.js", then the theme CSS path must
be "<path>/<version>/themes/<theme>/tizen-web-ui-fw-theme.css",
having exactly same path to the script path. Otherwise, the link tag will be
ignored, and the new <link> tag will be added automatically.
Change-Id: I9910eb3049f5a73fdc386c40b73409f166dfa1c3
l = null;
// Find css link element
for ( idx = 0; idx < cssLinks.length; idx++ ) {
- if( cssLinks[idx].getAttribute( 'name' ) == "tizen-theme" ) {
+ if( cssLinks[idx].getAttribute( 'rel' ) != "stylesheet" ) {
+ continue;
+ }
+ if( cssLinks[idx].getAttribute( 'name' ) == "tizen-theme"
+ || cssLinks[idx].getAttribute( 'href' ) == path ) {
l = cssLinks[idx];
break;
}
}
if ( l ) { // Found the link element!
- l.setAttribute( 'href', path );
+ if ( l.getAttribute( 'href' ) == path ) {
+ console.log( "Theme is already loaded. Skip theme loading in the framework." );
+ } else {
+ l.setAttribute( 'href', path );
+ }
} else {
this.addElementToHead( this.makeLink( path ) );
}