Skip to content

Commit

Permalink
Fix test maybe
Browse files Browse the repository at this point in the history
  • Loading branch information
jakelauritsen committed Jul 22, 2024
1 parent 8ce3abd commit 7f5f53f
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/layout/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*/
(function() {
'use strict';

var weakLayouts = new WeakSet()
/**
* Class constructor for Layout MDL component.
* Implements MDL component design pattern defined at:
Expand All @@ -26,6 +28,7 @@
*/
var MaterialLayout = function MaterialLayout(element) {
this.element_ = element;
weakLayouts.add(this.element_)

// Initialize instance.
this.init();
Expand Down Expand Up @@ -141,7 +144,7 @@

var mediaQuery = MaterialLayout.prototype.matchMedia_(
/** @type {string} */ (MaterialLayout.prototype.Constant_.MAX_WIDTH));
mediaQuery.onchange = screenSizeHandler;
mediaQuery.onchange = MaterialLayout.prototype.screenSizeHandler_;

MaterialLayout.prototype.screenSizeMediaQuery_ = mediaQuery;

Expand Down Expand Up @@ -196,12 +199,10 @@
* @private
*/

function screenSizeHandler(e) {
MaterialLayout.prototype.screenSizeHandler_ = function (e) {
// modified to query dependent elements rather than binding materialLayout to windows media query result
var materialLayouts = document.querySelectorAll('.mdl-layout');

for (var i = 0; i < materialLayouts.length; i++) {
var layout = materialLayouts[i];
for (var i = 0; i < weakLayouts.length; i++) {
var layout = weakLayouts[i];

if (layout) {
var drawerElement = layout.querySelector('.mdl-layout__drawer');
Expand Down Expand Up @@ -450,7 +451,7 @@
// Keep an eye on screen size, and add/remove auxiliary class for styling
// of small screens.

screenSizeHandler(this.screenSizeMediaQuery_);
this.screenSizeHandler_(this.screenSizeMediaQuery_);

// Initialize tabs, if any.
if (this.header_ && this.tabBar_) {
Expand Down

0 comments on commit 7f5f53f

Please sign in to comment.