Page 1 of 1

surrogate quick reference

Posted: Thu Sep 29, 2011 1:02 am
by al_9x
  • no prefix - blocked script surrogate
    • matches blocked scripts
    • runs only if page is script allowed
    • runs when the blocked matched script would have
  • '<' - before script surrogate
    • matches allowed scripts
    • runs only if page and script are allowed
    • runs just before the matched script executes
  • '>' - after script surrogate.
    • matches allowed scripts
    • runs only if page and script are allowed
    • runs just after (load event) the matched script executes
  • '@' - script allowed page (html document) surrogate
    • matches script allowed pages
    • runs only if the page is script allowed
    • runs before HTML parsing starts
  • '!' - script blocked page surrogate
    • matches script blocked pages
    • runs only if the page is script blocked
    • runs on DOMContentLoaded
  • '!@' - page surrogate
    • matches pages
    • runs on both script allowed and script blocked pages
    • runs on DOMContentLoaded
References: 1, 2, 3, 4

Additional notes:
  • Surrogates are never executed in global lexical scope, some are wrapped in functions, others in blocks, so variables declared with "let" are always private to the surrogate.

Re: surrogate quick reference

Posted: Thu Sep 29, 2011 9:41 am
by Giorgio Maone
Well done, thank you.