vendor/assets/javascripts/holder.js in holder_rails-2.6.0 vs vendor/assets/javascripts/holder.js in holder_rails-2.6.1
- old
+ new
@@ -1,16 +1,231 @@
/*!
Holder - client side image placeholders
-Version 2.6.0+51ebp
+Version 2.6.1+6bti3
© 2015 Ivan Malopinsky - http://imsky.co
Site: http://holderjs.com
Issues: https://github.com/imsky/holder/issues
License: http://opensource.org/licenses/MIT
*/
+//https://github.com/inexorabletash/polyfill/blob/master/web.js
+ if (!document.querySelectorAll) {
+ document.querySelectorAll = function (selectors) {
+ var style = document.createElement('style'), elements = [], element;
+ document.documentElement.firstChild.appendChild(style);
+ document._qsa = [];
+
+ style.styleSheet.cssText = selectors + '{x-qsa:expression(document._qsa && document._qsa.push(this))}';
+ window.scrollBy(0, 0);
+ style.parentNode.removeChild(style);
+
+ while (document._qsa.length) {
+ element = document._qsa.shift();
+ element.style.removeAttribute('x-qsa');
+ elements.push(element);
+ }
+ document._qsa = null;
+ return elements;
+ };
+ }
+
+ if (!document.querySelector) {
+ document.querySelector = function (selectors) {
+ var elements = document.querySelectorAll(selectors);
+ return (elements.length) ? elements[0] : null;
+ };
+ }
+
+ if (!document.getElementsByClassName) {
+ document.getElementsByClassName = function (classNames) {
+ classNames = String(classNames).replace(/^|\s+/g, '.');
+ return document.querySelectorAll(classNames);
+ };
+ }
+
+//https://github.com/inexorabletash/polyfill
+// ES5 15.2.3.14 Object.keys ( O )
+// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object/keys
+if (!Object.keys) {
+ Object.keys = function (o) {
+ if (o !== Object(o)) { throw TypeError('Object.keys called on non-object'); }
+ var ret = [], p;
+ for (p in o) {
+ if (Object.prototype.hasOwnProperty.call(o, p)) {
+ ret.push(p);
+ }
+ }
+ return ret;
+ };
+}
+
+//https://github.com/inexorabletash/polyfill/blob/master/web.js
+(function (global) {
+ var B64_ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
+ global.atob = global.atob || function (input) {
+ input = String(input);
+ var position = 0,
+ output = [],
+ buffer = 0, bits = 0, n;
+
+ input = input.replace(/\s/g, '');
+ if ((input.length % 4) === 0) { input = input.replace(/=+$/, ''); }
+ if ((input.length % 4) === 1) { throw Error('InvalidCharacterError'); }
+ if (/[^+/0-9A-Za-z]/.test(input)) { throw Error('InvalidCharacterError'); }
+
+ while (position < input.length) {
+ n = B64_ALPHABET.indexOf(input.charAt(position));
+ buffer = (buffer << 6) | n;
+ bits += 6;
+
+ if (bits === 24) {
+ output.push(String.fromCharCode((buffer >> 16) & 0xFF));
+ output.push(String.fromCharCode((buffer >> 8) & 0xFF));
+ output.push(String.fromCharCode(buffer & 0xFF));
+ bits = 0;
+ buffer = 0;
+ }
+ position += 1;
+ }
+
+ if (bits === 12) {
+ buffer = buffer >> 4;
+ output.push(String.fromCharCode(buffer & 0xFF));
+ } else if (bits === 18) {
+ buffer = buffer >> 2;
+ output.push(String.fromCharCode((buffer >> 8) & 0xFF));
+ output.push(String.fromCharCode(buffer & 0xFF));
+ }
+
+ return output.join('');
+ };
+
+ global.btoa = global.btoa || function (input) {
+ input = String(input);
+ var position = 0,
+ out = [],
+ o1, o2, o3,
+ e1, e2, e3, e4;
+
+ if (/[^\x00-\xFF]/.test(input)) { throw Error('InvalidCharacterError'); }
+
+ while (position < input.length) {
+ o1 = input.charCodeAt(position++);
+ o2 = input.charCodeAt(position++);
+ o3 = input.charCodeAt(position++);
+
+ // 111111 112222 222233 333333
+ e1 = o1 >> 2;
+ e2 = ((o1 & 0x3) << 4) | (o2 >> 4);
+ e3 = ((o2 & 0xf) << 2) | (o3 >> 6);
+ e4 = o3 & 0x3f;
+
+ if (position === input.length + 2) {
+ e3 = 64; e4 = 64;
+ }
+ else if (position === input.length + 1) {
+ e4 = 64;
+ }
+
+ out.push(B64_ALPHABET.charAt(e1),
+ B64_ALPHABET.charAt(e2),
+ B64_ALPHABET.charAt(e3),
+ B64_ALPHABET.charAt(e4));
+ }
+
+ return out.join('');
+ };
+}(this));
+
+//https://gist.github.com/jimeh/332357
+if (!Object.prototype.hasOwnProperty){
+ /*jshint -W001, -W103 */
+ Object.prototype.hasOwnProperty = function(prop) {
+ var proto = this.__proto__ || this.constructor.prototype;
+ return (prop in this) && (!(prop in proto) || proto[prop] !== this[prop]);
+ };
+ /*jshint +W001, +W103 */
+}
+
+// @license http://opensource.org/licenses/MIT
+// copyright Paul Irish 2015
+
+
+// Date.now() is supported everywhere except IE8. For IE8 we use the Date.now polyfill
+// github.com/Financial-Times/polyfill-service/blob/master/polyfills/Date.now/polyfill.js
+// as Safari 6 doesn't have support for NavigationTiming, we use a Date.now() timestamp for relative values
+
+// if you want values similar to what you'd get with real perf.now, place this towards the head of the page
+// but in reality, you're just getting the delta between now() calls, so it's not terribly important where it's placed
+
+
+(function(){
+
+ if ('performance' in window === false) {
+ window.performance = {};
+ }
+
+ Date.now = (Date.now || function () { // thanks IE8
+ return new Date().getTime();
+ });
+
+ if ('now' in window.performance === false){
+
+ var nowOffset = Date.now();
+
+ if (performance.timing && performance.timing.navigationStart){
+ nowOffset = performance.timing.navigationStart;
+ }
+
+ window.performance.now = function now(){
+ return Date.now() - nowOffset;
+ };
+ }
+
+})();
+
+//requestAnimationFrame polyfill for older Firefox/Chrome versions
+if (!window.requestAnimationFrame) {
+ if (window.webkitRequestAnimationFrame) {
+ //https://github.com/Financial-Times/polyfill-service/blob/master/polyfills/requestAnimationFrame/polyfill-webkit.js
+ (function (global) {
+ // window.requestAnimationFrame
+ global.requestAnimationFrame = function (callback) {
+ return webkitRequestAnimationFrame(function () {
+ callback(global.performance.now());
+ });
+ };
+
+ // window.cancelAnimationFrame
+ global.cancelAnimationFrame = webkitCancelAnimationFrame;
+ }(this));
+ } else if (window.mozRequestAnimationFrame) {
+ //https://github.com/Financial-Times/polyfill-service/blob/master/polyfills/requestAnimationFrame/polyfill-moz.js
+ (function (global) {
+ // window.requestAnimationFrame
+ global.requestAnimationFrame = function (callback) {
+ return mozRequestAnimationFrame(function () {
+ callback(global.performance.now());
+ });
+ };
+
+ // window.cancelAnimationFrame
+ global.cancelAnimationFrame = mozCancelAnimationFrame;
+ }(this));
+ } else {
+ (function (global) {
+ global.requestAnimationFrame = function (callback) {
+ return global.setTimeout(callback, 1000 / 60);
+ };
+
+ global.cancelAnimationFrame = global.clearTimeout;
+ })(this);
+ }
+}
+
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define(factory);
@@ -84,11 +299,11 @@
var dimensionCheck = utils.dimensionCheck;
//Constants and definitions
var SVG_NS = 'http://www.w3.org/2000/svg';
var NODE_TYPE_COMMENT = 8;
- var version = '2.6.0';
+ var version = '2.6.1';
var generatorComment = '\n' +
'Created with Holder.js ' + version + '.\n' +
'Learn more at http://holderjs.com\n' +
'(c) 2012-2015 Ivan Malopinsky - http://imsky.co\n';
@@ -1294,10 +1509,11 @@
//IE throws an exception if this is set and Chrome requires it to be set
if (svg.webkitMatchesSelector) {
svg.setAttribute('xmlns', SVG_NS);
}
+
//Remove comment nodes
for (var i = 0; i < svg.childNodes.length; i++) {
if (svg.childNodes[i].nodeType === NODE_TYPE_COMMENT) {
svg.removeChild(svg.childNodes[i]);
}
@@ -1317,11 +1533,11 @@
return svg;
}
/**
- * Returns XML processing instructions
+ * Returns serialized SVG with XML processing instructions
*
* @private
* @param svg SVG context
* @param stylesheets CSS stylesheets to include
*/
@@ -1339,11 +1555,14 @@
var csspi = xml.createProcessingInstruction('xml-stylesheet', 'href="' + stylesheets[i] + '" rel="stylesheet"');
xml.insertBefore(csspi, xml.firstChild);
}
//Add <?xml ... ?> UTF-8 directive
- var xmlpi = xml.createProcessingInstruction('xml', 'version="1.0" encoding="UTF-8" standalone="yes"');
- xml.insertBefore(xmlpi, xml.firstChild);
+ //todo: remove in 2.7
+ /*
+ var xmlpi = xml.createProcessingInstruction('xml', 'version="1.0" encoding="UTF-8" standalone="yes"');
+ xml.insertBefore(xmlpi, xml.firstChild);
+ */
xml.removeChild(xml.documentElement);
svgCSS = serializer.serializeToString(xml);
}
var svgText = serializer.serializeToString(svg);
\ No newline at end of file