Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: include.preload.js

Issue 29714555: Issue 6441 - Avoid unnecessary shadow root (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Use <content> if <shadow> is not supported Created March 5, 2018, 12:47 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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-present eyeo GmbH 3 * Copyright (C) 2006-present 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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 // Using shadow DOM causes issues on some Google websites, 368 // Using shadow DOM causes issues on some Google websites,
369 // including Google Docs, Gmail and Blogger (#1770, #2602, #2687). 369 // including Google Docs, Gmail and Blogger (#1770, #2602, #2687).
370 if (/\.(?:google|blogger)\.com$/.test(document.domain)) 370 if (/\.(?:google|blogger)\.com$/.test(document.domain))
371 return null; 371 return null;
372 372
373 // Finally since some users have both AdBlock and Adblock Plus installed we 373 // Finally since some users have both AdBlock and Adblock Plus installed we
374 // have to consider how the two extensions interact. For example we want to 374 // have to consider how the two extensions interact. For example we want to
375 // avoid creating the shadowRoot twice. 375 // avoid creating the shadowRoot twice.
376 let shadow = document.documentElement.shadowRoot || 376 let shadow = document.documentElement.shadowRoot ||
377 document.documentElement.createShadowRoot(); 377 document.documentElement.createShadowRoot();
378 shadow.appendChild(document.createElement("shadow")); 378
379 // Firefox does not support the <shadow> tag (#6441).
380 let contentTagName = typeof HTMLShadowElement != "undefined" ?
381 "shadow" : "content";
Sebastian Noack 2018/03/08 18:34:26 I wonder whether we should just use <content> no m
Manish Jethani 2018/03/08 19:44:54 Are you sure that Chrome 49 supports <content>? I
Manish Jethani 2018/03/08 19:53:57 I checked the Chromium commit log and entries ment
Sebastian Noack 2018/03/08 20:36:16 Yes, I'm pretty sure <content> already existed whe
382 shadow.appendChild(document.createElement(contentTagName));
379 383
380 return shadow; 384 return shadow;
381 }, 385 },
382 386
383 addSelectorsInline(selectors, groupName) 387 addSelectorsInline(selectors, groupName)
384 { 388 {
385 let style = this.styles.get(groupName); 389 let style = this.styles.get(groupName);
386 390
387 if (style) 391 if (style)
388 { 392 {
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 let element = event.target; 541 let element = event.target;
538 if (/^i?frame$/.test(element.localName)) 542 if (/^i?frame$/.test(element.localName))
539 checkCollapse(element); 543 checkCollapse(element);
540 }, true); 544 }, true);
541 } 545 }
542 546
543 window.checkCollapse = checkCollapse; 547 window.checkCollapse = checkCollapse;
544 window.elemhide = elemhide; 548 window.elemhide = elemhide;
545 window.typeMap = typeMap; 549 window.typeMap = typeMap;
546 window.getURLsFromElement = getURLsFromElement; 550 window.getURLsFromElement = getURLsFromElement;
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld