Skip to content

Commit

Permalink
In BundleTransformer.Autoprefixer added a Array.prototype.fill poly…
Browse files Browse the repository at this point in the history
…fill
  • Loading branch information
Taritsyn committed Jun 21, 2017
1 parent 6d5a28f commit 4cc5f49
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

As a JS engine is used the JavaScript Engine Switcher library (https://github.com/Taritsyn/JavaScriptEngineSwitcher). For correct working of this module, you need to install one of the following NuGet packages: JavaScriptEngineSwitcher.Msie (only in the Chakra JsRT modes), JavaScriptEngineSwitcher.V8 or JavaScriptEngineSwitcher.ChakraCore.</description>
<summary>BundleTransformer.Autoprefixer contains one postprocessor-adapter for postprocessing of CSS code - `AutoprefixCssPostProcessor`. `AutoprefixCssPostProcessor` is based on the Andrey Sitnik's Autoprefixer version 7.1.1.2.</summary>
<releaseNotes>Added support of Autoprefixer version 7.1.1.2.</releaseNotes>
<releaseNotes>Added a `Array.prototype.fill` polyfill.</releaseNotes>
<copyright>Copyright (c) 2012-2017 Andrey Taritsyn - http://www.taritsyn.ru</copyright>
<language>en-US</language>
<tags>BundleTransformer System.Web.Optimization IBundleTransform ASP.NET CSS Bundling Postprocessing Postprocessor Autoprefixer</tags>
Expand Down
2 changes: 1 addition & 1 deletion NuGet/BundleTransformer.Autoprefixer/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
=============
RELEASE NOTES
=============
Added support of Autoprefixer version 7.1.1.2.
Added a `Array.prototype.fill` polyfill.

====================
POST-INSTALL ACTIONS
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,59 @@
/*!
* Array.prototype.fill polyfill
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill
*/
if (!Array.prototype.hasOwnProperty('fill')) {
var fillMethod = function (value) {
var arr,
length,
start,
relativeStart,
finalStart,
end,
relativeEnd,
finalEnd,
itemIndex
;

arr = this;
length = arr.length;

start = arguments[1];
relativeStart = parseInt(start, 10) || 0;
finalStart = relativeStart < 0 ?
Math.max(length + relativeStart, 0)
:
Math.min(relativeStart, length)
;

end = arguments[2];
relativeEnd = typeof end !== 'undefined' ? (parseInt(end, 10) || 0) : length;
finalEnd = relativeEnd < 0 ?
Math.max(length + relativeEnd, 0)
:
Math.min(relativeEnd, length)
;

itemIndex = finalStart;

while (itemIndex < finalEnd) {
arr[itemIndex] = value;
itemIndex++;
}

return arr;
};

if (Object.hasOwnProperty('defineProperty')) {
Object.defineProperty(Array.prototype, 'fill', {
value: fillMethod
});
}
else {
Array.prototype.fill = fillMethod;
}
}

/*!
* Math.log2 polyfill
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log2
Expand Down

0 comments on commit 4cc5f49

Please sign in to comment.