OLD | NEW |
(Empty) | |
| 1 <!-- |
| 2 @license |
| 3 Copyright (c) 2014 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 --><html><head><link rel="import" href="style-util.html"> |
| 10 <link rel="import" href="style-transformer.html"> |
| 11 <link rel="import" href="style-defaults.html"> |
| 12 |
| 13 <!-- |
| 14 |
| 15 The `x-style` extension of the native `<style>` element allows defining styles |
| 16 in the main document that can take advantage of several special features of |
| 17 Polymer's styling system: |
| 18 |
| 19 * Document styles defined in an `x-style` will be shimmed to ensure they do |
| 20 not leak into local DOM when running on browsers without non-native Shadow DOM. |
| 21 * Shadow DOM-specific `/deep/` and `::shadow` combinators will be shimmed on |
| 22 browsers without non-native Shadow DOM. |
| 23 * Custom properties used by Polymer's experimental shim for cross-scope styling |
| 24 may be defined in an `x-style`. |
| 25 |
| 26 Example: |
| 27 |
| 28 ```html |
| 29 <!doctype html> |
| 30 <html> |
| 31 <head> |
| 32 <script src="components/webcomponentsjs/webcomponents-lite.js"></script> |
| 33 <link rel="import" href="components/polymer/polymer.html"> |
| 34 |
| 35 <style is="x-style"> |
| 36 |
| 37 /* Will be prevented from affecting local DOM of Polymer elements */ |
| 38 * { |
| 39 box-sizing: border-box; |
| 40 } |
| 41 |
| 42 /* Can use /deep/ and ::shadow combinators */ |
| 43 body /deep/ .my-special-view::shadow #thing-inside { |
| 44 background: yellow; |
| 45 } |
| 46 |
| 47 /* Custom properties that inherit down the document tree may be defined */ |
| 48 body { |
| 49 --my-toolbar-title-color: green; |
| 50 } |
| 51 |
| 52 </style> |
| 53 |
| 54 </head> |
| 55 <body> |
| 56 |
| 57 ... |
| 58 |
| 59 </body> |
| 60 </html> |
| 61 ``` |
| 62 |
| 63 Note, all features of `x-style` are available when defining styles as part of Po
lymer elements (e.g. `<style>` elements within `<dom-module>`'s used for definin
g Polymer elements. The `x-style` extension should only be used for defining doc
ument styles, outside of a custom element's local DOM. |
| 64 |
| 65 --> |
| 66 |
| 67 </head><body><script src="x-style-extracted.js"></script></body></html> |
OLD | NEW |