minor code review

This commit is contained in:
gorhill 2015-08-03 09:25:18 -04:00
parent 6ea3338f26
commit 980125b8af
3 changed files with 7 additions and 8 deletions

View File

@ -375,11 +375,8 @@ vAPI.tabs.open = function(details) {
// "Note that fragment identifiers are not matched."
// It's a lie, fragment identifiers ARE matched. So we need to remove the
// fragment.
var targetURLWithoutHash = targetURL;
var pos = targetURL.indexOf('#');
if ( pos !== -1 ) {
targetURLWithoutHash = targetURL.slice(0, pos);
}
var targetURLWithoutHash = pos === -1 ? targetURL : targetURL.slice(0, pos);
chrome.tabs.query({ url: targetURLWithoutHash }, function(tabs) {
var tab = tabs[0];

View File

@ -470,8 +470,9 @@ var uBlockCollapser = (function() {
if ( shadow !== null && shadow.className === sessionId ) {
continue;
}
// https://github.com/w3c/webcomponents/issues/102
// not all nodes can be shadowed
// https://github.com/gorhill/uBlock/pull/555
// Not all nodes can be shadowed:
// https://github.com/w3c/webcomponents/issues/102
try {
shadow = elem.createShadowRoot();
shadow.className = sessionId;

View File

@ -181,8 +181,9 @@ var hideElements = function(selectors) {
if ( shadow !== null && shadow.className === sessionId ) {
continue;
}
// https://github.com/w3c/webcomponents/issues/102
// not all nodes can be shadowed
// https://github.com/gorhill/uBlock/pull/555
// Not all nodes can be shadowed:
// https://github.com/w3c/webcomponents/issues/102
try {
shadow = elem.createShadowRoot();
shadow.className = sessionId;