Skip to content

Commit

Permalink
shareBuiltCSSWithAdoptedStyleSheets -> `useAdoptedStyleSheetsWithBu…
Browse files Browse the repository at this point in the history
…iltCSS`
  • Loading branch information
bicknellr committed Apr 6, 2020
1 parent d0848d8 commit 33e1498
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions lib/mixins/element-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
import '../utils/boot.js';

import { rootPath, strictTemplatePolicy, allowTemplateFromDomModule, legacyOptimizations, legacyWarnings, syncInitialRender, supportsAdoptingStyleSheets, shareBuiltCSSWithAdoptedStyleSheets } from '../utils/settings.js';
import { rootPath, strictTemplatePolicy, allowTemplateFromDomModule, legacyOptimizations, legacyWarnings, syncInitialRender, supportsAdoptingStyleSheets, useAdoptedStyleSheetsWithBuiltCSS } from '../utils/settings.js';
import { dedupingMixin } from '../utils/mixin.js';
import { stylesFromTemplate, stylesFromModuleImports } from '../utils/style-gather.js';
import { pathFromUrl, resolveCss, resolveUrl } from '../utils/resolve-url.js';
Expand Down Expand Up @@ -304,7 +304,7 @@ export const ElementMixin = dedupingMixin(base => {
// potentially not shareable and sharing the ones that could be shared
// would require some coordination. To keep it simple, all the includes
// and styles are collapsed into a single shareable stylesheet.
if (shareBuiltCSSWithAdoptedStyleSheets && builtCSS &&
if (useAdoptedStyleSheetsWithBuiltCSS && builtCSS &&
supportsAdoptingStyleSheets) {
// Remove styles in template and make a shareable stylesheet
const styles = template.content.querySelectorAll('style');
Expand Down
12 changes: 6 additions & 6 deletions lib/utils/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,15 +345,15 @@ export const setLegacyNoObservedAttributes = function(noObservedAttributes) {
* between component instances' shadow roots, if the app uses built Shady CSS
* styles.
*/
export let shareBuiltCSSWithAdoptedStyleSheets =
window.Polymer && window.Polymer.shareBuiltCSSWithAdoptedStyleSheets || false;
export let useAdoptedStyleSheetsWithBuiltCSS =
window.Polymer && window.Polymer.useAdoptedStyleSheetsWithBuiltCSS || false;

/**
* Sets `shareBuiltCSSWithAdoptedStyleSheets` globally.
* Sets `useAdoptedStyleSheetsWithBuiltCSS` globally.
*
* @param {boolean} value enable or disable `shareBuiltCSSWithAdoptedStyleSheets`
* @param {boolean} value enable or disable `useAdoptedStyleSheetsWithBuiltCSS`
* @return {void}
*/
export const setShareBuiltCSSWithAdoptedStyleSheets = function(value) {
shareBuiltCSSWithAdoptedStyleSheets = value;
export const setUseAdoptedStyleSheetsWithBuiltCSS = function(value) {
useAdoptedStyleSheetsWithBuiltCSS = value;
};
4 changes: 2 additions & 2 deletions test/unit/styling-build-adopted-stylesheets.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
<script src="../../node_modules/wct-browser-legacy/browser.js"></script>
<script type="module">
import {
setShareBuiltCSSWithAdoptedStyleSheets,
setUseAdoptedStyleSheetsWithBuiltCSS,
supportsAdoptingStyleSheets,
} from '../../lib/utils/settings.js';
setShareBuiltCSSWithAdoptedStyleSheets(true);
setUseAdoptedStyleSheetsWithBuiltCSS(true);
window.supportsAdoptingStyleSheets = supportsAdoptingStyleSheets;
let define = window.customElements.define;
let order = [];
Expand Down

0 comments on commit 33e1498

Please sign in to comment.