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

Side by Side Diff: third_party/polymer/v0_8/components/iron-media-query/iron-media-query.html

Issue 1155683008: Rename polymer and cr_elements v0_8 to v1_0 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@v1
Patch Set: fix a merge mistake Created 5 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 Copyright (c) 2015 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 <link rel="import" href="../polymer/polymer.html">
11
12 <!--
13 `iron-media-query` can be used to data bind to a CSS media query.
14 The `query` property is a bare CSS media query.
15 The `queryMatches` property is a boolean representing if the page matches that m edia query.
16
17 Example:
18
19 <iron-media-query query="(min-width: 600px)" queryMatches="{{queryMatches}}" ></iron-media-query>
20
21 @group Iron Elements
22 @demo demo/index.html
23 @hero hero.svg
24 @element iron-media-query
25 -->
26
27 <script>
28
29 Polymer({
30
31 is: 'iron-media-query',
32
33 properties: {
34
35 /**
36 * The Boolean return value of the media query.
37 *
38 * @attribute queryMatches
39 * @type Boolean
40 * @default false
41 */
42 queryMatches: {
43 type: Boolean,
44 value: false,
45 readOnly: true,
46 notify: true
47 },
48
49 /**
50 * The CSS media query to evaluate.
51 *
52 * @attribute query
53 * @type String
54 */
55 query: {
56 type: String,
57 observer: 'queryChanged'
58 }
59
60 },
61
62 created: function() {
63 this._mqHandler = this.queryHandler.bind(this);
64 },
65
66 queryChanged: function(query) {
67 if (this._mq) {
68 this._mq.removeListener(this._mqHandler);
69 }
70 if (query[0] !== '(') {
71 query = '(' + query + ')';
72 }
73 this._mq = window.matchMedia(query);
74 this._mq.addListener(this._mqHandler);
75 this.queryHandler(this._mq);
76 },
77
78 queryHandler: function(mq) {
79 this._setQueryMatches(mq.matches);
80 }
81
82 });
83
84 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698