Update Polymer and pull in iron-list
[chromium-blink-merge.git] / third_party / polymer / v1_0 / components-chromium / iron-media-query / iron-media-query-extracted.js
bloba827c28bd1705f6bfbb8940fdb646e688d4f5fc3
3   Polymer({
5     is: 'iron-media-query',
7     properties: {
9       /**
10        * The Boolean return value of the media query.
11        */
12       queryMatches: {
13         type: Boolean,
14         value: false,
15         readOnly: true,
16         notify: true
17       },
19       /**
20        * The CSS media query to evaluate.
21        */
22       query: {
23         type: String,
24         observer: 'queryChanged'
25       }
27     },
29     created: function() {
30       this._mqHandler = this.queryHandler.bind(this);
31     },
33     queryChanged: function(query) {
34       if (this._mq) {
35         this._mq.removeListener(this._mqHandler);
36       }
37       if (query[0] !== '(') {
38         query = '(' + query + ')';
39       }
40       this._mq = window.matchMedia(query);
41       this._mq.addListener(this._mqHandler);
42       this.queryHandler(this._mq);
43     },
45     queryHandler: function(mq) {
46       this._setQueryMatches(mq.matches);
47     }
49   });