diff --git a/svg-injector.js b/svg-injector.js
index 08de011..9d2d51e 100644
--- a/svg-injector.js
+++ b/svg-injector.js
@@ -259,8 +259,11 @@
}
// Copy all the data elements to the svg
- var imgData = [].filter.call(el.attributes, function (at) {
- return (/^data-\w[\w\-]*$/).test(at.name);
+ var imgData = [];
+ forEach.call(el.attributes, function (attribute) {
+ if ((/^data-\w[\w\-]*$/).test(attribute.name)) {
+ imgData.push(attribute);
+ }
});
forEach.call(imgData, function (dataAttr) {
if (dataAttr.name && dataAttr.value) {
diff --git a/tests/prototype-compatibility/assets/svg/thumb-up.svg b/tests/prototype-compatibility/assets/svg/thumb-up.svg
new file mode 100755
index 0000000..2c936b6
--- /dev/null
+++ b/tests/prototype-compatibility/assets/svg/thumb-up.svg
@@ -0,0 +1,4 @@
+
\ No newline at end of file
diff --git a/tests/prototype-compatibility/index.html b/tests/prototype-compatibility/index.html
new file mode 100755
index 0000000..7a9f902
--- /dev/null
+++ b/tests/prototype-compatibility/index.html
@@ -0,0 +1,17 @@
+
+
+
+
+ SVGInjector Test: Prototype.js Compatibility
+
+
+
+
+
+
+
+
+
diff --git a/tests/prototype-compatibility/js/prototype.js b/tests/prototype-compatibility/js/prototype.js
new file mode 100644
index 0000000..474b223
--- /dev/null
+++ b/tests/prototype-compatibility/js/prototype.js
@@ -0,0 +1,6082 @@
+/* Prototype JavaScript framework, version 1.7
+ * (c) 2005-2010 Sam Stephenson
+ *
+ * Prototype is freely distributable under the terms of an MIT-style license.
+ * For details, see the Prototype web site: http://www.prototypejs.org/
+ *
+ *--------------------------------------------------------------------------*/
+
+var Prototype = {
+
+ Version: '1.7',
+
+ Browser: (function(){
+ var ua = navigator.userAgent;
+ var isOpera = Object.prototype.toString.call(window.opera) == '[object Opera]';
+ return {
+ IE: !!window.attachEvent && !isOpera,
+ Opera: isOpera,
+ WebKit: ua.indexOf('AppleWebKit/') > -1,
+ Gecko: ua.indexOf('Gecko') > -1 && ua.indexOf('KHTML') === -1,
+ MobileSafari: /Apple.*Mobile/.test(ua)
+ }
+ })(),
+
+ BrowserFeatures: {
+ XPath: !!document.evaluate,
+
+ SelectorsAPI: !!document.querySelector,
+
+ ElementExtensions: (function() {
+ var constructor = window.Element || window.HTMLElement;
+ return !!(constructor && constructor.prototype);
+ })(),
+ SpecificElementExtensions: (function() {
+ if (typeof window.HTMLDivElement !== 'undefined')
+ return true;
+
+ var div = document.createElement('div'),
+ form = document.createElement('form'),
+ isSupported = false;
+
+ if (div['__proto__'] && (div['__proto__'] !== form['__proto__'])) {
+ isSupported = true;
+ }
+
+ div = form = null;
+
+ return isSupported;
+ })()
+ },
+
+ ScriptFragment: '