Index: third_party/polymer/components-chromium/core-media-query/core-media-query-extracted.js |
diff --git a/third_party/polymer/components-chromium/core-media-query/core-media-query-extracted.js b/third_party/polymer/components-chromium/core-media-query/core-media-query-extracted.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c73f58b48095ec96f774f0b2b564bf13f71ec2b6 |
--- /dev/null |
+++ b/third_party/polymer/components-chromium/core-media-query/core-media-query-extracted.js |
@@ -0,0 +1,42 @@ |
+ |
+ Polymer('core-media-query', { |
+ |
+ /** |
+ * The Boolean return value of the media query |
+ * |
+ * @attribute queryMatches |
+ * @type Boolean |
+ * @default false |
+ */ |
+ queryMatches: false, |
+ |
+ /** |
+ * The CSS media query to evaulate |
+ * |
+ * @attribute query |
+ * @type string |
+ * @default '' |
+ */ |
+ query: '', |
+ ready: function() { |
+ this._mqHandler = this.queryHandler.bind(this); |
+ this._mq = null; |
+ }, |
+ queryChanged: function() { |
+ if (this._mq) { |
+ this._mq.removeListener(this._mqHandler); |
+ } |
+ var query = this.query; |
+ if (query[0] !== '(') { |
+ query = '(' + this.query + ')'; |
+ } |
+ this._mq = window.matchMedia(query); |
+ this._mq.addListener(this._mqHandler); |
+ this.queryHandler(this._mq); |
+ }, |
+ queryHandler: function(mq) { |
+ this.queryMatches = mq.matches; |
+ this.asyncFire('core-media-change', mq); |
+ } |
+ }); |
+ |