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

Side by Side Diff: bower_components/core-media-query/core-media-query.html

Issue 786953007: npm_modules: Fork bower_components into Polymer 0.4.0 and 0.5.0 versions (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Created 5 years, 11 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 Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
3 This code may only be used under the BSD style license found at http://polymer.g ithub.io/LICENSE.txt
4 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
5 The complete set of contributors may be found at http://polymer.github.io/CONTRI BUTORS.txt
6 Code distributed by Google as part of the polymer project is also
7 subject to an additional IP rights grant found at http://polymer.github.io/PATEN TS.txt
8 -->
9 <!--
10 /**
11 * @group Polymer Core Elements
12 * @element core-media-query
13 * @status beta
14 * @homepage github.io
15 *
16 * core-media-query can be used to data bind to a CSS media query.
17 * The "query" property is a bare CSS media query.
18 * The "queryMatches" property will be a boolean representing if the page matche s that media query.
19 *
20 * core-media-query uses media query listeners to dynamically update the "queryM atches" property.
21 * A "core-media-change" event also fires when queryMatches changes.
22 *
23 * Example:
24 *
25 * <core-media-query query="max-width: 640px" queryMatches="{{phoneScreen}} "></core-media-query>
26 *
27 */
28
29 /**
30 * Fired when the media query state changes
31 *
32 * @event core-media-change
33 */
34 -->
35 <link rel="import" href="../polymer/polymer.html">
36
37 <polymer-element name="core-media-query" attributes="query queryMatches">
38 <template>
39 <style>
40 :host {
41 display: none;
42 }
43 </style>
44 </template>
45 <script>
46 Polymer('core-media-query', {
47
48 /**
49 * The Boolean return value of the media query
50 *
51 * @attribute queryMatches
52 * @type Boolean
53 * @default false
54 */
55 queryMatches: false,
56
57 /**
58 * The CSS media query to evaulate
59 *
60 * @attribute query
61 * @type string
62 * @default ''
63 */
64 query: '',
65 ready: function() {
66 this._mqHandler = this.queryHandler.bind(this);
67 this._mq = null;
68 },
69 queryChanged: function() {
70 if (this._mq) {
71 this._mq.removeListener(this._mqHandler);
72 }
73 var query = this.query;
74 if (query[0] !== '(') {
75 query = '(' + this.query + ')';
76 }
77 this._mq = window.matchMedia(query);
78 this._mq.addListener(this._mqHandler);
79 this.queryHandler(this._mq);
80 },
81 queryHandler: function(mq) {
82 this.queryMatches = mq.matches;
83 this.asyncFire('core-media-change', mq);
84 }
85 });
86 </script>
87 </polymer-element>
OLDNEW
« no previous file with comments | « bower_components/core-media-query/bower.json ('k') | bower_components/core-media-query/demo.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698