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

Unified Diff: polymer_1.2.3/bower_components/iron-media-query/iron-media-query.html

Issue 1581713003: [third_party] add polymer 1.2.3 (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: 1.2.3 Created 4 years, 11 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: polymer_1.2.3/bower_components/iron-media-query/iron-media-query.html
diff --git a/polymer_1.0.4/bower_components/iron-media-query/iron-media-query.html b/polymer_1.2.3/bower_components/iron-media-query/iron-media-query.html
similarity index 61%
copy from polymer_1.0.4/bower_components/iron-media-query/iron-media-query.html
copy to polymer_1.2.3/bower_components/iron-media-query/iron-media-query.html
index 8325eb2f7f2851cb66c4212e7042246e88e3fe90..60cb84b89b8e7afa3cf8f5e84a54068d4e6f16b7 100644
--- a/polymer_1.0.4/bower_components/iron-media-query/iron-media-query.html
+++ b/polymer_1.2.3/bower_components/iron-media-query/iron-media-query.html
@@ -48,23 +48,67 @@ Example:
query: {
type: String,
observer: 'queryChanged'
+ },
+
+ /**
+ * If true, the query attribute is assumed to be a complete media query
+ * string rather than a single media feature.
+ */
+ full: {
+ type: Boolean,
+ value: false
+ },
+
+ /**
+ * @type {function(MediaQueryList)}
+ */
+ _boundMQHandler: {
+ value: function() {
+ return this.queryHandler.bind(this);
+ }
+ },
+
+ /**
+ * @type {MediaQueryList}
+ */
+ _mq: {
+ value: null
}
+ },
+
+ attached: function() {
+ this.style.display = 'none';
+ this.queryChanged();
+ },
+ detached: function() {
+ this._remove();
},
- created: function() {
- this._mqHandler = this.queryHandler.bind(this);
+ _add: function() {
+ if (this._mq) {
+ this._mq.addListener(this._boundMQHandler);
+ }
},
- queryChanged: function(query) {
+ _remove: function() {
if (this._mq) {
- this._mq.removeListener(this._mqHandler);
+ this._mq.removeListener(this._boundMQHandler);
+ }
+ this._mq = null;
+ },
+
+ queryChanged: function() {
+ this._remove();
+ var query = this.query;
+ if (!query) {
+ return;
}
- if (query[0] !== '(') {
+ if (!this.full && query[0] !== '(') {
query = '(' + query + ')';
}
this._mq = window.matchMedia(query);
- this._mq.addListener(this._mqHandler);
+ this._add();
this.queryHandler(this._mq);
},

Powered by Google App Engine
This is Rietveld 408576698