Skip to content

Commit 2b4b891

Browse files
committed
Fix for issue #29 - Safari bug with setting readonly properties
1 parent b35795d commit 2b4b891

5 files changed

Lines changed: 27 additions & 12 deletions

File tree

dist/paypal-button-minicart.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*!
22
* PayPalJSButtons
33
* JavaScript integration for PayPal's payment buttons
4-
* @version 1.0.1 - 2013-03-30
4+
* @version 1.0.1 - 2013-04-03
55
* @author Jeff Harrell <https://github.com/jeffharrell/>
66
*/
77
/*!
@@ -1937,7 +1937,12 @@ PAYPAL.apps = PAYPAL.apps || {};
19371937
form.appendChild(child);
19381938
}
19391939

1940-
btn.type = 'submit';
1940+
// Safari won't let you set read-only attributes on buttons.
1941+
try {
1942+
btn.type = 'submit';
1943+
} catch (e) {
1944+
btn.setAttribute('type', 'submit');
1945+
}
19411946
btn.className = 'paypal-button ' + size;
19421947
btn.appendChild(document.createTextNode(localeText[type]));
19431948

@@ -1972,7 +1977,7 @@ PAYPAL.apps = PAYPAL.apps || {};
19721977
css = '';
19731978
styleEl = document.createElement('style');
19741979
paypalButton = '.paypal-button';
1975-
paypalInput = paypalButton + ' button[type=submit]';
1980+
paypalInput = paypalButton + ' button';
19761981

19771982
css += paypalButton + ' { white-space: nowrap; }';
19781983
css += paypalInput + ' { white-space: nowrap; overflow: hidden; border-radius: 13px; font-family: "Arial", bold, italic; font-weight: bold; font-style: italic; border: 1px solid #ffa823; color: #0E3168; background: #ffa823; position: relative; text-shadow: 0 1px 0 rgba(255,255,255,.5); cursor: pointer; z-index: 0; }';

dist/paypal-button-minicart.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/paypal-button.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*!
22
* PayPalJSButtons
33
* JavaScript integration for PayPal's payment buttons
4-
* @version 1.0.1 - 2013-03-30
4+
* @version 1.0.1 - 2013-04-03
55
* @author Jeff Harrell <https://github.com/jeffharrell/>
66
*/
77
if (typeof PAYPAL === 'undefined' || !PAYPAL) {
@@ -204,7 +204,12 @@ PAYPAL.apps = PAYPAL.apps || {};
204204
form.appendChild(child);
205205
}
206206

207-
btn.type = 'submit';
207+
// Safari won't let you set read-only attributes on buttons.
208+
try {
209+
btn.type = 'submit';
210+
} catch (e) {
211+
btn.setAttribute('type', 'submit');
212+
}
208213
btn.className = 'paypal-button ' + size;
209214
btn.appendChild(document.createTextNode(localeText[type]));
210215

@@ -239,7 +244,7 @@ PAYPAL.apps = PAYPAL.apps || {};
239244
css = '';
240245
styleEl = document.createElement('style');
241246
paypalButton = '.paypal-button';
242-
paypalInput = paypalButton + ' button[type=submit]';
247+
paypalInput = paypalButton + ' button';
243248

244249
css += paypalButton + ' { white-space: nowrap; }';
245250
css += paypalInput + ' { white-space: nowrap; overflow: hidden; border-radius: 13px; font-family: "Arial", bold, italic; font-weight: bold; font-style: italic; border: 1px solid #ffa823; color: #0E3168; background: #ffa823; position: relative; text-shadow: 0 1px 0 rgba(255,255,255,.5); cursor: pointer; z-index: 0; }';

0 commit comments

Comments
 (0)