Sha256: f721a6ece7d9bbfe85995c1b6a32cf6e3a8c9b0eec081785fe04be425216bc61

Contents?: true

Size: 1.04 KB

Versions: 3

Compression:

Stored size: 1.04 KB

Contents

"use strict";
const HTMLElementImpl = require("./HTMLElement-impl").implementation;
const LinkStyleImpl = require("./LinkStyle-impl").implementation;
const idlUtils = require("../generated/utils");
const domSymbolTree = require("../helpers/internal-constants").domSymbolTree;
const NODE_TYPE = require("../node-type");
const evaluateStylesheet = require("../helpers/stylesheets").evaluateStylesheet;
const documentBaseURL = require("../helpers/document-base-url").documentBaseURL;

class HTMLStyleElementImpl extends HTMLElementImpl {
  _attach() {
    if (this.type && this.type !== "text/css") {
      return;
    }

    let content = "";
    for (const child of domSymbolTree.childrenIterator(this)) {
      if (child.nodeType === NODE_TYPE.TEXT_NODE) {
        content += child.nodeValue;
      }
    }

    evaluateStylesheet(this, content, this.sheet, documentBaseURL(this._ownerDocument));

    super._attach();
  }
}

idlUtils.mixin(HTMLStyleElementImpl.prototype, LinkStyleImpl.prototype);

module.exports = {
  implementation: HTMLStyleElementImpl
};

Version data entries

3 entries across 3 versions & 3 rubygems

Version Path
learn_create-0.0.22 lib/templates/javascript_lab_template/node_modules/jsdom/lib/jsdom/living/nodes/HTMLStyleElement-impl.js
lanes-0.8.0 node_modules/jsdom/lib/jsdom/living/nodes/HTMLStyleElement-impl.js
select_all-rails-0.3.1 node_modules/jsdom/lib/jsdom/living/nodes/HTMLStyleElement-impl.js