I am trying to understand the changes made between the original JavaScript of HTMLCS and the TypeScript rewrite in this repository. I think I have found a case where this rewrite introduced a different semantic resulting in different result.
If you check the original code at https://github.com/squizlabs/HTML_CodeSniffer/blob/master/Standards/WCAG2AAA/Sniffs/Principle3/Guideline3_2/3_2_2.js, in line 60 to 72 there is a loop over all external buttons and for each button, a function is called processing this button. The same logic is realized in the TypeScript code using a for-each loop. The difference is in the contained 'switch' statement: for cases 'reset' and 'button' the JavaScript code returns, i.e. exits the function and the outer loop will process the next button. In the TypeScript code, there is 'break' keyword, which will just break from the switch, but the execution continues with the 'if' statement after the comment 'Confirm they are associated with the form' even if the button is of type 'reset' or 'button'
Not sure if I misunderstand the code or whether this change was intentional. If it is a bug, it is probably worth checking other source files for similar 'switch-and-break' statements.
I am trying to understand the changes made between the original JavaScript of HTMLCS and the TypeScript rewrite in this repository. I think I have found a case where this rewrite introduced a different semantic resulting in different result.
If you check the original code at https://github.com/squizlabs/HTML_CodeSniffer/blob/master/Standards/WCAG2AAA/Sniffs/Principle3/Guideline3_2/3_2_2.js, in line 60 to 72 there is a loop over all external buttons and for each button, a function is called processing this button. The same logic is realized in the TypeScript code using a for-each loop. The difference is in the contained 'switch' statement: for cases 'reset' and 'button' the JavaScript code returns, i.e. exits the function and the outer loop will process the next button. In the TypeScript code, there is 'break' keyword, which will just break from the switch, but the execution continues with the 'if' statement after the comment 'Confirm they are associated with the form' even if the button is of type 'reset' or 'button'
Not sure if I misunderstand the code or whether this change was intentional. If it is a bug, it is probably worth checking other source files for similar 'switch-and-break' statements.