Cleanup Samigo JavaScript and use jQuery where possible
GENERAL
TESTING
GENERAL
TESTING
Description
100% Done
Activity
Show:
Sam Ottenhoff July 9, 2011 at 8:59 AM
I will turn this into a parent ticket with a bunch of sub-tickets with smaller, contained patches.
Sam Ottenhoff July 9, 2011 at 7:34 AM
Also, we should re-organize the Javascript in these files to put the JS in the helper files like js/delivery.js instead of inside the JSF body.
Details
Details
Priority
Affects versions
Components
Assignee
SAMIGO TEAM
SAMIGO TEAMReporter
Sam Ottenhoff
Sam OttenhoffLabels
Created July 9, 2011 at 6:53 AM
Updated April 17, 2018 at 8:08 AM
There is a lot of legacy, custom JavaScript in Samigo. We can reduce the amount of code by replacing a lot of these functions with jQuery code.
jQuery also takes care of a lot of cross-browser compatability issues for us. So instead of having to add conditional statements to Samigo, we can depend on jQuery to do it for us.
Here is an example of custom JavaScript in Samigo code:
84 function checkRadio()
85 {
86 for (i=0; i<document.forms[0].elements.length; i++)
87 {
88 if (document.forms[0].elements[i].type == "radio")
89 {
90 if (document.forms[0].elements[i].defaultChecked == true)
91 {
92 document.forms[0].elements[i].click();
93 }
94 }
95 }
96 }
Here is the equivalent code with jQuery:
$('form input[type="radio"]:checked').each().click();