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