Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Add a way to limit which stylesheets are processed #6139

Merged
merged 2 commits into from
Dec 7, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion prefixfree.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ if(!window.addEventListener) {
}

var self = window.StyleFix = {
optIn: document.currentScript.hasAttribute("data-prefix"),

link: function(link) {
var url = link.href || link.getAttribute('data-href');
try {
// Ignore stylesheets with data-noprefix attribute as well as alternate stylesheets or without (data-)href attribute
if(!url || link.rel !== 'stylesheet' || link.hasAttribute('data-noprefix')) {
if(!url || link.rel !== 'stylesheet' || link.hasAttribute('data-noprefix')
|| (self.optIn && !link.hasAttribute('data-prefix')) ) {
return;
}
}
Expand Down