{"action":"created","issue":{"url":"https://api.github.com/repos/angular/material/issues/7427","repository_url":"https://api.github.com/repos/angular/material","labels_url":"https://api.github.com/repos/angular/material/issues/7427/labels{/name}","comments_url":"https://api.github.com/repos/angular/material/issues/7427/comments","events_url":"https://api.github.com/repos/angular/material/issues/7427/events","html_url":"https://github.com/angular/material/pull/7427","id":138794227,"number":7427,"title":"fix(theming): do not insert default theme if default theme has changed.","user":{"login":"DevVersion","id":4987015,"avatar_url":"https://avatars.githubusercontent.com/u/4987015?v=3","gravatar_id":"","url":"https://api.github.com/users/DevVersion","html_url":"https://github.com/DevVersion","followers_url":"https://api.github.com/users/DevVersion/followers","following_url":"https://api.github.com/users/DevVersion/following{/other_user}","gists_url":"https://api.github.com/users/DevVersion/gists{/gist_id}","starred_url":"https://api.github.com/users/DevVersion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DevVersion/subscriptions","organizations_url":"https://api.github.com/users/DevVersion/orgs","repos_url":"https://api.github.com/users/DevVersion/repos","events_url":"https://api.github.com/users/DevVersion/events{/privacy}","received_events_url":"https://api.github.com/users/DevVersion/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/angular/material/labels/needs:%20review","name":"needs: review","color":"eb6420"}],"state":"open","locked":false,"assignee":{"login":"EladBezalel","id":6004537,"avatar_url":"https://avatars.githubusercontent.com/u/6004537?v=3","gravatar_id":"","url":"https://api.github.com/users/EladBezalel","html_url":"https://github.com/EladBezalel","followers_url":"https://api.github.com/users/EladBezalel/followers","following_url":"https://api.github.com/users/EladBezalel/following{/other_user}","gists_url":"https://api.github.com/users/EladBezalel/gists{/gist_id}","starred_url":"https://api.github.com/users/EladBezalel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EladBezalel/subscriptions","organizations_url":"https://api.github.com/users/EladBezalel/orgs","repos_url":"https://api.github.com/users/EladBezalel/repos","events_url":"https://api.github.com/users/EladBezalel/events{/privacy}","received_events_url":"https://api.github.com/users/EladBezalel/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2016-03-06T14:13:58Z","updated_at":"2016-03-12T19:54:29Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/angular/material/pulls/7427","html_url":"https://github.com/angular/material/pull/7427","diff_url":"https://github.com/angular/material/pull/7427.diff","patch_url":"https://github.com/angular/material/pull/7427.patch"},"body":"Currently if I specify a default theme by using #setDefaultTheme, then the `default` theme will be still inserted.\r\n\r\nFixes #7425"},"comment":{"url":"https://api.github.com/repos/angular/material/issues/comments/195798081","html_url":"https://github.com/angular/material/pull/7427#issuecomment-195798081","issue_url":"https://api.github.com/repos/angular/material/issues/7427","id":195798081,"user":{"login":"EladBezalel","id":6004537,"avatar_url":"https://avatars.githubusercontent.com/u/6004537?v=3","gravatar_id":"","url":"https://api.github.com/users/EladBezalel","html_url":"https://github.com/EladBezalel","followers_url":"https://api.github.com/users/EladBezalel/followers","following_url":"https://api.github.com/users/EladBezalel/following{/other_user}","gists_url":"https://api.github.com/users/EladBezalel/gists{/gist_id}","starred_url":"https://api.github.com/users/EladBezalel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EladBezalel/subscriptions","organizations_url":"https://api.github.com/users/EladBezalel/orgs","repos_url":"https://api.github.com/users/EladBezalel/repos","events_url":"https://api.github.com/users/EladBezalel/events{/privacy}","received_events_url":"https://api.github.com/users/EladBezalel/received_events","type":"User","site_admin":false},"created_at":"2016-03-12T19:54:29Z","updated_at":"2016-03-12T19:54:29Z","body":"First of all let's use discrete to simplify the conditions\r\n\r\n``` js\r\n!(a != z && b == z) \r\n// => \r\n(a == z || b != z)\r\n```\r\n\r\nOk so let's go through your cases.\r\n\r\nCase 1\r\n-----\r\nWe have the following mocked theme array\r\n```js\r\nTHEMES = ['default', ' blue']\r\n```\r\nAnd my default theme is set to `blue`\r\n\r\nSo the iteration will check:\r\n```js\r\n// Replicates the iteration - case for `default\r\nvar themeName = THEMES[0]; // `default`\r\n// if one conditions is true, the theme won't be inserted into the DOM\r\nif (themeName === 'blue' // false\r\n  || themeName !== 'default' // false -> both conditions are false\r\n)\r\n```\r\nSo in this case, only the theme `blue` will inserted into the DOM - <kbd>Valid</kbd>\r\n\r\nCase 2\r\n---\r\nWe have the following mocked theme array\r\n```js\r\nTHEMES = ['default', ' blue']\r\n```\r\nAnd my default theme is set to `default` (default behavior)\r\nSo the iteration will check:\r\n```js\r\n// Replicates the iteration - case for `default`\r\nvar themeName = THEMES[0]; // `default`\r\n// if one conditions is true, the theme won't be inserted into the DOM\r\nif (themeName === 'default' // true\r\n  || themeName !== 'default' //  false\r\n)\r\n// The check will pass\r\n```\r\nSo in this case, both themes will be inserted to the DOM\r\n\r\nFinally\r\n---\r\nAs you can see, in both cases \r\n``` js\r\nthemeName !== 'default' //  false\r\n```\r\nThan it's clearly redundant.."}}