[TASK] Use DOM API for field access in RSA encryption 81/42281/3
authorMathias Brodala <mbrodala@pagemachine.de>
Wed, 5 Aug 2015 15:52:55 +0000 (17:52 +0200)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Fri, 7 Aug 2015 13:06:48 +0000 (15:06 +0200)
DOM Level 2 provides collections for forms and form elements,
thus make use of them.

Resolves: #68765
Releases: master
Change-Id: I795b2c3348d7a39fdbe277df4c6661e3427c5e1f
Reviewed-on: http://review.typo3.org/42281
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
typo3/sysext/rsaauth/Resources/Public/JavaScript/RsaEncryption.js

index 75c5426..0ef3651 100644 (file)
                        if (form.submit.call) {
                                form.submit.call(rsaEncryption.form);
                        } else {
                        if (form.submit.call) {
                                form.submit.call(rsaEncryption.form);
                        } else {
-                               var fields = rsaEncryption.form.getElementsByTagName('*');
-                               for (var j = fields.length; j--;) {
-                                       var submitField = fields[j];
+                               for (var j = rsaEncryption.form.elements.length; j--;) {
+                                       var submitField = rsaEncryption.form.elements[j];
                                        if (submitField.nodeName.toLowerCase() === 'input' && submitField.type === "submit") {
                                                submitField.click();
                                        }
                                        if (submitField.nodeName.toLowerCase() === 'input' && submitField.type === "submit") {
                                                submitField.click();
                                        }
 
                documentReadyFunctionCalled = true;
                rng_seed_time();
 
                documentReadyFunctionCalled = true;
                rng_seed_time();
-               var forms = document.getElementsByTagName('form');
-               for (var i = forms.length; i--;) {
-                       var form = forms[i];
-                       var fields = form.getElementsByTagName('*');
-                       for (var j = fields.length; j--;) {
-                               var field = fields[j];
+               for (var i = document.forms.length; i--;) {
+                       var form = document.forms[i];
+                       for (var j = form.elements.length; j--;) {
+                               var field = form.elements[j];
                                if (field.nodeName.toLowerCase() === 'input') {
                                        var dataAttribute = field.getAttribute('data-rsa-encryption');
                                        if (dataAttribute || dataAttribute === '' && field.outerHTML.match(/ data-rsa-encryption=""/)) {
                                if (field.nodeName.toLowerCase() === 'input') {
                                        var dataAttribute = field.getAttribute('data-rsa-encryption');
                                        if (dataAttribute || dataAttribute === '' && field.outerHTML.match(/ data-rsa-encryption=""/)) {