OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 addElemHideSelectors); | 451 addElemHideSelectors); |
452 | 452 |
453 // Use Shadow DOM if available to don't mess with web pages that rely on | 453 // Use Shadow DOM if available to don't mess with web pages that rely on |
454 // the order of their own <style> tags (#309). | 454 // the order of their own <style> tags (#309). |
455 // | 455 // |
456 // However, creating a shadow root breaks running CSS transitions. So we | 456 // However, creating a shadow root breaks running CSS transitions. So we |
457 // have to create the shadow root before transistions might start (#452). | 457 // have to create the shadow root before transistions might start (#452). |
458 // | 458 // |
459 // Also, using shadow DOM causes issues on some Google websites, | 459 // Also, using shadow DOM causes issues on some Google websites, |
460 // including Google Docs, Gmail and Blogger (#1770, #2602, #2687). | 460 // including Google Docs, Gmail and Blogger (#1770, #2602, #2687). |
| 461 // |
| 462 // Finally since some users have both AdBlock and Adblock Plus installed at |
| 463 // once we have to be careful not to create the shadowRoot twice! |
461 if ("createShadowRoot" in document.documentElement && | 464 if ("createShadowRoot" in document.documentElement && |
462 !/\.(?:google|blogger)\.com$/.test(document.domain)) | 465 !/\.(?:google|blogger)\.com$/.test(document.domain) && |
| 466 !document.documentElement.shadowRoot) |
463 { | 467 { |
464 shadow = document.documentElement.createShadowRoot(); | 468 shadow = document.documentElement.createShadowRoot(); |
465 shadow.appendChild(document.createElement("shadow")); | 469 shadow.appendChild(document.createElement("shadow")); |
466 | 470 |
467 // Stop the website from messing with our shadowRoot | 471 // Stop the website from messing with our shadowRoot |
468 if ("shadowRoot" in Element.prototype) | 472 if ("shadowRoot" in Element.prototype) |
469 { | 473 { |
470 runInDocument(document, function() | 474 runInDocument(document, function() |
471 { | 475 { |
472 var ourShadowRoot = document.documentElement.shadowRoot; | 476 var ourShadowRoot = document.documentElement.shadowRoot; |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 }, true); | 614 }, true); |
611 | 615 |
612 return updateStylesheet; | 616 return updateStylesheet; |
613 } | 617 } |
614 | 618 |
615 if (document instanceof HTMLDocument) | 619 if (document instanceof HTMLDocument) |
616 { | 620 { |
617 checkSitekey(); | 621 checkSitekey(); |
618 window.updateStylesheet = init(document); | 622 window.updateStylesheet = init(document); |
619 } | 623 } |
OLD | NEW |