jquery-scopelinktags
Advanced tools
Comparing version 0.9.1 to 0.10.0
{ | ||
"name": "jquery-scopelinktags", | ||
"version": "0.9.1", | ||
"version": "0.10.0", | ||
"description": "A jQuery plugin that scopes the CSS rules of <link> tags", | ||
@@ -5,0 +5,0 @@ "main": "./src/jquery.scopeLinkTags.js", |
@@ -26,2 +26,10 @@ jQuery ScopeLinkTags plugin | ||
### styleTagSelector | ||
Type: [String](http://api.jquery.com/Types/#String) (Default: `'style'`) | ||
Can be used to change the selector used to find the `<style>` tags. | ||
### cssLinkSelector | ||
Type: [String](http://api.jquery.com/Types/#String) (Default: `'link[type="text/css"]'`) | ||
Can be used to change the selector used to find the `<link>` tags. | ||
### cssRuleRegex | ||
@@ -28,0 +36,0 @@ Type: [Regex](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp) |
@@ -107,2 +107,7 @@ ;(function ($, window, document, undefined) { | ||
var selectorDefaults = { | ||
styleTagSelector: 'style', | ||
cssLinkSelector: 'link[type="text/css"]' // [rel='stylesheet' ] | ||
}; | ||
$.fn[pluginName] = function (options) { | ||
@@ -112,7 +117,11 @@ var result, | ||
var STYLE_TAG_SELECTOR = 'style'; | ||
var CSS_LINK_SELECTOR = 'link[type="text/css"]'; // [rel='stylesheet' ] | ||
var selectorOptions = $.extend({}, selectorDefaults, options); | ||
var $filteredStyleElements = this.filter(STYLE_TAG_SELECTOR); | ||
var $filteredLinkElements = this.filter(CSS_LINK_SELECTOR); | ||
var $filteredLinkElements = this.filter(selectorOptions.cssLinkSelector); | ||
var $filteredStyleElements = this.filter(selectorOptions.styleTagSelector); | ||
var allCssTagSelector = [ | ||
selectorOptions.cssLinkSelector, | ||
selectorOptions.styleTagSelector | ||
].join(', '); | ||
@@ -123,3 +132,3 @@ var $links = $filteredLinkElements.length ? | ||
$filteredStyleElements : | ||
this.find(CSS_LINK_SELECTOR + ', ' + STYLE_TAG_SELECTOR); | ||
this.find(allCssTagSelector); | ||
@@ -129,3 +138,3 @@ $links.each(function () { | ||
var instance = $.data(this, pluginName); | ||
if (!instance && $this.is(CSS_LINK_SELECTOR)) { | ||
if (!instance && $this.is(allCssTagSelector)) { | ||
instance = new Plugin(this, options); | ||
@@ -132,0 +141,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
17804
12
175
83