From 3dc763829ca1598427b588cf08830c1e2af5a05c Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Mon, 2 May 2016 15:07:51 +0200 Subject: [PATCH] currentScript needs to point to removed script elements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To avoid leaking shadow trees we added an “in a document” check in caf203fd4d9a5047d1ff2edad2290d53e21368ba. This turned out to not be web compatible. So instead, we check whether the script element is in a shadow tree. Ideally that is novel enough to not cause any compatibility issues. Fixes #1161. --- source | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/source b/source index 69d4ebdc239..86fe736ddb7 100644 --- a/source +++ b/source @@ -3100,6 +3100,7 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d
  • node document concept
  • host concept
  • +
  • shadow root concept
  • HTMLCollection interface
  • HTMLCollection.length attribute
  • @@ -59122,10 +59123,17 @@ o............A....e
    "classic"
      -
    1. If the script element is in a document, then set the - script element's node document's currentScript attribute to the - script element. Otherwise, set it to null.

    2. +
    3. +

      If the script element's root is not a shadow + root, then set the script element's node document's currentScript attribute to the + script element. Otherwise, set it to null.

      + +

      This does not use the in a document check, as the + script element could have been removed from the document prior to execution, + and in that scenario currentScript still + needs to point to it.

      +
    4. Run the classic script given by the script's script.

    5. @@ -67081,7 +67089,7 @@ console.log(plasticButton2.getAttribute("is")); // will output "plastic-button"< is truly one-time will need a guard to prevent it from running twice.

    6. In general, the constructor should be used to set up initial state and default values, and - to set up event listeners and possibly a shadow root.

    7. + to set up event listeners and possibly a shadow root.

      Several of these requirements are checked during element