mirror of
https://github.com/gorhill/uMatrix.git
synced 2024-06-29 03:21:09 +12:00
fix #711 (will need confirmations)
This commit is contained in:
parent
076382caf3
commit
da992312f3
|
@ -67,9 +67,10 @@ var matrixHeaderPrettyNames = {
|
||||||
var firstPartyLabel = '';
|
var firstPartyLabel = '';
|
||||||
var blacklistedHostnamesLabel = '';
|
var blacklistedHostnamesLabel = '';
|
||||||
|
|
||||||
|
var expandosIdGenerator = 1;
|
||||||
var nodeToExpandosMap = (function() {
|
var nodeToExpandosMap = (function() {
|
||||||
if ( typeof window.WeakMap === 'function' ) {
|
if ( typeof window.Map === 'function' ) {
|
||||||
return new window.WeakMap();
|
return new window.Map();
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
@ -81,9 +82,14 @@ var expandosFromNode = function(node) {
|
||||||
node = node.nodeAt(0);
|
node = node.nodeAt(0);
|
||||||
}
|
}
|
||||||
if ( nodeToExpandosMap ) {
|
if ( nodeToExpandosMap ) {
|
||||||
var expandos = nodeToExpandosMap.get(node);
|
var expandosId = node.getAttribute('data-expandos');
|
||||||
|
if ( !expandosId ) {
|
||||||
|
expandosId = '' + (expandosIdGenerator++);
|
||||||
|
node.setAttribute('data-expandos', expandosId);
|
||||||
|
}
|
||||||
|
var expandos = nodeToExpandosMap.get(expandosId);
|
||||||
if ( expandos === undefined ) {
|
if ( expandos === undefined ) {
|
||||||
nodeToExpandosMap.set(node, (expandos = Object.create(null)));
|
nodeToExpandosMap.set(expandosId, (expandos = Object.create(null)));
|
||||||
}
|
}
|
||||||
return expandos;
|
return expandos;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue