Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#1574 closed change (rejected)

Inject element hiding CSS wih chrome.tabs.insertCSS()

Reported by: sebastian Assignee:
Priority: P4 Milestone:
Module: Platform Keywords: externaldependency
Cc: mapx, trev, greiner Blocked By:
Blocking: Platform: Unknown
Ready: yes Confidential: no
Tester: Verified working: no
Review URL(s):

Description

Background

Starting with Chrome 41 chrome.tabs.insertCSS() will allow to inject CSS per frame. This approach is preferable over injecting a <style> element with a content script, because it leads to less side effects, and should be more efficient than using Shadow DOM.

What to change

Once Chrome allows to limit chrome.tabs.insertCSS() per frame, use it to implement element hiding on supported Chrome versions. Keep the former approach, injecting a <style> element, as fallback for older Chrome and Opera versions, as well as for Safari.

Change History (8)

comment:1 Changed 5 years ago by mapx

  • Cc mapx added

comment:2 Changed 5 years ago by trev

Won't this make issues similar to #242 even more prevalent? My understanding is that any rule defined by the web page will always override the ones we define.

comment:3 Changed 5 years ago by trev

  • Cc trev added

comment:4 Changed 5 years ago by sebastian

  • Resolution set to invalid
  • Status changed from new to closed

Unfortunately you are right. I just tested it, and any <style> and <link rel="stylesheet"> element provided by the web page overrides stylesheets injected with chrome.tabs.insertCSS(), when the conflicting rules have the same priority. However, Shadow DOM lets us override all stylesheets of the web page, except those configured with style attributes, using !important priority.

comment:5 Changed 5 years ago by trev

  • Resolution invalid deleted
  • Status changed from closed to reopened

Splitting hairs here but the correct resolution would be "rejected" I think.

comment:6 Changed 5 years ago by trev

  • Resolution set to rejected
  • Status changed from reopened to closed

comment:7 Changed 5 years ago by sebastian

I'd say it's invalid, because the issue was filed under wrong assumptions.

Last edited 5 years ago by sebastian (previous) (diff)

comment:8 Changed 5 years ago by greiner

  • Cc greiner added
Note: See TracTickets for help on using tickets.