Fix prorblems caused by vAPI.insertHTML

This commit is contained in:
Deathamns 2015-01-13 20:25:10 +01:00
parent 35ee7b79f8
commit bcc1c0da11
4 changed files with 17 additions and 6 deletions

View File

@ -77,7 +77,7 @@ vAPI.insertHTML = (function() {
return function(node, html) {
while ( node.firstChild ) {
node.removeChild(node.firstChild);
node.removeChild(node.firstChild);
}
node.appendChild(parser.parseFragment(

View File

@ -13,8 +13,10 @@
<body>
<div id="content"></div>
<script src="js/udom.js"></script>
<script src="js/vapi-common.js"></script>
<script src="js/vapi-client.js"></script>
<script src="js/udom.js"></script>
<script src="js/asset-viewer.js"></script>
</body>

View File

@ -101,7 +101,7 @@ var renderBlacklists = function() {
'<li class="listDetails">',
'<input type="checkbox" {{checked}}>',
' ',
'<a href="{{URL}}" type="text/plain">',
'<a data-href="{{URL}}" type="text/plain">',
'{{name}}',
'\u200E</a>',
'{{homeURL}}',
@ -237,6 +237,15 @@ var renderBlacklists = function() {
uDom('#lists').html(html.join(''));
uDom('a').attr('target', '_blank');
// Firefox: sanitizer drops those `href` attributes that point to local URLs
var lis = uDom('a[data-href]');
var a;
i = lis.length;
while ( i-- ) {
a = lis.subset(i, 1);
a.attr('href', a.attr('data-href'));
}
updateWidgets();
};

View File

@ -8,7 +8,7 @@
<title>µBlock</title>
</head>
<body id="body">
<body>
<a href="dashboard.html" target="_blank" id="gotoPrefs" title="popupTipDashboard"><span id="appname"></span><span id="version"></span></a>
<div id="panes">
<div>
@ -38,8 +38,8 @@
<div id="templates" style="display: none">
<div><span></span><span data-src="/" data-des="" data-type="*"> </span><span data-src="." data-des="" data-type="*"> </span></div>
<div id='actionSelector'><span id="dynaAllow"></span><span id="dynaNoop"></span><span id="dynaBlock"></span></div>
<div id=hotspotTip></div>
<div id="actionSelector"><span id="dynaAllow"></span><span id="dynaNoop"></span><span id="dynaBlock"></span></div>
<div id="hotspotTip"></div>
</div>
<script src="js/vapi-common.js"></script>