Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome Extension: multiple extensions acting on the same element

How would Chrome handle this scenario.

Suppose I have two extensions installed. One extension that turns the page blue and the other one that turns the page red. Which extension gets priority?

like image 805
Chamilyan Avatar asked Apr 03 '12 05:04

Chamilyan


2 Answers

The final behaviour depends on the following factors:

  • Specifity of the CSS selectors. Example: html body is more specific than body.

  • Shorthand properties: background-color:red; always overrides background:cyan;.

  • The existence of the !important flag: !important declarations can only be overridden by another !important declaration.

  • Order of execution: Extensions which are installed more recently are executed last.
    This means that the extension which was (re)loaded in the end will "win", provided that the previous decision rules were undecided.

like image 185
Rob W Avatar answered Nov 16 '22 19:11

Rob W


Both extensions will execute. The one that executes first will turn the page to one color, the second to other color. Last color prevails.

The sequence of execution depends on many things, for example, if both extensions are listening to the same event, the sequence depends on which added its listener first.

like image 32
Alejandro Silvestri Avatar answered Nov 16 '22 18:11

Alejandro Silvestri