diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..3c3629e
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+node_modules
diff --git a/dist/jquery.printelement.js b/dist/jquery.printelement.js
index d294f99..fa9efc5 100644
--- a/dist/jquery.printelement.js
+++ b/dist/jquery.printelement.js
@@ -1,6 +1,6 @@
-/*! jQuery printElement - v2.0.1 - 2014-08-22
+/*! jQuery printElement - v2.0.1 - 2015-04-15
* https://github.com/erikzaadi/jQuery.printElement
-* Copyright (c) 2014 erikzaadi; Licensed MIT, GPL */
+* Copyright (c) 2015 erikzaadi; Licensed MIT, GPL */
/*global window,focus,setTimeout,navigator*/
(function (window, undefined) {
var document = window.document;
@@ -53,7 +53,9 @@
var popupOrIframe = null;
var documentToWriteTo = null;
if (opts.printMode.toLowerCase() === 'popup') {
- popupOrIframe = window.open('about:blank', 'printElementWindow', 'width=650,height=440,scrollbars=yes');
+ // IE duplication name bug: http://stackoverflow.com/questions/7146767/i-get-access-is-denied-when-i-try-to-print-a-page-using-jquery-printelement-js
+ var windowName = 'printElementWindow_' + (Math.round(Math.random() * 99999)).toString();
+ popupOrIframe = window.open('about:blank', windowName, 'width=650,height=440,scrollbars=yes');
documentToWriteTo = popupOrIframe.document;
} else {
//The random ID is to overcome a safari bug http://www.cjboco.com.sharedcopy.com/post.cfm/442dc92cd1c0ca10a5c35210b8166882.html
diff --git a/dist/jquery.printelement.min.js b/dist/jquery.printelement.min.js
index 7a29cb9..f4030f9 100644
--- a/dist/jquery.printelement.min.js
+++ b/dist/jquery.printelement.min.js
@@ -1,4 +1,4 @@
-/*! jQuery printElement - v2.0.1 - 2014-08-22
+/*! jQuery printElement - v2.0.1 - 2015-04-15
* https://github.com/erikzaadi/jQuery.printElement
-* Copyright (c) 2014 erikzaadi; Licensed MIT, GPL */
-!function(a){function b(b,d){var e=f(b,d),i=null,j=null;if("popup"===d.printMode.toLowerCase())i=a.open("about:blank","printElementWindow","width=650,height=440,scrollbars=yes"),j=i.document;else{var k="printElement_"+Math.round(99999*Math.random()).toString(),l=g.createElement("IFRAME");h(l).attr({style:d.iframeElementOptions.styleToAdd,id:k,className:d.iframeElementOptions.classNameToAdd,frameBorder:0,scrolling:"no",src:"about:blank"}),g.body.appendChild(l),j=l.contentWindow||l.contentDocument,j.document&&(j=j.document),l=g.frames?g.frames[k]:g.getElementById(k),i=l.contentWindow||l}focus(),j.open(),j.write(e),j.close(),c(i)}function c(a){a&&a.printPage?a.printPage():setTimeout(function(){c(a)},50)}function d(a){var b=h(a);h(":checked",b).each(function(){this.setAttribute("checked","checked")}),h("input[type='text'],input[type='number']",b).each(function(){this.setAttribute("value",h(this).val())}),h("select",b).each(function(){var a=h(this);h("option",a).each(function(){a.val()===h(this).val()&&this.setAttribute("selected","selected")})}),h("textarea",b).each(function(){var a=h(this).attr("value");this.firstChild?this.firstChild.textContent=a:this.innerHTML=a});var c=h("
").append(b.clone()).html();return c}function e(){var b=a.location.port?":"+a.location.port:"";return a.location.protocol+"//"+a.location.hostname+b+a.location.pathname}function f(a,b){var c=h(a),f=d(a),i=[];if(i.push(""+b.pageTitle+""),b.overrideElementCSS){if(b.overrideElementCSS.length>0)for(var j=0;j');else{var l=k.media||"";i.push('')}}}else h("link",g).filter(function(){return"stylesheet"===h(this).attr("rel").toLowerCase()}).each(function(){var a=h(this).attr("media")||"";i.push('')});return i.push(''),i.push(''),i.push(''+f+"
"),i.push('"),i.push(""),i.join("")}var g=a.document,h=a.jQuery;h.fn.printElement=function(a){var c=h.extend({},h.fn.printElement.defaults,a);return"iframe"===c.printMode&&/chrome/.test(navigator.userAgent.toLowerCase())&&(c.printMode="popup"),h("[id^='printElement_']").remove(),this.each(function(){var a=h.meta?h.extend({},c,h(this).data()):c;b(h(this),a)})},h.fn.printElement.defaults={printMode:"iframe",pageTitle:"",overrideElementCSS:null,printBodyOptions:{styleToAdd:"padding:10px;margin:10px;",classNameToAdd:""},leaveOpen:!1,iframeElementOptions:{styleToAdd:"border:none;position:absolute;width:0px;height:0px;bottom:0px;left:0px;",classNameToAdd:""}},h.fn.printElement.cssElement={href:"",media:""}}(window);
\ No newline at end of file
+* Copyright (c) 2015 erikzaadi; Licensed MIT, GPL */
+!function(a,b){function c(b,c){var e=g(b,c),f=null,j=null;if("popup"===c.printMode.toLowerCase()){var k="printElementWindow_"+Math.round(99999*Math.random()).toString();f=a.open("about:blank",k,"width=650,height=440,scrollbars=yes"),j=f.document}else{var l="printElement_"+Math.round(99999*Math.random()).toString(),m=h.createElement("IFRAME");i(m).attr({style:c.iframeElementOptions.styleToAdd,id:l,className:c.iframeElementOptions.classNameToAdd,frameBorder:0,scrolling:"no",src:"about:blank"}),h.body.appendChild(m),j=m.contentWindow||m.contentDocument,j.document&&(j=j.document),m=h.frames?h.frames[l]:h.getElementById(l),f=m.contentWindow||m}focus(),j.open(),j.write(e),j.close(),d(f)}function d(a){a&&a.printPage?a.printPage():setTimeout(function(){d(a)},50)}function e(a){var b=i(a);i(":checked",b).each(function(){this.setAttribute("checked","checked")}),i("input[type='text'],input[type='number']",b).each(function(){this.setAttribute("value",i(this).val())}),i("select",b).each(function(){var a=i(this);i("option",a).each(function(){a.val()===i(this).val()&&this.setAttribute("selected","selected")})}),i("textarea",b).each(function(){var a=i(this).attr("value");this.firstChild?this.firstChild.textContent=a:this.innerHTML=a});var c=i("").append(b.clone()).html();return c}function f(){var b=a.location.port?":"+a.location.port:"";return a.location.protocol+"//"+a.location.hostname+b+a.location.pathname}function g(a,b){var c=i(a),d=e(a),g=[];if(g.push(""+b.pageTitle+""),b.overrideElementCSS){if(b.overrideElementCSS.length>0)for(var j=0;j');else{var l=k.media||"";g.push('')}}}else i("link",h).filter(function(){return"stylesheet"===i(this).attr("rel").toLowerCase()}).each(function(){var a=i(this).attr("media")||"";g.push('')});return g.push(''),g.push(''),g.push(''+d+"
"),g.push('"),g.push(""),g.join("")}var h=a.document,i=a.jQuery;i.fn.printElement=function(a){var b=i.extend({},i.fn.printElement.defaults,a);return"iframe"===b.printMode&&/chrome/.test(navigator.userAgent.toLowerCase())&&(b.printMode="popup"),i("[id^='printElement_']").remove(),this.each(function(){var a=i.meta?i.extend({},b,i(this).data()):b;c(i(this),a)})},i.fn.printElement.defaults={printMode:"iframe",pageTitle:"",overrideElementCSS:null,printBodyOptions:{styleToAdd:"padding:10px;margin:10px;",classNameToAdd:""},leaveOpen:!1,iframeElementOptions:{styleToAdd:"border:none;position:absolute;width:0px;height:0px;bottom:0px;left:0px;",classNameToAdd:""}},i.fn.printElement.cssElement={href:"",media:""}}(window);
\ No newline at end of file
diff --git a/package.json b/package.json
index 05e5fc6..a9214a1 100644
--- a/package.json
+++ b/package.json
@@ -1,5 +1,5 @@
{
- "name": "jquery.printElement",
+ "name": "jquery.printelement",
"title": "jQuery printElement",
"description": "The best jQuery plugin ever.",
"version": "2.0.1",
diff --git a/src/jquery.printelement.js b/src/jquery.printelement.js
index ba0f499..7bb7eb0 100644
--- a/src/jquery.printelement.js
+++ b/src/jquery.printelement.js
@@ -64,7 +64,9 @@
var popupOrIframe = null;
var documentToWriteTo = null;
if (opts.printMode.toLowerCase() === 'popup') {
- popupOrIframe = window.open('about:blank', 'printElementWindow', 'width=650,height=440,scrollbars=yes');
+ // IE duplication name bug: http://stackoverflow.com/questions/7146767/i-get-access-is-denied-when-i-try-to-print-a-page-using-jquery-printelement-js
+ var windowName = 'printElementWindow_' + (Math.round(Math.random() * 99999)).toString();
+ popupOrIframe = window.open('about:blank', windowName, 'width=650,height=440,scrollbars=yes');
documentToWriteTo = popupOrIframe.document;
} else {
//The random ID is to overcome a safari bug http://www.cjboco.com.sharedcopy.com/post.cfm/442dc92cd1c0ca10a5c35210b8166882.html