Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

clone-style

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clone-style

Clone `<style>` tag node right in browser, for IE9+

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Clone Style

Clone <style> tag right in browser, for IE9+

Why?

<style> tag is another world of CSSOM, cannot easily clone using cloneNode etc, so this lib exists here.

Usage

cloneStyle(styleNode, [docNode], [beforeNode])

  • styleNode: must be a existing <style> node to be cloned

  • docNode: the document to append the new style node to, or current document if omitted

  • beforeNode: the place to insert before the new style node, or append to <head> if omitted.

Example

const newStyle = cloneStyle($0)
// newStyle now exists in <head>

const newStyle2 = cloneStyle($0, iframeDocument)
// newStyle now exists in iframe <head>


const newStyle2 = cloneStyle($0, iframeDocument, someNode)
// newStyle now exists in iframe before someNode

FAQs

Package last updated on 16 Jan 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts