@polymer/iron-resizable-behavior
Advanced tools
Comparing version 3.0.0-pre.19 to 3.0.0-pre.20
@@ -15,2 +15,5 @@ /** | ||
// Contains all connected resizables that do not have a parent. | ||
var ORPHANS = new Set(); | ||
/** | ||
@@ -67,2 +70,3 @@ * `IronResizableBehavior` is a behavior that can be used in Polymer elements to | ||
} else { | ||
ORPHANS.delete(this); | ||
window.removeEventListener('resize', this._boundNotifyResize); | ||
@@ -97,3 +101,13 @@ } | ||
assignParentResizable: function(parentResizable) { | ||
if (this._parentResizable) { | ||
this._parentResizable.stopResizeNotificationsFor(this); | ||
} | ||
this._parentResizable = parentResizable; | ||
if (parentResizable && | ||
parentResizable._interestedResizables.indexOf(this) === -1) { | ||
parentResizable._interestedResizables.push(this); | ||
parentResizable.listen(this, 'iron-resize', '_onDescendantIronResize'); | ||
} | ||
}, | ||
@@ -151,7 +165,2 @@ | ||
if (this._interestedResizables.indexOf(target) === -1) { | ||
this._interestedResizables.push(target); | ||
this.listen(target, 'iron-resize', '_onDescendantIronResize'); | ||
} | ||
target.assignParentResizable(this); | ||
@@ -202,13 +211,42 @@ this._notifyDescendant(target); | ||
} else { | ||
this.fire( | ||
'iron-request-resize-notifications', | ||
null, | ||
{node: this, bubbles: true, cancelable: true}); | ||
this._findParent(); | ||
if (!this._parentResizable) { | ||
// If this resizable is an orphan, tell other orphans to try to find | ||
// their parent again, in case it's this resizable. | ||
ORPHANS.forEach(function(orphan) { | ||
if (orphan !== this) { | ||
orphan._findParent(); | ||
} | ||
}, this); | ||
window.addEventListener('resize', this._boundNotifyResize); | ||
this.notifyResize(); | ||
} else { | ||
// If this resizable has a parent, tell other child resizables of | ||
// that parent to try finding their parent again, in case it's this | ||
// resizable. | ||
this._parentResizable._interestedResizables | ||
.forEach(function(resizable) { | ||
if (resizable !== this) { | ||
resizable._findParent(); | ||
} | ||
}, this); | ||
} | ||
} | ||
}, | ||
_findParent: function() { | ||
this.assignParentResizable(null); | ||
this.fire( | ||
'iron-request-resize-notifications', | ||
null, | ||
{node: this, bubbles: true, cancelable: true}); | ||
if (!this._parentResizable) { | ||
ORPHANS.add(this); | ||
} else { | ||
ORPHANS.delete(this); | ||
} | ||
} | ||
}; |
@@ -16,7 +16,7 @@ { | ||
"devDependencies": { | ||
"@polymer/gen-typescript-declarations": "^1.2.0", | ||
"@polymer/gen-typescript-declarations": "^1.2.2", | ||
"bower": "^1.8.0", | ||
"webmat": "^0.2.0", | ||
"@polymer/iron-component-page": "^3.0.0-pre.19", | ||
"wct-browser-legacy": "^0.0.1-pre.11", | ||
"@polymer/iron-component-page": "^3.0.0-pre.20", | ||
"wct-browser-legacy": "^1.0.1", | ||
"@webcomponents/webcomponentsjs": "^2.0.0" | ||
@@ -28,3 +28,3 @@ }, | ||
}, | ||
"version": "3.0.0-pre.19", | ||
"version": "3.0.0-pre.20", | ||
"resolutions": { | ||
@@ -31,0 +31,0 @@ "inherits": "2.0.3", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38417
19
454
1