Skip to content

Handle dynamic addition of attributes to <link rel=stylesheet> elements #3361

Closed

Description

@mbrubeck

#3346 adds code that parses stylesheets from <link rel=stylesheet> elements when they are added to a document, but only if the rel and href attributes are set before the element is inserted into the tree. We should also modify HTMLLinkElement's after_set_attr method to handle this case. Here's a simple test, which should turn green if this is working:

<html>
  <head></head>
  <body>
    <script>
      var link = document.createElement("link");
      document.head.appendChild(link);
      link.setAttribute("rel", "stylesheet");
      link.setAttribute("href", "data:text/css,body{background:green}");
    </script>
  </body>
</html>

This is part of #976. Note that we should also remove any previously linked stylesheet before loading the new one, but Servo doesn't currently have this ability (#1300).

Activity

  1. added
    E-less-complex
    A-content/dom
    I-wrong
    on Sep 16, 2014
  2. gilles-leblanc commented on Sep 20, 2014

    @gilles-leblanc
    Contributor

    I have started working on this.

  3. added
    C-assigned
    on Sep 20, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-content/domC-assignedE-less-complexI-wrong

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions