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

Unified Diff: third_party/polymer/components-chromium/core-media-query/core-media-query-extracted.js

Issue 592593002: Inline scripts were extracted from Polymer elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/echo ""/echo/ Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
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);
+ }
+ });
+

Powered by Google App Engine
This is Rietveld 408576698