style-loader
Advanced tools
Comparing version 0.21.0 to 0.22.0
@@ -5,2 +5,17 @@ # Change Log | ||
<a name="0.22.0"></a> | ||
# [0.22.0](https://github.com/webpack-contrib/style-loader/compare/v0.21.0...v0.22.0) (2018-08-07) | ||
### Bug Fixes | ||
* insertInto and insertAt collaboration ([#325](https://github.com/webpack-contrib/style-loader/issues/325)) ([c7d8fec](https://github.com/webpack-contrib/style-loader/commit/c7d8fec)) | ||
### Features | ||
* add support for __webpack_nonce__ ([#319](https://github.com/webpack-contrib/style-loader/issues/319)) ([fc24512](https://github.com/webpack-contrib/style-loader/commit/fc24512)) | ||
<a name="0.21.0"></a> | ||
@@ -7,0 +22,0 @@ # [0.21.0](https://github.com/webpack-contrib/style-loader/compare/v0.20.3...v0.21.0) (2018-04-18) |
@@ -26,3 +26,6 @@ /* | ||
var getTarget = function (target) { | ||
var getTarget = function (target, parent) { | ||
if (parent){ | ||
return parent.querySelector(target); | ||
} | ||
return document.querySelector(target); | ||
@@ -34,3 +37,3 @@ }; | ||
return function(target) { | ||
return function(target, parent) { | ||
// If passing function in options, then use it for resolve "head" element. | ||
@@ -45,3 +48,3 @@ // Useful for Shadow Root style i.e | ||
if (typeof memo[target] === "undefined") { | ||
var styleTarget = getTarget.call(this, target); | ||
var styleTarget = getTarget.call(this, target, parent); | ||
// Special case to return head of iframe instead of iframe itself | ||
@@ -187,3 +190,3 @@ if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) { | ||
} else if (typeof options.insertAt === "object" && options.insertAt.before) { | ||
var nextSibling = getElement(options.insertInto + " " + options.insertAt.before); | ||
var nextSibling = getElement(options.insertAt.before, target); | ||
target.insertBefore(style, nextSibling); | ||
@@ -212,2 +215,9 @@ } else { | ||
if(options.attrs.nonce === undefined) { | ||
const nonce = getNonce(); | ||
if (nonce) { | ||
options.attrs.nonce = nonce; | ||
} | ||
} | ||
addAttrs(style, options.attrs); | ||
@@ -239,2 +249,10 @@ insertStyleElement(options, style); | ||
function getNonce() { | ||
if (typeof __webpack_nonce__ === 'undefined') { | ||
return null; | ||
} | ||
return __webpack_nonce__; | ||
} | ||
function addStyle (obj, options) { | ||
@@ -241,0 +259,0 @@ var style, update, remove, result; |
{ | ||
"name": "style-loader", | ||
"version": "0.21.0", | ||
"version": "0.22.0", | ||
"author": "Tobias Koppers @sokra", | ||
@@ -5,0 +5,0 @@ "description": "style loader module for webpack", |
@@ -91,2 +91,4 @@ [![npm][npm]][npm-url] | ||
The `style-loader` injects the styles lazily making them useable on-demand via `style.use()` / `style.unuse()` | ||
By convention the `Reference Counter API` should be bound to `.useable.css` and the `.css` should be loaded with basic `style-loader` usage.(similar to other file types, i.e. `.useable.less` and `.less`). | ||
@@ -93,0 +95,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43940
641
465