Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Side by Side Diff: appengine/config_service/ui/bower_components/polymer/lib/elements/custom-style.html

Issue 2923973003: Added base template for config ui. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!--
2 @license
3 Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
4 This code may only be used under the BSD style license found at http://polymer.g ithub.io/LICENSE.txt
5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6 The complete set of contributors may be found at http://polymer.github.io/CONTRI BUTORS.txt
7 Code distributed by Google as part of the polymer project is also
8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN TS.txt
9 -->
10 <link rel="import" href="../../../shadycss/custom-style-interface.html">
11 <link rel="import" href="../utils/style-gather.html">
12 <script>
13 (function() {
14 'use strict';
15
16 const attr = 'include';
17
18 const CustomStyleInterface = window.ShadyCSS.CustomStyleInterface;
19
20 /**
21 * Custom element for defining styles in the main document that can take
22 * advantage of several special features of Polymer's styling system:
23 *
24 * - Document styles defined in a custom-style are shimmed to ensure they
25 * do not leak into local DOM when running on browsers without native
26 * Shadow DOM.
27 * - Custom properties used by Polymer's shim for cross-scope styling may
28 * be defined in an custom-style. Use the :root selector to define custom
29 * properties that apply to all custom elements.
30 *
31 * To use, simply wrap an inline `<style>` tag in the main document whose
32 * CSS uses these features with a `<custom-style>` element.
33 *
34 * @extends HTMLElement
35 * @memberof Polymer
36 * @summary Custom element for defining styles in the main document that can
37 * take advantage of Polymer's style scoping and custom properties shims.
38 */
39 class CustomStyle extends HTMLElement {
40 constructor() {
41 super();
42 this._style = null;
43 CustomStyleInterface.addCustomStyle(this);
44 }
45 /**
46 * Returns the light-DOM `<style>` child this element wraps. Upon first
47 * call any style modules referenced via the `include` attribute will be
48 * concatenated to this element's `<style>`.
49 *
50 * @return {HTMLStyleElement} This element's light-DOM `<style>`
51 */
52 getStyle() {
53 if (this._style) {
54 return this._style;
55 }
56 const style = this.querySelector('style');
57 if (!style) {
58 return;
59 }
60 this._style = style;
61 const include = style.getAttribute(attr);
62 if (include) {
63 style.removeAttribute(attr);
64 style.textContent = Polymer.StyleGather.cssFromModules(include) + style. textContent;
65 }
66 return this._style;
67 }
68 }
69
70 window.customElements.define('custom-style', CustomStyle);
71 Polymer.CustomStyle = CustomStyle;
72 })();
73 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698